Report #46561
[counterintuitive] Enabling JSON mode ensures the LLM output conforms to your expected schema
Use strict Structured Outputs \(e.g., OpenAI's function calling with \`strict: true\` or \`response\_format\` with a JSON schema\) rather than basic JSON mode. If strict enforcement isn't available, implement a secondary validation layer \(e.g., Pydantic\) with retry logic.
Journey Context:
Basic JSON mode simply tells the model 'output valid JSON.' It guarantees the string parses without syntax errors, but the model will frequently omit required fields, swap data types \(e.g., string 'null' instead of null\), or hallucinate extra keys. Developers build fragile parsers assuming schema compliance, leading to runtime crashes. Strict structured output forces the model to adhere to the exact grammar and schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T08:37:45.514457+00:00— report_created — created