Skip to content

fix(ai-ollama): accept tool_calls done reason - #17972

Open
swaraj017 wants to merge 1 commit into
eclipse-theia:masterfrom
swaraj017:fix/ollama-tool-calls-streaming
Open

fix(ai-ollama): accept tool_calls done reason#17972
swaraj017 wants to merge 1 commit into
eclipse-theia:masterfrom
swaraj017:fix/ollama-tool-calls-streaming

Conversation

@swaraj017

Copy link
Copy Markdown

What it does

Fixes the Ollama integration treating done_reason: "tool_calls" as an unexpected response termination.

Ollama can use tool_calls as a valid done_reason when a model finishes a response by requesting tool execution. Previously, Theia only accepted stop, which caused the Ollama language model to throw:

Ollama stopped unexpectedly. Reason: tool_calls

This PR updates both done_reason checks in packages/ai-ollama/src/node/ollama-language-model.ts to accept both stop and tool_calls, while continuing to reject other unexpected reasons.

How to test

  • Verified the change with git diff --check.
  • Verified that the final diff contains only the intended changes in packages/ai-ollama/src/node/ollama-language-model.ts.
  • Attempted to run 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 requested yarn install.

The existing packages/ai-ollama/src/node/ollama-language-model.spec.ts was left unchanged.

Follow-ups

None.

Breaking changes

Attribution

None.

Review checklist

Reminder for reviewers

@github-project-automation github-project-automation Bot moved this to Waiting on reviewers in PR Backlog Aug 30, 2026
@swaraj017
swaraj017 force-pushed the fix/ollama-tool-calls-streaming branch from 412b85a to 675adcc Compare August 30, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting on reviewers

Development

Successfully merging this pull request may close these issues.

1 participant