Schemas that refuse to lie, in brief
Lesson 1 planted the track’s spine: an instruction is a request, code is a guarantee. Lesson 3 is the first place that principle touches the model’s output directly. A JSON Schema attached to a tool definition enforces output shape at the code level, and the Claude platform can make that enforcement absolute, down to the individual token. The Building with Claude track taught the tool-calling mechanics; this lesson presumes them and teaches the design judgment on top.
The capability: after this lesson, you can build an extraction pipeline whose output shape is guaranteed on every run, and whose schema is designed so that missing information comes back as an honest null instead of a plausible fabrication.
What the lesson covers. The guarantee ladder first: the tool choice modes that matter for extraction (auto, any, a forced specific tool) and what each actually promises, plus strict mode, which constrains the model’s token sampling so output cannot break the schema. Then the twist the lesson is named for: enforcement pointed the wrong way enforces lying. A required field on a document that lacks the information pressures the model to invent a value, so honest schemas make absence representable, with required-plus-nullable fields beating optional ones, and every enum carrying an escape hatch (a catch-all value plus a detail string). The lesson closes on the boundary of the guarantee: schema validity is syntactic, values can still be wrong, so semantic validation stays in code, and a retry loop that feeds the specific error back helps only when the answer actually exists in the source.
Why this order. Shape enforcement is the easy half and the docs cover it; the design judgment about honesty is where pipelines quietly fail, so the lesson spends its weight there. Worked through a supplier-invoice extraction example end to end.