Prompting and tools · about 15 minutes of study

Structured output

Structured output constrains an answer to a shape such as a JSON schema. Correct structure and correct meaning are separate requirements.

Before you start: Review Few-shot first. Python-like examples use variables, lists and functions.

Guided concept walkthrough

Follow the mechanism

Contract

Define required types and allowed values.

1 / 4

A conceptual animation, not a live model trace. Play advances every five seconds and stops at the final stage.

Start with an everyday explanation

A form can insist that every box is filled correctly while still containing a false address. Shape checks are necessary but cannot establish the facts.

See a concrete example

A schema allows approve, reject and needs_review. A record marked lapsed can still receive an invalid semantic approve even though the enum is legal.

A claim to question

Schema-conforming output is not evidence of truth, permission or successful execution.

Try before revealing the answer

Design a schema with decision, evidence_ids and reason. List two checks beyond JSON parsing.

Show the worked answer

Verify every evidence ID belongs to the authorized retrieval set and that the decision agrees with deterministic policy constraints. Bound reason length and reject missing evidence for decisive answers.

Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.

Your explanation and revision notes

Loading local notes…

Read the primary reference

JSON Schema reference

The explanation and exercises are original teaching material. The linked source provides background; examples and assumed numbers here are not claims about a particular company.