feat: enable agent mode support for LM Studio models#10327
feat: enable agent mode support for LM Studio models#10327veeceey wants to merge 7 commits intocontinuedev:mainfrom
Conversation
Add LM Studio to PROVIDER_TOOL_SUPPORT by referencing Ollama's tool support implementation. LM Studio uses an OpenAI-compatible API similar to Ollama, so the same model compatibility logic applies. Fixes continuedev#5182
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="core/llm/toolSupport.ts">
<violation number="1" location="core/llm/toolSupport.ts:192">
P2: LM Studio uses hyphenated model identifiers (e.g., “Meta-Llama-3.1-8B-Instruct-GGUF”), but lmstudio delegates to Ollama’s heuristic which only checks substrings like “llama3.1” without hyphens. This will fail to detect tool support for common LM Studio model IDs (e.g., “llama-3.1-8b-instruct”), disabling agent mode even when tool calling is supported.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
I have read the CLA Document and I hereby sign the CLA |
LM Studio uses hyphenated model identifiers (e.g., "Meta-Llama-3.1-8B-Instruct-GGUF"), but the Ollama heuristic checks for non-hyphenated patterns like "llama3.1". This fix normalizes hyphenated model names by removing hyphens before delegating to Ollama's tool support logic, enabling agent mode for LM Studio models with hyphenated IDs. Added comprehensive tests for hyphenated model names including: - Meta-Llama-3.1-8B-Instruct-GGUF - Qwen2-7B-Instruct - Mixtral-8x7B-Instruct-v0.1 - Case insensitivity checks - Negative tests for unsupported models like "Llama-Vision-Free" Addresses feedback from Cubic AI bot review.
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="core/llm/toolSupport.ts">
<violation number="1" location="core/llm/toolSupport.ts:195">
P2: LM Studio’s hyphen-stripping normalization bypasses Ollama’s explicit exclusion for "mistral-openorca" (and other hyphen-sensitive exclusions), potentially marking unsupported models as tool-capable.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Improve the LM Studio tool support check to first verify exclusions on the original model ID before normalizing hyphens. This ensures that models like 'Mistral-Openorca-GGUF' are correctly excluded from tool support, while allowing hyphenated variants of supported models like 'Meta-Llama-3.1-8B-Instruct-GGUF'. The previous implementation would remove all hyphens before checking Ollama's heuristics, which could bypass exclusion rules for models like mistral-openorca.
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="core/llm/toolSupport.ts">
<violation number="1" location="core/llm/toolSupport.ts:196">
P2: LM Studio hyphenated model IDs are rejected before normalization due to the new early return on the raw Ollama check, contradicting existing tests expecting these IDs to be supported.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
The LM Studio handler was checking Ollama's full heuristic (which doesn't match hyphenated names) before trying the normalized version. This caused hyphenated LM Studio model IDs like "Meta-Llama-3.1-8B-Instruct-GGUF" to be incorrectly rejected. Now checks exclusions separately first, then falls back to the normalized (hyphen-removed) name for Ollama's support check.
Check exclusions on both raw and normalized (hyphen-stripped) model names before delegating to Ollama's heuristic. This ensures: 1. Hyphenated exclusions like "mistral-openorca" are caught on the raw name 2. Non-hyphenated variants like "MistralOpenOrca" are caught on the normalized name before the "mistral" support pattern matches 3. Hyphenated LM Studio IDs like "Meta-Llama-3.1-8B" still get detected via the normalized fallback to Ollama
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="core/llm/toolSupport.ts">
<violation number="1" location="core/llm/toolSupport.ts:206">
P2: LM Studio exclusion check no longer tests normalized model IDs, so hyphenated models like `mistral-lite` bypass the `mistrallite` exclusion and get marked tool-capable via the Ollama heuristic.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…tudio The exclusion check only tested the lowercased model name, missing cases where hyphenated names like "Mistral-Lite" normalize to "mistrallite" which should match the exclusion pattern.
…M Studio Extract isExcluded helper that tests a given name against each exclusion pattern in both its original and hyphen-stripped forms. Call it with both the raw lowercased model name and the normalized (hyphen-stripped) form so that e.g. "mistral-lite" is correctly caught by the "mistrallite" exclusion regardless of which path is evaluated.
Summary
Adds LM Studio to
PROVIDER_TOOL_SUPPORTto enable Agent mode for LM Studio models.Changes
lmstudioentry toPROVIDER_TOOL_SUPPORTthat references Ollama's tool support implementationtoolSupport.test.tsRationale
LM Studio uses an OpenAI-compatible API similar to Ollama and serves similar models with tool calling support. By referencing Ollama's implementation, LM Studio models can now use Agent mode with the same model compatibility logic.
Test Plan
Added unit tests that verify:
truefalsefalseThe implementation follows the same pattern as other providers in the codebase and reuses the battle-tested Ollama logic.
Closes #5182
Continue Tasks:▶️ 2 queued — View all
Summary by cubic
Enables Agent mode for LM Studio models by delegating tool support to Ollama, with safe handling for hyphenated model IDs. Exclusion checks now block mistral-openorca and mistral-lite in both hyphenated and non-hyphenated forms. Addresses #5182.
Written for commit cfff26f. Summary will update on new commits.