Page 8 of 8~96 min topic

Structured outputs & JSON mode

Mastery: connect the pieces

You can explain, measure, and bound structured outputs for the invoice extractor API without borrowing another topic’s speech.

~12 min this pageMastery check

1Learn the idea

Read

Checklist

  1. Idea — Structured output constrains responses to a machine-readable contract such as JSON Schema. It fixes shape; it does not guarantee true or authorized values.…
  2. Mechanism — Provide schema/grammar, decode under constraints or validate-and-retry, then run business rules on the parsed object.…
  3. Controls — schema strictness, required fields, enums, retries, validators, additionalProperties
  4. Tradeoff — Strict schemas simplify downstream code but can make partial answers harder. Large nested schemas consume tokens and reduce model reliability. Retries can repai…
  5. Failures — Parse≠truth; Retry double charge
  6. Metrics — parse rate, schema-valid rate, business-rule pass, retry count, p95 latency
  7. Ship rule — Require integer cents + ISO dates + line-sum check; report parse and schema-valid separately on 1,000 docs.

Neighboring layers (retrieval, serving, policy, human review) still own what structured outputs cannot on the invoice extractor API. Do not ask this chapter’s dial to replace permissions or source truth.

Read

Make it operational

Mastery is transfer: take structured outputs into a second scenario that is not the invoice extractor API and rebuild the checklist without copying sentences. If you can only recite this chapter’s examples for structured outputs, you have memorized a story, not a model.

Also pin one numeric memory from this structured outputs chapter: if 970 of 1,000 outputs parse and 930 pass the schema, parse rate = 97% but end-to-end schema-valid rate = 93%; report both That number is not decoration; it is a template for how claims about structured outputs on the invoice extractor API should look in design docs. Scoped specifically to structured outputs / invoice extractor API / mastery-connect.

Read

Common mix-ups

People confuse structured outputs with neighboring buzzwords when debugging the invoice extractor API. Before changing prompts, ask whether the broken stage was evidence gathering, the structured outputs judgment itself, validation, or the product action. Fixing the wrong stage creates folklore (“we tried structured outputs and it failed”) that blocks the next team on the invoice extractor API. Scoped specifically to structured outputs / invoice extractor API / mastery-connect.

Read

Rehearsal (structured-outputs/mastery-connect)

Write a five-line artifact for this page: goal, inputs, check, owner, stop rule. Invent one fluent failure that the check would catch. Keep details specific to structured outputs rather than generic AI advice.

Read

Rehearsal (structured-outputs/mastery-connect)

Write a five-line artifact for this page: goal, inputs, check, owner, stop rule. Invent one fluent failure that the check would catch. Keep details specific to structured outputs rather than generic AI advice.

Go deeper

Before you start

Why this matters

Teach structured outputs in ninety seconds using the analogy (asking someone to fill a tax form rather than write an essay—the boxes constrain shape, not honesty), then replace the analogy with the real artifact names from the structured outputs mechanism page for the invoice extractor API.

In the wild

See how this idea shows up as a product and a company — then come back to the lesson. Skills transfer across vendors.

Check your understanding

Page assessment

Answer from memory. Completion is saved from this evidence, not from opening the next page.

1. What is one idea from this page you would apply, and what evidence would you check?

All responses are required.