Structured Output
structured-output
Practice Problems
Validate a Review Summary
Check a model's JSON review summary against a small contract and return the accepted value, or one error code per failing field followed by the sorted unknown keys.
Validate Ticket Output
Validate a model's JSON reply for a support-ticket contract: return the accepted ticket, or the first failing layer (parse, schema, or source).
AI Engineering
Write an extraction prompt with examples
Rewrite a vague request into a testable extraction prompt with category rules, a missing-data policy, consistent examples, and a JSON output contract, then explain why parseable JSON can still be wrong.
Validate a model's JSON review summary
Write a pure function that accepts a model's JSON review summary or returns every contract violation as a stable error code, predict its result for eight replies, and say what a valid summary still cannot prove.
Validate JSON output and recover from failures
Implement a dependency-free validator for a ticket contract, classify each fixture failure by layer, and design a two-attempt recovery that never commits invalid output.
Design a versioned output contract and migration
Upgrade a ticket classifier to a versioned contract with multiple IDs, evidence, and review states, keep two v1-only consumers working, and decide from evaluation data whether a candidate prompt should ship.
