Report #35413
[synthesis] Conversational pre-text pollutes JSON output or breaks tool call parsing
Never rely on model self-discipline for raw JSON output; always use native tool calling APIs. For GPT-4o, enforce \`tool\_choice\` to suppress conversational pre-text, and for Gemini, explicitly forbid markdown wrappers in the system prompt.
Journey Context:
When asked to output JSON or call a tool, GPT-4o often prepends conversational text \('Sure, here is the JSON...'\) if not strictly enforced. Claude 3.5 Sonnet is structurally disciplined, natively separating tool calls from text blocks. Gemini 1.5 Pro has a bias towards wrapping JSON in markdown code blocks \(\`\`\`json ... \`\`\`\) even when asked for raw JSON. Parsing regex or \`JSON.parse\` will fail on GPT-4o's pre-text and Gemini's markdown ticks. Native tool calling APIs bypass this by structurally separating text and tool calls, but if forced to use raw text JSON, GPT-4o requires explicit negative constraints and Gemini requires explicit format instructions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:54:54.849558+00:00— report_created — created