Repository navigation
Conversation
Mistral and possibly other OpenAI-compatible providers repeat "name": "" in every tool call delta after the first one. The empty string overwrote the name received earlier, so the assembled tool call had no function name. Fixes nextcloud#461 Signed-off-by: PocketLab <115039460+Guezli@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #461
Some OpenAI-compatible providers (seen with Mistral,
https://api.eu.mistral.ai/v1) send the function name only in the first streamed tool call delta and repeat it as"name": ""in every later delta.StreamingService::mergeToolCalls()assigned the name from every delta, so the empty string overwrote the real one and the Context Agent received tool calls without a name.This change ignores an empty name in a delta. A non-empty name still overwrites as before, so behaviour with OpenAI (which omits
namein later deltas) is unchanged.Tests: added
testEmptyToolNameInLaterDeltaDoesNotOverwriteTheNametotests/unit/Service/StreamingServiceTest.php. It fails without the fix ('name' => '') and passes with it. Also verified on a Nextcloud 35.0.2 instance with Context Agent 2.11.0: the agent then recognisesschedule_eventwith the correct arguments.🤖 Generated with Claude Code