{{ message }}
Repository navigation
fix: keep parallel tool calls from separate Gemini stream chunks in GoogleGenAIChatGenerator - #4141
Open
pcbeingused333 wants to merge 1 commit into
Conversation
…oogleGenAIChatGenerator Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
pcbeingused333
requested review from
julian-risch
and removed request for
a team
October 21, 2026 13:08
Contributor
Contributor
Coverage report (google_genai)Click to see where and how coverage changedThis report was generated by python-coverage-comment-action |
This branch has not been deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Related Issues
Proposed Changes:
Gemini sends each parallel function call in its own stream chunk.
_convert_google_chunk_to_streaming_chunknumbered tool calls per chunk, so every call gotToolCallDelta(index=0), and_convert_streaming_chunks_to_chat_messagemerged them into one call with concatenated names and arguments. That call failed to parse and was dropped, so a streamed reply with parallel calls had no tool calls at all._convert_google_chunk_to_streaming_chunktakes a keyword-onlytool_call_index_offset(default0), and tool call indices start from it.tool_calls_seen.Calls that share a chunk are numbered as before.
How did you test it?
tests/test_chat_generator.py:test_run_streaming_parallel_tool_calls_in_separate_chunksandtest_run_async_streaming_parallel_tool_calls_in_separate_chunks. They use hand-built chunks shaped like a Gemini 3 stream (text, call, call, empty text withSTOP). Both fail onmain(no tool calls) and pass with the change.tests/test_chat_generator.py+tests/test_chat_generator_utils.py(-m "not integration"): 85 passed.ruff check/ruff format --checkclean.Notes for the reviewer
Function call ids exist on Gemini 3 but not on older models, so the fix keys on a running index rather than on the id.
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.This PR was made with Claude Code (Anthropic); the unit tests above were run on main and on this branch. No live Gemini calls were made for this change.
🤖 Generated with Claude Code