fix(ai-ollama): accept tool_calls done reason - #17972
Conversation
412b85a to
675adcc
Compare
|
Thanks for the contribution! The change itself looks correct to me, but before this can be approved though, please have a look at those two points here: First, please test the change yourself and describe it in "How to test". Right now that section only lists an inspection of the diff, which tells us nothing about behaviour, and the review requirements in doc/pull-requests.md ask authors to verify their changes before requesting a review. Second, please add a regression test. No live server is needed: One final note on tooling: this repo uses |

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