Report #69524
[synthesis] Models return conversational filler or markdown fences when asked for JSON, breaking parsers
Use \`response\_format: \{ type: "json\_object" \}\` for GPT-4o. For Claude and Gemini, explicitly mandate "Output ONLY valid JSON, no markdown fences or conversational text" and implement a post-processing regex to strip \`\`\`json and \`\`\` wrappers.
Journey Context:
GPT-4o reliably outputs pure JSON via API flags but escapes newlines aggressively. Claude 3.5 Sonnet, even with explicit instructions, frequently wraps JSON in markdown code blocks. Gemini Pro often prepends conversational filler like "Here is the JSON:". Building an agentic pipeline assuming pure JSON from a prompt will fail on Claude/Gemini. Stripping wrappers via regex is mandatory because prompt engineering alone cannot guarantee structural compliance across non-GPT models.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:10:57.270075+00:00— report_created — created