Definition

Structured outputs are model responses constrained to a machine-readable structure, often specified with JSON Schema or a typed contract. The caller supplies that contract to a supporting API or runtime so it can constrain generation. Simply prompting the model to return JSON gives no such guarantee.

Simple example

A triage feature requests an object with category, confidence, and needsHumanReview fields. The model returns valid JSON matching that schema, and the application deserializes it into a C# type without scraping labels from free-form text.

Why it matters

A defined shape reduces parsing ambiguity and makes malformed responses easier to detect. It is useful when model output feeds validation, UI rendering, routing, or tool arguments. The contract also gives tests a deterministic boundary: the response either conforms to the expected representation or it does not.

One important nuance

Schema validity is not business validity. A response can satisfy its schema yet choose a permitted but incorrect category or use an identifier the caller cannot access. Where supported, express allowed categories and confidence ranges in the schema. After deserialization, application code must still check business rules, ownership, and authorization. Define how the application handles validation failures instead of automatically retrying until the model returns an acceptable value. Structured output improves the interface with the model. It does not make the model’s claims trustworthy or grant permission to act.