Skip to content

fix(genai): preserve streaming tool call chunk index#1811

Open
Faizan imran (FaizanImran-blip) wants to merge 3 commits into
langchain-ai:mainfrom
FaizanImran-blip:fix-streaming-tool-call-index
Open

fix(genai): preserve streaming tool call chunk index#1811
Faizan imran (FaizanImran-blip) wants to merge 3 commits into
langchain-ai:mainfrom
FaizanImran-blip:fix-streaming-tool-call-index

Conversation

@FaizanImran-blip
Copy link
Copy Markdown

This PR fixes streaming tool call chunk indexing in _parse_response_candidate.

Previously, tool_call_chunk.index was always None because the value was retrieved from function_call.get("index"), even though the field was never populated.

The fix preserves chunk ordering by assigning the streaming part index directly using index=i.

Also added a focused unit test to validate that streaming tool_call_chunks retain the correct index during parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant