fix(ai-ollama): accept tool_calls done reason - #17972
Open
swaraj017 wants to merge 1 commit into
Open
Conversation
swaraj017
force-pushed
the
fix/ollama-tool-calls-streaming
branch
from
August 30, 2026 08:36
412b85a to
675adcc
Compare
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.
What it does
Fixes the Ollama integration treating
done_reason: "tool_calls"as an unexpected response termination.Ollama can use
tool_callsas a validdone_reasonwhen a model finishes a response by requesting tool execution. Previously, Theia only acceptedstop, which caused the Ollama language model to throw:Ollama stopped unexpectedly. Reason: tool_callsThis PR updates both
done_reasonchecks inpackages/ai-ollama/src/node/ollama-language-model.tsto accept bothstopandtool_calls, while continuing to reject other unexpected reasons.How to test
git diff --check.packages/ai-ollama/src/node/ollama-language-model.ts.yarn test:packages ai-ollama, but the test command could not be executed because the local Yarn/Corepack setup reported that the workspace package was missing from the lockfile and requestedyarn install.The existing
packages/ai-ollama/src/node/ollama-language-model.spec.tswas left unchanged.Follow-ups
None.
Breaking changes
Attribution
None.
Review checklist
nlsservice (for details, please see the [Internationalization/Localization section](https://github.com/eclipse-theia/theia/blob/master/doc/coding-guidelines.md#internationalizationlocalization) in the Coding Guidelines)Reminder for reviewers