Report #86143
[counterintuitive] Writing massive JSON schemas in the system prompt to force structured output
Use the API's native structured output feature \(e.g., response\_format with json\_schema or tool calls\) to enforce the schema at the decoding level.
Journey Context:
Prompting a schema relies on the model's ability to perfectly adhere to constraints, which is probabilistic. Models frequently hallucinate extra keys, miss required fields, or mess up nesting. Native structured output features constrain the token generation to guarantee 100% schema adherence, eliminating the need for complex validation/retry loops on the client side.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T03:11:01.857147+00:00— report_created — created