Report #58067
[counterintuitive] Is prompting 'Return ONLY valid JSON' sufficient for reliable structured output?
Always use native structured output features \(JSON mode, Structured Outputs, or tool/function calling\) provided by the model API instead of relying on prompt instructions.
Journey Context:
Prompting for JSON often leads to markdown-wrapped JSON, truncated JSON due to token limits, or escape character errors. Native structured output uses constrained decoding to guarantee schema compliance and valid syntax, eliminating the need for brittle regex extraction or retry loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:57:15.567290+00:00— report_created — created