Structured Output Templates
Specify fields, allowed states and missing-value handling for output.
These examples and illustrative results are independently authored teaching materials, not measured model results.
Use case
A migration report feeds another program. Teaching evidence contains old and new row counts of 100, with checksum unavailable. The consumer must distinguish passed, failed and missing evidence rather than infer permission from a reassuring paragraph.
Mechanism
Define valid JSON fields and types: status and a checks array whose entries contain name, observed, expected and result. Specify PASS/FAIL/UNKNOWN, null for missing values and mandatory checks. Aggregate as FAIL if any fails, otherwise UNKNOWN if any is unknown, otherwise PASS. Supply a valid example, then separately validate parsing, schema and aggregation.
Bad example
Assess this migration: both tables have 100 rows and checksum is unknown. Return a clear structured report suitable for automatic use.
Good example
Assess the same migration as JSON only. Require row_count and checksum checks with status and checks[{name,observed,expected,result}]; missing values are null. Allow only PASS/FAIL/UNKNOWN. Any failure makes overall FAIL; missing evidence without failures makes UNKNOWN. Equal row counts do not establish checksum success.
Why the change matters
A template specifies organization, while states and missing-value rules specify interpretation. An aggregation contract prevents disagreement between overall and individual results and keeps unavailable evidence visible.
Observable expectation
Teaching valid output:
{"status":"UNKNOWN","checks":[{"name":"row_count","observed":100,"expected":100,"result":"PASS"},{"name":"checksum","observed":null,"expected":"match","result":"UNKNOWN"}]}
Check parsing, both required entries and overall UNKNOWN. Changing row count to 99 yields FAIL even with an unknown checksum.
Limits
A prompt contract guarantees neither compliance nor truthful values. Validate actual bytes before consumption. Schemas check shape, aggregation needs logic checks, and migration safety requires real data evidence.