This repository was archived by the owner on Apr 16, 2026. It is now read-only.
fix: accumulate tool_calls from merged assistant messages for Gemini parallel tool calls - #1
Open
jschomay wants to merge 2 commits into
Open
fix: accumulate tool_calls from merged assistant messages for Gemini parallel tool calls#1jschomay wants to merge 2 commits into
jschomay wants to merge 2 commits into
Conversation
…parallel tool calls When the Responses API creates separate assistant messages for parallel tool calls, the Gemini transformation merges consecutive assistant messages but only kept the last message's tool_calls in last_message_with_tool_calls. This caused convert_to_gemini_tool_call_result to fail matching tool results from earlier assistant messages. Now accumulates tool_calls from ALL consecutive assistant messages so that all parallel tool results can find their corresponding tool call. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Is there any update on this? |
Author
|
@Andrerm124 Hi. I'm not sure what the status is, I haven't heard anything on my PR (BerriAI#22599) and I can't tell what needs to happen to get it merged. You can use this fork for now, but ideally they'll accept it. If you have any suggestions I'd appreciate them! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes BerriAI#22578
/v1/responses) with Gemini 3 modelslast_message_with_tool_callsonly kept the last assistant message's tool_calls — so earlier tool results couldn't find their matching tool calllast_message_with_tool_callsReproduction
Two parallel tool calls via Responses API streaming with Gemini 3 Pro. The Responses API transformation creates one assistant message per
function_callinput item. The Gemini format converter then fails matching the first tool result becauselast_message_with_tool_callsonly contains the second tool call.Test plan
test_convert_gemini_tool_call_result_parallel_tool_callsthat reproduces the exact bug scenariocall_aaavscall_bbb)🤖 Generated with Claude Code