Structured outputs let you ask models for machine-readable results instead of unconstrained prose.Documentation Index
Fetch the complete documentation index at: https://docs.naga.ac/llms.txt
Use this file to discover all available pages before exploring further.
JSON Prompting vs Schema Enforcement
Prompting for JSON only asks the model to behave. Schema enforcement gives the model an explicit shape to follow. Use schema enforcement when your application depends on:- required keys always being present
- enums staying valid
- arrays and nested objects staying well-formed
- downstream parsers not breaking on malformed text
Support Matrix
| API | Main request field | Notes |
|---|---|---|
Responses | text.format | Best starting point for new structured-output work |
Chat Completions | response_format | Use when you need OpenAI chat compatibility |
Messages | No generic structured-output field | Use tool schemas for Anthropic-style tool workflows when needed |
When To Use It
- extract entities, events, or records into a fixed schema
- feed model output into downstream automation
- reduce parser failures caused by malformed JSON
Recommended Example
API-Specific Guides
Pitfalls
- JSON prompting is weaker than schema enforcement
strict: truehelps, but your schema still needsrequiredfields and closed objects where that matters