Structured output

  • Standard term

Structured output is an AI reply returned as labeled fields in a fixed format, such as name, date, and amount, so another program reads each value directly.

You describe the fields in advance, each with a type such as a date or whole number, in a “schema.” Some AI providers then limit the model's word choices as it writes, so the reply fits. A format requested in plain words can drift, and one stray sentence or renamed field breaks the next program.

Where you’ll meet it

Your assistant reads your email and adds appointments to your calendar. Sometimes it writes “TBD” or “after lunch” where the time goes, and twice this month the calendar step dropped an appointment it couldn't read.

What to do

Ask the assistant to return each appointment as fixed fields for title, date, and start time, with its provider's schema setting on if there is one. Let the time stay empty when an email gives none, since a required field invites a guess. Have any appointment without a time come to you before it reaches the calendar.

Easy to mix up

Does it differ from one task to the next?
Structured outputJSON
Yes, each task gets its own list of fieldsNo, it's one standard text format programs use to pass data

Check yourself

Your shop's assistant returns orders as valid JSON every time. One order lists a quantity of 0 for an item the customer plainly wanted. What does that show?

Go deeperEnforcement covers part of the schema standard, and field order affects answers

Limiting word choices this way is called “constrained decoding.” Providers usually support only part of JSON Schema, the common standard for writing schemas in JSON, so a rule outside that part may be rejected when you set the schema up and then has to be checked in your own code. A reply cut off at the length limit, or a refusal, can still arrive incomplete.

The order of the fields also affects quality. A model writes them in sequence, so an answer field placed first makes it commit before it has worked anything out, and a field for its reasoning placed before the answer avoids that.

Practice Agent Ops

Or take the learning quiz on a mix of every set