Skip to content

fix: route ollama models through ollama_chat so tool calling works - #562

Merged
0xallam merged 2 commits into
usestrix:mainfrom
RudraDudhat2509:fix/ollama-chat-tool-calling
Jun 16, 2026
Merged

fix: route ollama models through ollama_chat so tool calling works#562
0xallam merged 2 commits into
usestrix:mainfrom
RudraDudhat2509:fix/ollama-chat-tool-calling

Conversation

@RudraDudhat2509

Copy link
Copy Markdown
Contributor

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 NextStepFinalOutput in the issue log).

Root cause is the ollama/ prefix. It routes through LiteLLM's ollama provider, which uses Ollama's /api/generate endpoint, and that endpoint has no function-calling support. Since Strix sets litellm.drop_params=True, the agent's tools are dropped silently instead of erroring, so the model never sees them and replies with prose. LiteLLM's ollama_chat/ route uses /api/chat, which supports tools.

Fix

Route the ollama prefix through ollama_chat in StrixProvider._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:12b from 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 --check pass
  • mypy clean (no issues), bandit clean (0 issues)
  • pyright adds no new errors (this file already has 20 pre-existing on main from untyped litellm)
  • Could not run Ollama end-to-end here; ollama_chat/ is LiteLLM's documented route for chat + tool calling

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-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes Ollama models failing to call tools by routing the ollama/ prefix through LiteLLM's ollama_chat/ provider (which uses /api/chat with function-calling support) instead of the bare ollama/ provider (which hits /api/generate and has no tool support). The fix is a single well-guarded intercept in StrixProvider._resolve_prefixed_model.

  • ollama/<model> is now transparently rewritten to ollama_chat/<model> before being handed to LiteLLM, matching what users would need to type manually to get tools working today.
  • The stripped_model_name guard correctly avoids transforming a bare ollama/ (empty model) string.
  • No other routing paths are changed; existing users of ollama_chat/ or any other prefix are unaffected.

Confidence Score: 5/5

Safe 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 prefix == "ollama" and stripped_model_name is truthy, transparently swapping the LiteLLM provider prefix from ollama/ to ollama_chat/. All other prefixes go through the existing path unchanged. Users who were already writing ollama_chat/model get identical behavior. The guard against an empty stripped_model_name prevents the edge case of a bare ollama/ string being misrouted.

No files require special attention.

Important Files Changed

Filename Overview
strix/config/models.py Adds an ollama prefix intercept in _resolve_prefixed_model that rewrites ollama/<model> to ollama_chat/<model> before handing off to LiteLLM, enabling tool calling on the /api/chat endpoint.

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>
@0xallam
0xallam merged commit 11e5d1c into usestrix:main Jun 16, 2026
1 check passed
0xallam added a commit that referenced this pull request Jul 10, 2026
)

Co-authored-by: 0xallam <ahmed39652003@gmail.com>
0xallam added a commit that referenced this pull request Jul 13, 2026
)

Co-authored-by: 0xallam <ahmed39652003@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] The ollama model is not working and cannot be used.

2 participants