Skip to content

fix(ollama): check model template for tool support via /api/show#11670

Open
RomneyDa wants to merge 1 commit intomainfrom
ollama-registry-tools
Open

fix(ollama): check model template for tool support via /api/show#11670
RomneyDa wants to merge 1 commit intomainfrom
ollama-registry-tools

Conversation

@RomneyDa
Copy link
Collaborator

@RomneyDa RomneyDa commented Mar 21, 2026

Summary

  • Check /api/show model template for .Tools variable before sending tools (same pattern as existing .Suffix FIM check). Prevents 400 errors from Ollama when the model template doesn't support tools.
  • Exclude Ollama cloud models (:cloud tag) in the heuristic, since cloud tool calling is unreliable.

Fixes #9639 #9646 #9875 #10304 #10461 #10539 #10561 #10593 #10640 #10672 #10833 #10876 #11308 #11382 #11402

Test plan

  • Ollama model without tool template (e.g. qwen2.5-coder:1.5b-base) — no 400 error, tools silently skipped
  • Ollama model with tool template (e.g. qwen2.5:7b) — tool calling works as before
  • Cloud model tag (e.g. qwen3-coder:480b-cloud) — tools not sent

@RomneyDa RomneyDa requested a review from a team as a code owner March 21, 2026 00:50
@RomneyDa RomneyDa requested review from Patrick-Erichsen and removed request for a team March 21, 2026 00:50
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 21, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@RomneyDa RomneyDa force-pushed the ollama-registry-tools branch 2 times, most recently from 18a22aa to 6d74c5b Compare March 21, 2026 01:09
Ollama models only support tool calling if their template includes
.Tools. The heuristic in toolSupport.ts was too broad, causing 400
errors for models whose templates lack tool support.

Two changes:
- Query /api/show template for .Tools (same pattern as existing .Suffix
  FIM check) and skip sending tools when the template says no
- Exclude Ollama cloud models (:cloud tag) in the heuristic, since
  cloud tool calling is unreliable

Fixes #9639 #9646 #9875 #10304 #10461 #10539 #10561 #10593 #10640
Fixes #10672 #10833 #10876 #11308 #11382 #11402
@RomneyDa RomneyDa force-pushed the ollama-registry-tools branch from 6d74c5b to 4373b82 Compare March 21, 2026 01:31
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Error: qwen2.5-coder-7b-instruct-q4_k_m- 400

1 participant