Expand description
Conversion between framework types and the Mistral chat-completions wire format.
Mistral’s POST /v1/chat/completions endpoint is wire-compatible with
OpenAI’s Chat Completions API for the parts both providers share (message
shape, function-tool shape, tool-call/response shape, token usage shape),
so message conversion, tool conversion, and response/usage parsing are all
reused verbatim from [agent_framework_openai::convert] — the same
approach agent-framework-azure takes for Azure OpenAI. Request-option
handling is not fully shared, because Mistral’s supported option set
differs from OpenAI’s in real ways (see apply_options), so that part
is implemented here instead of reused.
Functions§
- apply_
options - Apply the scalar
ChatOptionsfields Mistral’s Chat Completions API actually supports onto a request body map. - build_
request - Build a full Mistral
POST /v1/chat/completionsrequest body. - classify_
mistral_ error - Classify a non-success Mistral Chat Completions API HTTP response into a
granular
Error. - parse_
response - Parse a full (non-streaming) Mistral chat-completion response.