Structured Output

Process tools published

Also known as: Structured Generation, Constrained Output, Schema-Constrained Output

Definition

Constraining an LLM's output to conform to a specified structure, typically a JSON Schema. Unlike free-form text generation, structured output guarantees the response matches a defined format—valid JSON with specific fields and types. This enables reliable parsing and integration with typed systems.

What this is NOT

  • Not just outputting JSON (structured output guarantees schema compliance)
  • Not the same as function calling (function calling is for actions; structured output is for formatting)
  • Not prompt engineering (structured output is API-level enforcement)

Alternative Interpretations

Different communities use this term differently:

llm-practitioners

API features that force model output to match a JSON Schema, either through constrained decoding (grammar-based) or strong prompting with validation. OpenAI's "Structured Outputs" and similar features guarantee schema compliance.

Sources: OpenAI Structured Outputs documentation, Instructor library documentation, Outlines, LMQL, Guidance libraries

Examples

  • OpenAI API with response_format specifying a JSON Schema
  • Instructor library extracting Pydantic models from LLM output
  • Extracting structured entities: {name, email, company} from text
  • Classification output constrained to enum values

Counterexamples

Things that might seem like Structured Output but are not:

  • Model outputting JSON without schema validation (might be malformed)
  • Free-form text response parsed with regex
  • Asking the model to 'output JSON' in the prompt without enforcement

Relations

  • overlapsWith function-calling (Function calls are a form of structured output)
  • overlapsWith json-mode (JSON mode is a weaker form of structured output)
  • overlapsWith tool-definition (Definitions use schemas that structured output can enforce)

Implementations

Tools and frameworks that implement this concept: