Skip to main content

Module openai

Module openai 

Source
Expand description

Chat Completions (POST {base}/chat/completions), the format OpenAI, Azure OpenAI (v1), Mistral, OpenRouter, Groq, Ollama, vLLM and LM Studio speak. Stateless like the Messages API, so the loop stays the same.

Rules (design page):

  • strict, tool_choice and parallel_tool_calls are never sent.
  • Tool arguments are a JSON string that may be invalid: a call whose arguments do not parse as an object gets a tool error, the run goes on.
  • A missing call id is made up (9 alphanumeric characters – Mistral rejects longer ids); an id from the server is sent back unchanged.
  • Tool calls win over finish_reason (some servers say stop).
  • There is no error flag on a tool message: a failed result starts with Error: .
  • Without usage in the reply, Usage::reported is false.

Structs§

OpenAi
The Chat Completions wire format.

Enums§

Flavour
Which flavour of Chat Completions.