fix: route ollama models through ollama_chat so tool calling works - #562
Conversation
The bare ollama/ prefix routes through LiteLLM's /api/generate endpoint, which has no function-calling support. With litellm.drop_params=True the agent's tools are dropped silently, so the model never sees them, replies with plain text, and the scan ends after one toolless turn. ollama_chat/ uses /api/chat, where tool-capable models can drive the agent loop. Fixes usestrix#526
Greptile SummaryThis PR fixes Ollama models failing to call tools by routing the
Confidence Score: 5/5Safe to merge — the change is a single-line model-name rewrite with a clear guard, no new dependencies, and no side effects on other routing paths. The fix is narrowly scoped: it only activates when No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "fix: route ollama models through ollama_..." | Re-trigger Greptile |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes #526
Problem
Ollama models do nothing: the agent makes one LLM call, gets a plain message, and ends the scan after one turn with no tool calls (the
NextStepFinalOutputin the issue log).Root cause is the
ollama/prefix. It routes through LiteLLM'sollamaprovider, which uses Ollama's/api/generateendpoint, and that endpoint has no function-calling support. Since Strix setslitellm.drop_params=True, the agent's tools are dropped silently instead of erroring, so the model never sees them and replies with prose. LiteLLM'sollama_chat/route uses/api/chat, which supports tools.Fix
Route the
ollamaprefix throughollama_chatinStrixProvider._resolve_prefixed_model. The tool-capable models the docs recommend (qwen3-vl, deepseek-v3.1, devstral-2) can then drive the agent loop.ollama_chat/and other prefixes are unchanged.Note
Models that don't support Ollama tool calling at all (e.g.
gemma4:12bfrom the issue) still won't drive the agent, that's a model limitation not routing. This makes the documented tool-capable models work.Verified
ruff check+ruff format --checkpassmypyclean (no issues),banditclean (0 issues)pyrightadds no new errors (this file already has 20 pre-existing onmainfrom untyped litellm)ollama_chat/is LiteLLM's documented route for chat + tool calling