# to_decision_input

> **Function** in `langchain_openai`

📖 [View in docs](https://reference.langchain.com/python/langchain-openai/decisions/_input/to_decision_input)

Convert state to a string or a list of user messages.

Strings are sent as is, and sequences of `HumanMessage` objects as user messages.
Anything else, such as conversations with system, AI, or tool messages, is
serialized to JSON text in a single user message, with base64 images from any
message kept in place as image parts.

## Signature

```python
to_decision_input(
    state: State,
) -> str | list[dict[str, Any]]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `state` | `State` | Yes | Text, messages, or structured state to evaluate. |

## Returns

`str | list[dict[str, Any]]`

A value suitable for the Decisions API `input` field.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/16a08bda1247010c23fcfa887e421259a5fced5e/libs/partners/openai/langchain_openai/decisions/_input.py#L21)