Asked about Asking for JSON versus guaranteeing it
How does constrained decoding actually work?
An answer that works
At each generation step the sampler is restricted to tokens that keep the output valid against the schema. Invalid continuations are given zero probability, so malformed output is not reachable rather than merely discouraged.
Reading an answer is not being able to give one. The section that teaches this is Asking for JSON versus guaranteeing it, 2 hours of Structured output.
Learn this properlyAlso asked about Structured output
Your extraction pipeline returns malformed JSON 5 percent of the time. What are the likely causes?What does a response schema guarantee?Should every field be required?Why does field order in a schema matter?How would you reduce invented values in an extraction pipeline?Your classification enum has an 'other' option that is now used 30% of the time. What does that tell you?How would you measure the accuracy of an invoice extraction pipeline?When would you use a batch API?
All 10 questions on Structured output