Structured output

Also called structured outputs, JSON mode, schema-constrained output

An API setting that makes a model's reply fit a JSON schema you give it, so your code gets the fields and types it expects.

A model writes its reply one token at a time, so asking for JSON in the prompt works most days and fails now and then: a friendly sentence before the brace, a missing field. Structured output fixes the shape at the source. You hand the API a schema, and as the model writes, it can only produce what keeps the reply valid against it.

What it can't do is make the content right. The fields arrive and the types match, but a wrong value fits a schema as neatly as a right one. And a refusal, or a reply cut off at the length limit, can still come back in place of your JSON.

For example

A support assistant sorting requests sends back the same fields every time, a category and an order number, instead of now and then opening with a friendly sentence that breaks the parser.

WITH PLUS

Put it to use

Where you'll meet structured output in ChatGPT, Gemini and Claude, how to use it there, and the mix-up most people make.

Daily Bytes Plus is in the Android app.