AI and LLMs · Concept

Structured output

Asking a model to reply in an exact machine-readable shape, usually JSON that matches a schema you define, so your code can use the answer directly.

Building with models · updated

How it works

Rather than parsing free text, you pass a JSON Schema (or a Zod or Pydantic model that the SDK converts) describing the fields you want, such as name, email and a priority from a fixed list. With strict structured outputs, offered by OpenAI, Google and Anthropic, the provider constrains generation so the reply always parses and matches the schema. Older 'JSON mode' only promised valid JSON, not the right fields.

It turns a model into a dependable component: extracting invoice fields, tagging support tickets, filling a form from an email, or returning a plan an agent can carry out. The shape is guaranteed but the content is not, so values still need validation and business rules (an extracted total can be wrong even when it is a valid number). Keep schemas small and descriptive, since field names and descriptions guide the model.

More in AI and LLMs

Building with models

All 22 AI and LLMs terms

Crafted in the dark. Shipped to the world.

Tell us what you are building. You get a private project space with a proposal and a line-by-line quote within a day.