Structured outputs & tools¶
response_format¶
Azure AI Foundryโs chat completion reference and OpenAIโs chat completion reference document response_format with:
{ "type": "text" }(default){ "type": "json_object" }(JSON mode) โ valid JSON, but schema adherence is not enforced{ "type": "json_schema", "json_schema": {...} }(Structured Outputs) โ enforces a JSON Schema
Important note from Azure docs: in JSON mode (json_object), you should also instruct the model to output JSON; otherwise the model may stream whitespace until it reaches the token limit.
Structured outputs (recommended)¶
Microsoft Learn describes Structured Outputs as a way to force the model to follow a supplied JSON Schema, and contrasts it with older JSON mode that only guarantees valid JSON.
tools and tool_choice¶
Azure OpenAI REST reference documents:
tools: list of function tools the model may calltool_choice: control whether tools are used (none/auto/required) or force a specific tool.
This playbook uses tools sparingly, but you can incorporate them into experiments to measure impacts on accuracy and cost.
Next: Experimentation.