Structured output
Structured output is the LLM feature that guarantees the response matches a provided schema (JSON Schema, Zod, Pydantic) — eliminating the parsing failures and format drift that plagued early LLM applications. Modern APIs (OpenAI Structured Outputs, Anthropic JSON mode, Gemini response_schema) implement this via constrained decoding or grammar-aware sampling.
Structured output is the bridge between LLM outputs and downstream code. Without it, applications had to parse free-form text and handle the inevitable cases where the model returned text-with-JSON-inside, JSON-with-extra-text, or malformed JSON entirely. With guaranteed schema conformance, the application can typed-dispatch on the response without defensive parsing. The cost: slightly less flexibility (the model can't deviate from the schema even when deviation would help) and occasional quality degradation on tasks where the schema is too restrictive. The wins almost always outweigh the costs in production applications.
Related terms
- Function calling
Function calling lets an LLM invoke external tools by emitting a structured request matching a function specification provided in the prompt.
- JSON mode
JSON mode is an LLM API parameter that guarantees the response is valid JSON — even when no specific schema is provided.
- System prompt
A system prompt is the initial instruction given to an LLM at the start of a session that sets behaviour, persona, output format, and constraints — distinct from user messages that follow.