fix: remove duplicate tool processing from 7 additional providers #4601
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
Following PR #4531 which fixed duplicate tool processing in OpenAI-compatible providers, this PR applies the same fix to 7 additional providers that had the same issue.
Problem
The
ToolCallAccumulatorwas processing tool calls in the streaming loop, but the code was also manually emittingtool_call_partialchunks, causing duplicate tool call events to be emitted. This resulted in tools being called twice.Solution
Remove
ToolCallAccumulatorusage from the streaming loops and rely solely on emitting rawtool_call_partialchunks, which are properly handled byNativeToolCallParser.Affected Providers
inception.tslm-studio.tsdeepinfra.tsxai.tslite-llm.tsqwen-code.tschutes.tsAlso removed unused
ToolCallAccumulatorimport frombase-openai-compatible-provider.ts.Changes Made
For each affected provider:
ToolCallAccumulatorimportToolCallAccumulatorinstantiation and usage in streaming looptool_call_partialchunks with proper commentRelated Issues
Fixes the same issue as #4529 but for additional providers not covered by PR #4531.
Testing
The fix follows the exact same pattern as PR #4531, which was already tested and merged. Each provider now emits tool call chunks in a consistent way that prevents duplication.