fix(ollama): check model template for tool support via /api/show#11670
Open
fix(ollama): check model template for tool support via /api/show#11670
Conversation
18a22aa to
6d74c5b
Compare
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
6d74c5b to
4373b82
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/showmodel template for.Toolsvariable before sending tools (same pattern as existing.SuffixFIM check). Prevents 400 errors from Ollama when the model template doesn't support tools.:cloudtag) 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
qwen2.5-coder:1.5b-base) — no 400 error, tools silently skippedqwen2.5:7b) — tool calling works as beforeqwen3-coder:480b-cloud) — tools not sent