# messages_to_foundry_format

> **Function** in `langchain_azure_ai`

📖 [View in docs](https://reference.langchain.com/python/langchain-azure-ai/evaluation/converter/messages_to_foundry_format)

Convert a LangChain message sequence to Foundry evaluator input.

Splits the conversation into ``query`` (system + user messages up to
the last user message) and ``response`` (everything after, typically
assistant and tool messages).

## Signature

```python
messages_to_foundry_format(
    messages: Sequence[BaseMessage],
    *,
    tool_definitions: list[dict[str, Any]] | None = None,
) -> dict[str, Any]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `messages` | `Sequence[BaseMessage]` | Yes | Ordered list of LangChain BaseMessage objects. |
| `tool_definitions` | `list[dict[str, Any]] \| None` | No | Optional tool schemas to include in the evaluator input (used by ToolCallAccuracy, ToolSelection, etc.). (default: `None`) |

## Returns

`dict[str, Any]`

Dict with ``query``, ``response``, and optionally

---

[View source on GitHub](https://github.com/langchain-ai/langchain-azure/blob/7a6a664d617264df8dcb12fcfb1bacc09f21d504/libs/azure-ai/langchain_azure_ai/evaluation/converter.py#L24)