Report #74465
[synthesis] Claude and Llama-3 prepend conversational text to JSON outputs breaking parsers
For Claude, use the json tool type or prepend 'Output ONLY valid JSON, no preamble.' For Llama-3, use regex stopping on the closing brace. For GPT-4o, use response\_format: \{ type: 'json\_object' \}.
Journey Context:
When asked for raw JSON, Claude 3.5 often prepends 'Here is the JSON:\\n\`\`\`json', and Llama-3 adds conversational filler. GPT-4o with response\_format strictly enforces JSON tokens from the first token. Claude's json tool type forces it into a programmatic mode, suppressing the conversational preamble. Using GPT-4o's strict JSON mode on Claude \(via prompting\) fails because Claude's RLHF heavily weights conversational helpfulness; you must use Anthropic's specific tool-use paradigm to force programmatic output.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:35:10.740412+00:00— report_created — created