Practical guide · Tutorials
A valid JSON response can still contain the wrong answer
A practical test for AI-generated JSON that has to match a source document.

What the schema checks
Structured Outputs can constrain a supported model response to a supplied schema. That helps downstream code distinguish a missing field from a correctly shaped result. An amount formatted as a number can still be the wrong amount, and an accepted currency code can still be wrong for the source document.
Check the evidence separately
Keep the input record ID and require model outputs to point to the source field or excerpt. Validate currency and units, check the amount against a business range, and route discrepancies for review. Record both the schema version and validation results so you can replay failures later.
Make uncertainty explicit
Design a state for missing or conflicting evidence. Test that refusals, incomplete responses and failed checks reach that state. Use a small set of fixtures where the same schema covers both a correct extraction and a plausible mistake, such as confusing a table subtotal with the total.

