Structured Output
Forcing an LLM to return data in a specific format — usually JSON matching a schema — so downstream code can parse it reliably.
In plain English
Structured output is the capability for an LLM to return data in a strict, parseable format (most commonly JSON, sometimes XML or a custom format). Instead of free-form text you have to regex out, you get a predictable object you can hand straight to the next step in a pipeline.
Why it matters:
- Reliability — production systems need predictable shapes
- Tool use — every function call is a structured output under the hood
- Less prompt engineering — the schema does most of the work
- Easier testing — structured outputs are easy to validate
How providers implement it:
- OpenAI — Structured Outputs (guaranteed schema compliance via constrained decoding)
- Anthropic — tool-use schema + JSON mode
- Google Gemini —
responseSchemaparameter - Open-source — Outlines, Instructor, BAML, JSONFormer enforce schemas on any model
Common patterns:
- Extracting structured fields from unstructured text (resumes, invoices, emails)
- Returning multiple candidate options as an array of objects
- Building agent action schemas (the model picks an action + fills in arguments)
Most production LLM pipelines lean heavily on structured output.