Skip to content

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

Merged
RomneyDa merged 1 commit intomainfrom
ollama-registry-tools
Mar 24, 2026
Merged

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

Conversation

@RomneyDa
Copy link
Copy Markdown
Contributor

@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
Copy Markdown
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
@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Mar 24, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 24, 2026
@RomneyDa RomneyDa merged commit ced1e3c into main Mar 24, 2026
104 of 110 checks passed
@RomneyDa RomneyDa deleted the ollama-registry-tools branch March 24, 2026 19:45
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Mar 24, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

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

2 participants