Report #53568
[synthesis] Model adds markdown wrappers around JSON despite strict system prompt
Use Claude for raw JSON output compliance; for GPT-4o, add 'DO NOT use markdown code blocks, return raw JSON only' and parse out \`\`\`json as a fallback; for Gemini, strip conversational preamble before parsing.
Journey Context:
When building agentic pipelines, parsing failures due to markdown wrappers are common. GPT-4o is heavily RLHF'd to format code nicely, which overrides 'raw JSON' instructions. Claude 3.5 Sonnet is better at following raw format instructions. Gemini often adds conversational text before the JSON. Assuming a universal strict-JSON prompt works across models leads to broken parsers; the parsing strategy must be model-specific: regex stripping for GPT-4o/Gemini, strict schema validation for Claude.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:24:41.823408+00:00— report_created — created