Structured output is model output requested or constrained to match a defined format or schema. It can simplify parsing, but a schema-valid response can still contain incorrect facts, invalid business values, or an unauthorized proposed action.
Formats and constraints
A prompt can request a format, while some model APIs provide constrained generation for supported schemas. Exact guarantees and exceptions depend on the model and API. Distinguish valid JSON syntax from conformance to your schema and from business-rule validity.
Example: invoice extraction
An output can contain every required field and still put a delivery date in the invoice-date field. Validate against the source document, check relationships between fields, and send uncertain critical values for review.
Handle incomplete and refused responses
Exercise output limits, interrupted streams, refusals, missing fields, and unexpected values. Validate before passing an object to another system, and enforce authorization before any side effect. Do not assume a parseable object means the requested task succeeded.
Practical example
A model returns an invoice object that matches a schema but includes an impossible date.
What to check
Validate schema, business rules, provenance, and refusal or incomplete-response handling separately.
Limits and tradeoffs
Schema compliance and valid JSON do not establish factual correctness or permission to execute an action.
Maintained by DriftRail. AI assisted the October 2026 content and template revision. Examples are illustrative; they are not measured product benchmarks. Suggest a correction.