fix(ollama): add Gemma to tool support heuristic for Ollama and LM Studio#12158
Open
octo-patch wants to merge 1 commit intocontinuedev:mainfrom
Open
fix(ollama): add Gemma to tool support heuristic for Ollama and LM Studio#12158octo-patch wants to merge 1 commit intocontinuedev:mainfrom
octo-patch wants to merge 1 commit intocontinuedev:mainfrom
Conversation
…udio (fixes continuedev#12131) Gemma 3/4 support function calling per Google's documentation: https://ai.google.dev/gemma/docs/capabilities/function-calling The Ollama provider's static heuristic was missing "gemma", preventing Continue from offering tools to Gemma models served via Ollama or LM Studio. Without this, modelSupportsNativeTools() returns false and tools are never sent, even when the model's Ollama template includes .Tools support. This fix adds "gemma" to the supported model list, allowing the secondary /api/show template check (added in continuedev#11670) to make the final determination for Ollama, and enabling tool use for Gemma models in LM Studio as well.
Contributor
|
I have read the CLA Document and I hereby sign the CLA octo-patch seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
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.
Fixes #12131
Problem
Gemma 3/4 models running via Ollama or LM Studio are not recognized as supporting tool calling, so Continue never offers tools to them. This affects users who run Gemma models locally through either provider.
The root cause: the Ollama provider's static model heuristic in
toolSupport.tsis missing"gemma". The LM Studio provider delegates to Ollama's heuristic, so both are affected.Without this entry,
modelSupportsNativeTools()returnsfalsefor any Gemma model, and tools are never offered or sent — even if the model's Ollama template includes.Toolssupport (the secondary check added in #11670).Note: the
openaiprovider already lists Gemma as supported, and the existing test suite confirms this (lines 109-113 intoolSupport.test.ts).Solution
Add
"gemma"to the Ollama supported-models list with a reference to Google's function calling documentation:https://ai.google.dev/gemma/docs/capabilities/function-calling
For Ollama, the
/api/showtemplate check (from #11670) will still act as a secondary gate — if the specific Gemma model's template doesn't include.Tools, tools will be skipped. This PR only removes the pre-filter that was blocking Gemma entirely.Testing
Added test cases for Gemma models in both
ollamaandlmstudioprovider sections. All 83 tests pass.Summary by cubic
Enable native tool calling for Gemma 3/4 models when run via
ollamaorlmstudio. Adds "gemma" to the Ollama tool-support heuristic so Continue offers tools; LM Studio inherits this, and the existing/api/showtemplate check still gates per-model support.Written for commit 990aa9e. Summary will update on new commits.