Report #76139
[synthesis] Parsing logic breaks when models prepend conversational text before tool calls
Implement robust extraction logic that isolates the tool call JSON block from surrounding conversational text, specifically accounting for Claude's pre-text and Gemini's post-text.
Journey Context:
Developers often assume API responses containing tool calls are pure JSON or strictly structured. GPT-4o generally adheres to this, returning pure tool call objects. However, Claude 3.5 Sonnet frequently prepends conversational context before the tool call block. Gemini sometimes appends post-text. If your parser expects the entire response to be valid JSON, it will crash on Claude. This behavioral fingerprint requires parsing the tool call block independently of the text content.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:23:44.669768+00:00— report_created — created