Structured Output
Structured output asks a model to return data in a predictable schema instead of free-form prose.
Use structured output when downstream code needs reliable fields, labels, choices, or extracted values.
Use when
- Classification
- Data extraction
- Routing
- UI-ready responses
Avoid when
- Open-ended writing
- Unclear schemas
- Business rules without validation
- Cases where humans read all output directly
Why structured output is often enough
Many AI product features need the model to produce fields, not prose. A schema can make extraction, classification, routing, and UI rendering easier to validate.
Structured output is usually simpler than function calling when no external action is needed. The model returns data, and the application decides what to do with it.
When to go beyond it
Use function or tool calling when the model needs to request an external operation. Use structured output when the output itself is the product input.
Common mistakes
- Asking for JSON without validating it.
- Making schemas too broad.
- Using tool calling for simple extraction.
Next decision
Start with structured output for classification and extraction. Add function calling only when the model must choose an external capability.