Expand description
OpenAI Chat Completions dialect: tool_calls in, role: "tool" denial
messages out. Works with the OpenAI SDKs and any OpenAI-compatible server.
Constants§
- DIALECT
- Dialect name used in error messages and the Python bindings.
Functions§
- denial
- Render a denied/undecided call as the
role: "tool"message the chat history expects, so the model receives the refusal as tool output. ReturnsNonefor allowed calls. - filter_
tools - Filter a request’s
toolsarray down to the definitionskeepaccepts. Handles both the Chat Completions shape ({"type": "function", "function": {"name": ...}}) and the Responses API shape ({"type": "function", "name": ...}). Unidentifiable entries are dropped. - parse_
tool_ calls - Parse tool calls from any of the shapes the OpenAI API surfaces them in:
a full chat completion (
choices[*].message.tool_calls), an assistant message ({"tool_calls": [...]}), or the baretool_callsarray.