Repository navigation
fix(azure-openai): keep parallel streamed tool calls apart - #1522
Open
pcbeingused33 wants to merge 2 commits into
Open
pcbeingused33 wants to merge 2 commits into
pcbeingused33 wants to merge 2 commits into
Conversation
The streaming path joined the argument fragments of every tool call into one string and reported only the first name and id, so a reply asking for two tools produced malformed arguments. Rebuild the calls per tool call id, as the OpenAI plugin does, and report them all in ToolCalls. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Contributor
Author
|
The follow-up fixes interleaved tool-call fragments by using the SDK's index in both Azure OpenAI and OpenAI chat streaming. Regression coverage includes interleaving and an ID that arrives after part of the arguments. This comment was drafted with Claude Code. |
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.
Azure OpenAI streaming now returns all requested tool calls with their individual arguments. The previous reconstruction treated each fragment without an ID as part of the most recently opened call. When the service interleaved fragments, it attached arguments to the wrong call. The OpenAI chat provider used the same reconstruction.
Both providers now group updates by the SDK's tool call index and append arguments in arrival order within each call. They preserve the first nonempty ID and function name for each index and emit calls in index order. The first call still supplies the response's single-call fields.
The provider reconstruction tests cover the index sequence
0, 1, 0, 1with IDs only on the opening fragments, plus an Azure stream where the ID and name arrive after some arguments. These cases produced three failures against the previous PR head. All 12 reconstruction tests pass with the fix. A local SSE simulation also exercised Azure's public streaming method and verified both tool calls and the first call's single-call fields.dotnet test tests/BotSharp.Core.UnitTests/BotSharp.Core.UnitTests.csproj --filter FullyQualifiedName~StreamingToolCallReconstructionTestsThis change was prepared with assistance from an AI coding tool.