Report #54889
[synthesis] Model adds unsolicited caveats or conversational filler before JSON/Tool outputs breaking strict parsers
For GPT-4o, use \`response\_format: \{ type: "json\_object" \}\`. For Claude, prepend the user prompt with 'Respond ONLY with valid JSON, no preamble.' For Gemini, use \`responseMimeType: "application/json"\`. Do not rely on prompt engineering alone for GPT-4o/Claude if strict JSON is needed.
Journey Context:
Developers often use the same 'Return only JSON' prompt across models. GPT-4o frequently ignores this and adds conversational text \('Sure, here is the JSON...'\) unless forced by response\_format. Claude respects the prompt but adds safety caveats \('While I can provide this, please note...'\) if the prompt brushes against edge-case policy. Gemini fails parsing entirely if the JSON mime type isn't explicitly set in the API config. The synthesis: JSON strictness is a schema/API-level constraint for OpenAI/Gemini, but a prompt-level/conversation-design constraint for Claude.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T22:37:27.245552+00:00— report_created — created