← Return to Report
📚 All Topic Sources
↗ Open Official Primary Source
⬇ Download Reference Note (.txt)
OpenAI API Guide — Structured Outputs, Context-Free Grammar Decoding & Refusal/Truncation Edge Cases (S6 / R11)
Primary Reference Extract & Verification Note — Consulted 15 November 2026 Official URL: https://developers.openai.com/api/docs/guides/structured-outputs 1. Grammar-Constrained Schema Conformance on Completed Responses: Enabling Structured Outputs (strict: true) compiles a supplied JSON Schema into a context-free grammar mask applied during token decoding, ensuring that completed, non-refused responses conform syntactically to required keys, enum values, and data types. 2. Mandatory Production Handling for Refusals, Truncation, and Semantic Errors: Schema conformance is not unconditional across all API outcomes: safety refusals return an explicit refusal message outside the target schema, responses hitting max_output_tokens stop incomplete before closing JSON brackets, and syntactically valid JSON fields can still contain hallucinated numbers or incorrect engineering values unless checked against primary sources.