Asked about Asking for JSON versus guaranteeing it
Should every field be required?
An answer that works
No. Marking a field required when the source may not contain it forces the model to invent a value. Make genuinely optional fields optional and instruct the model to return null rather than guess.
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?How does constrained decoding actually work?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