Page 5 of 8~96 min topic

Structured outputs & JSON mode

Anticipate failure modes

Name failures by their mechanism in structured outputs on the invoice extractor API, not with a generic hallucination label.

~12 min this pageFailure modes

1Learn the idea

Read

Response design

For each severe structured outputs failure on the invoice extractor API, define stop condition, safe state, owner, and lasting prevention. Rollback only works if prior prompts, indexes, and models remain available. “Send to a human” needs queue capacity and context—not just a button name.

Run one tabletop on the invoice extractor API for structured outputs: inject a defect, verify detection, contain, recover, and keep the blameless trace.

Read

Make it operational

After the tabletop, store the injected structured outputs defect for the invoice extractor API as a regression fixture. If the same failure later reaches users silently, your detection story was aspirational. Detection without a fixture tends to rot for structured outputs.

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 / failure-modes.

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 / failure-modes.

Read

Rehearsal (structured-outputs/failure-modes)

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/failure-modes)

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/failure-modes)

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

Invent an incident for the invoice extractor API involving structured outputs. What earliest signal should fire before users complain?

Parse≠truth

Detect with valid JSON, wrong total. Respond by business-rule checks.

Retry double charge

Detect with side effect inside retry loop. Respond by pure generate then execute once.

Schema too huge

Detect with model collapses fields. Respond by split schemas; simplify.

Silent coercion

Detect with wrong types coerced. Respond by reject; don’t coerce quietly.

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.