Skip to content

fix(floxi): keep streamed tool call fragments separated by index - #1519

Open
pcbeingused33 wants to merge 2 commits into
SciSharp:masterfrom
pcbeingused33:fix/floxi-stream-toolcall-index
Open

pcbeingused33 wants to merge 2 commits into
SciSharp:masterfrom
pcbeingused33:fix/floxi-stream-toolcall-index

Conversation

@pcbeingused33

Copy link
Copy Markdown
Contributor

When a FloxiAI backend streams parallel tool calls, the arguments of a second call can be appended to the first one. CollectToolCallDelta reads tool_calls[0] of every chunk and never looks at index, so a fragment for index 1 lands in the same buffer as index 0. With deltas for indexes 0, 1, 0, the resulting function arguments are no longer valid JSON.

The provider still follows a single call, as before. It now remembers the index of the first call it sees and only collects fragments carrying that index, including when one chunk holds several entries. An entry without index falls back to its position in the array, so when a backend omits it only the first entry of each chunk is collected, as before.

The tests feed synthetic stream chunks to the aggregator (they were not run against a live FloxiAI backend). The two interleaving tests fail on master and pass with this change; the third covers a chunk without index and passes on both. BotSharp.LLM.Tests gains a project reference to the FloxiAI plugin for this.

dotnet test tests/BotSharp.LLM.Tests/BotSharp.LLM.Tests.csproj --filter FullyQualifiedName~FloxiStreamToolCallTests

This change was prepared with assistance from an AI coding tool (Claude Code).

@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

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