MemotivaPrompt Engineering Patterns: Structured Outputs, JSON Mode, Function Calling, Schema Validation

How does structured output work in modern LLMs?

Prompt Engineering Patterns: Structured Outputs, JSON Mode, Function Calling, Schema Validation

Audio flashcard · 0:19

Nortren·

How does structured output work in modern LLMs?

0:19

Structured output is enforced at the decoding level by constraining the model's token choices to only those that produce valid output according to a schema. This guarantees the response will parse correctly, unlike prompt-based JSON requests which can produce malformed output. OpenAI's structured outputs use a JSON Schema; Anthropic's Claude supports tool use with strict schemas.
platform.openai.com