Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions core/llm/toolSupport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,51 @@ describe("PROVIDER_TOOL_SUPPORT", () => {
});
});

describe("lmstudio", () => {
const supportsFn = PROVIDER_TOOL_SUPPORT["lmstudio"];

it("should return true for supported models (same as ollama)", () => {
expect(supportsFn("llama3.1")).toBe(true);
expect(supportsFn("llama3.2-8b")).toBe(true);
expect(supportsFn("qwen2")).toBe(true);
expect(supportsFn("mixtral-8x7b")).toBe(true);
expect(supportsFn("mistral-7b")).toBe(true);
});

it("should return true for LM Studio hyphenated model IDs", () => {
// LM Studio uses hyphenated model identifiers like "Meta-Llama-3.1-8B-Instruct-GGUF"
expect(supportsFn("Meta-Llama-3.1-8B-Instruct-GGUF")).toBe(true);
expect(supportsFn("Meta-Llama-3.2-3B-Instruct")).toBe(true);
expect(supportsFn("Qwen2-7B-Instruct")).toBe(true);
expect(supportsFn("Mixtral-8x7B-Instruct-v0.1")).toBe(true);
expect(supportsFn("Mistral-7B-Instruct-v0.2")).toBe(true);
expect(supportsFn("llama-3.1-8b-instruct")).toBe(true);
});

it("should return false for explicitly unsupported models (same as ollama)", () => {
expect(supportsFn("vision")).toBe(false);
expect(supportsFn("math")).toBe(false);
expect(supportsFn("guard")).toBe(false);
});

it("should return false for hyphenated unsupported model names", () => {
expect(supportsFn("Llama-Vision-Free")).toBe(false);
expect(supportsFn("Math-Solver-7B")).toBe(false);
expect(supportsFn("Guard-Model")).toBe(false);
});

it("should handle case insensitivity (same as ollama)", () => {
expect(supportsFn("LLAMA3.1")).toBe(true);
expect(supportsFn("MIXTRAL-8x7b")).toBe(true);
expect(supportsFn("VISION")).toBe(false);
});

it("should handle case insensitivity with hyphenated names", () => {
expect(supportsFn("META-LLAMA-3.1-8B-INSTRUCT")).toBe(true);
expect(supportsFn("Qwen2-7B-Instruct-GGUF")).toBe(true);
});
});

describe("xAI", () => {
const supportsFn = PROVIDER_TOOL_SUPPORT["xAI"];

Expand Down Expand Up @@ -339,6 +384,7 @@ describe("PROVIDER_TOOL_SUPPORT", () => {
expect(PROVIDER_TOOL_SUPPORT["gemini"]("")).toBe(false);
expect(PROVIDER_TOOL_SUPPORT["bedrock"]("")).toBe(false);
expect(PROVIDER_TOOL_SUPPORT["ollama"]("")).toBe(false);
expect(PROVIDER_TOOL_SUPPORT["lmstudio"]("")).toBe(false);
expect(PROVIDER_TOOL_SUPPORT["novita"]("")).toBe(false);
});

Expand Down
11 changes: 11 additions & 0 deletions core/llm/toolSupport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,17 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =

return false;
},
lmstudio: (model) => {
// LM Studio uses hyphenated model IDs (e.g., "Meta-Llama-3.1-8B-Instruct-GGUF")
// Check Ollama's exclusions first (before normalizing hyphens)
const ollamaResult = PROVIDER_TOOL_SUPPORT["ollama"](model);
if (!ollamaResult) {
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Outdated
return false;
}
// If Ollama says yes, also check with normalized version to catch hyphenated variants
const normalized = model.toLowerCase().replace(/-/g, "");
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Outdated
return PROVIDER_TOOL_SUPPORT["ollama"](normalized);
},
sambanova: (model) => {
// https://docs.sambanova.ai/cloud/docs/capabilities/function-calling
if (
Expand Down
Loading