← Prompting & System Design
04 · Prompting & System Design · Topic 02

What are Structured Outputs?

Structured outputs make an AI response follow a defined data shape.

What is it?

A structured output is a model response that follows a defined schema or format.

The shape can specify fields, types, required values, and allowed options. The application can then validate and use the result more reliably.

Think of it like...

Think of it like filling out a form.

The form tells you which fields to complete and what each field means. A schema gives the model a similar shape, but the response still needs validation.

How it works

1 · DefineWrite the schemaSpecify fields, types, and requirements.
2 · RequestSend the taskAsk the model to return the defined shape.
3 · GenerateCreate the resultThe model fills the fields.
4 · ValidateCheck the structureThe system checks types and required values.
5 · HandleContinue or recoverUse the result or handle a validation failure.

Real-world examples

Everyday example · Contact card

Input: a message containing a person's details

AI / System: extracts name, email, and phone fields

Output: a validated contact object

Business example · Invoice extraction

Input: an invoice document

AI / System: returns fields required by the finance system

Output: structured invoice data or an error

What it is NOT

Structured Output ≠ Plain Text

Structured output: follows a defined data shape.

Plain text: has no required machine-readable structure.

Structured Output ≠ Guaranteed Accuracy

Structured output: checks shape and types.

Accuracy: checks whether the values are correct.

Structured Output ≠ Database Storage

Structured output: is the result returned by the model.

Database storage: is what an application may do with that result.

Remember this

Structured outputs make model responses easier for software to validate and use.

Independent explainer

Video

visual explainer
↑