Changesets · Branches · Tags · Compare
| Changeset | 419651c68e24068f9f1f500d6e5138bf3d69f8b3e88e3c7353aab2017b14a4dc |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-05-25 21:45 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-05-25 21:45 -07:00 |
| Parents | b0349aaa027a, 75b17df40f78 |
16 files changed
modified binary/test/binary.test.ts +2 −0
| @@ -226,6 +226,7 @@ | ||
| 226 | 226 | title: "Test Model", |
| 227 | 227 | provider: "openai", |
| 228 | 228 | model: "gpt-3.5-turbo", |
| 229 | + underlyingProviderName: "openai", | |
| 229 | 230 | }; |
| 230 | 231 | await messenger.request("config/addModel", { |
| 231 | 232 | model, |
| @@ -252,6 +253,7 @@ | ||
| 252 | 253 | title: "Test Model", |
| 253 | 254 | provider: "mock", |
| 254 | 255 | model: "gpt-3.5-turbo", |
| 256 | + underlyingProviderName: "mock", | |
| 255 | 257 | }; |
| 256 | 258 | await messenger.request("config/addModel", { |
| 257 | 259 | model, |
modified core/autocomplete/CompletionProvider.ts +1 −1
| @@ -244,7 +244,7 @@ | ||
| 244 | 244 | prefix, |
| 245 | 245 | suffix, |
| 246 | 246 | prompt, |
| 247 | - modelProvider: llm.providerName, | |
| 247 | + modelProvider: llm.underlyingProviderName, | |
| 248 | 248 | modelName: llm.model, |
| 249 | 249 | completionOptions, |
| 250 | 250 | cacheHit, |
modified core/config/load.ts +1 −0
| @@ -627,6 +627,7 @@ | ||
| 627 | 627 | function llmToSerializedModelDescription(llm: ILLM): ModelDescription { |
| 628 | 628 | return { |
| 629 | 629 | provider: llm.providerName, |
| 630 | + underlyingProviderName: llm.underlyingProviderName, | |
| 630 | 631 | model: llm.model, |
| 631 | 632 | title: llm.title ?? llm.model, |
| 632 | 633 | apiKey: llm.apiKey, |
modified core/index.d.ts +3 −0
| @@ -93,6 +93,7 @@ | ||
| 93 | 93 | extends Omit<LLMOptions, RequiredLLMOptions>, |
| 94 | 94 | Required<Pick<LLMOptions, RequiredLLMOptions>> { |
| 95 | 95 | get providerName(): string; |
| 96 | + get underlyingProviderName(): string; | |
| 96 | 97 | |
| 97 | 98 | complete( |
| 98 | 99 | prompt: string, |
| @@ -1035,6 +1036,7 @@ | ||
| 1035 | 1036 | export interface ModelDescription { |
| 1036 | 1037 | title: string; |
| 1037 | 1038 | provider: string; |
| 1039 | + underlyingProviderName: string; | |
| 1038 | 1040 | model: string; |
| 1039 | 1041 | apiKey?: string; |
| 1040 | 1042 | |
| @@ -1333,6 +1335,7 @@ | ||
| 1333 | 1335 | export interface JSONModelDescription { |
| 1334 | 1336 | title: string; |
| 1335 | 1337 | provider: string; |
| 1338 | + underlyingProviderName: string; | |
| 1336 | 1339 | model: string; |
| 1337 | 1340 | apiKey?: string; |
| 1338 | 1341 | apiBase?: string; |
modified core/llm/index.ts +9 −1
| @@ -88,6 +88,14 @@ | ||
| 88 | 88 | return (this.constructor as typeof BaseLLM).providerName; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | + /** | |
| 92 | + * This exists because for the continue-proxy, sometimes we want to get the value of the underlying provider that is used on the server | |
| 93 | + * For example, the underlying provider should always be sent with dev data | |
| 94 | + */ | |
| 95 | + get underlyingProviderName(): string { | |
| 96 | + return this.providerName; | |
| 97 | + } | |
| 98 | + | |
| 91 | 99 | supportsFim(): boolean { |
| 92 | 100 | return false; |
| 93 | 101 | } |
| @@ -332,7 +340,7 @@ | ||
| 332 | 340 | name: "tokensGenerated", |
| 333 | 341 | data: { |
| 334 | 342 | model: model, |
| 335 | - provider: this.providerName, | |
| 343 | + provider: this.underlyingProviderName, | |
| 336 | 344 | promptTokens: promptTokens, |
| 337 | 345 | generatedTokens: generatedTokens, |
| 338 | 346 | }, |
modified core/llm/llms/stubs/ContinueProxy.ts +6 −0
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | import { |
| 2 | 2 | ContinueProperties, |
| 3 | 3 | decodeSecretLocation, |
| 4 | + parseProxyModelName, | |
| 4 | 5 | SecretType, |
| 5 | 6 | } from "@continuedev/config-yaml"; |
| 6 | 7 | |
| @@ -47,6 +48,11 @@ | ||
| 47 | 48 | useLegacyCompletionsEndpoint: false, |
| 48 | 49 | }; |
| 49 | 50 | |
| 51 | + get underlyingProviderName(): string { | |
| 52 | + const { provider } = parseProxyModelName(this.model); | |
| 53 | + return provider; | |
| 54 | + } | |
| 55 | + | |
| 50 | 56 | protected extraBodyProperties(): Record<string, any> { |
| 51 | 57 | const continueProperties: ContinueProperties = { |
| 52 | 58 | apiKeyLocation: this.apiKeyLocation, |
modified core/llm/toolSupport.test.ts +76 −40
| @@ -6,39 +6,57 @@ | ||
| 6 | 6 | const supportsFn = PROVIDER_TOOL_SUPPORT["continue-proxy"]; |
| 7 | 7 | |
| 8 | 8 | it("should return true for Claude 3.5 models", () => { |
| 9 | - expect(supportsFn("claude-3-5-sonnet")).toBe(true); | |
| 10 | - expect(supportsFn("claude-3.5-sonnet")).toBe(true); | |
| 9 | + expect( | |
| 10 | + supportsFn("ownerSlug/packageSlug/anthropic/claude-3-5-sonnet"), | |
| 11 | + ).toBe(true); | |
| 12 | + expect( | |
| 13 | + supportsFn("ownerSlug/packageSlug/anthropic/claude-3.5-sonnet"), | |
| 14 | + ).toBe(true); | |
| 11 | 15 | }); |
| 12 | 16 | |
| 13 | 17 | it("should return true for Claude 3.7 models", () => { |
| 14 | - expect(supportsFn("claude-3-7-haiku")).toBe(true); | |
| 15 | - expect(supportsFn("claude-3.7-sonnet")).toBe(true); | |
| 18 | + expect( | |
| 19 | + supportsFn("ownerSlug/packageSlug/anthropic/claude-3-7-haiku"), | |
| 20 | + ).toBe(true); | |
| 21 | + expect( | |
| 22 | + supportsFn("ownerSlug/packageSlug/anthropic/claude-3.7-sonnet"), | |
| 23 | + ).toBe(true); | |
| 16 | 24 | }); |
| 17 | 25 | |
| 18 | 26 | it("should return true for GPT-4 models", () => { |
| 19 | - expect(supportsFn("gpt-4-turbo")).toBe(true); | |
| 20 | - expect(supportsFn("gpt-4-1106-preview")).toBe(true); | |
| 27 | + expect(supportsFn("ownerSlug/packageSlug/openai/gpt-4-turbo")).toBe(true); | |
| 28 | + expect( | |
| 29 | + supportsFn("ownerSlug/packageSlug/openai/gpt-4-1106-preview"), | |
| 30 | + ).toBe(true); | |
| 21 | 31 | }); |
| 22 | 32 | |
| 23 | 33 | it("should return true for O3 models", () => { |
| 24 | - expect(supportsFn("o3-preview")).toBe(true); | |
| 34 | + expect(supportsFn("ownerSlug/packageSlug/openai/o3-preview")).toBe(true); | |
| 25 | 35 | }); |
| 26 | 36 | |
| 27 | 37 | it("should return true for Gemini models", () => { |
| 28 | - expect(supportsFn("gemini-pro")).toBe(true); | |
| 29 | - expect(supportsFn("gemini-1.5-pro")).toBe(true); | |
| 38 | + expect(supportsFn("ownerSlug/packageSlug/gemini/gemini-pro")).toBe(true); | |
| 39 | + expect(supportsFn("ownerSlug/packageSlug/gemini/gemini-1.5-pro")).toBe( | |
| 40 | + true, | |
| 41 | + ); | |
| 30 | 42 | }); |
| 31 | 43 | |
| 32 | 44 | it("should return false for unsupported models", () => { |
| 33 | - expect(supportsFn("gpt-3.5-turbo")).toBe(false); | |
| 34 | - expect(supportsFn("claude-2")).toBe(false); | |
| 35 | - expect(supportsFn("llama-3")).toBe(false); | |
| 45 | + expect(supportsFn("ownerSlug/packageSlug/openai/gpt-3.5-turbo")).toBe( | |
| 46 | + false, | |
| 47 | + ); | |
| 48 | + expect(supportsFn("ownerSlug/packageSlug/anthropic/claude-2")).toBe( | |
| 49 | + false, | |
| 50 | + ); | |
| 51 | + expect(supportsFn("ownerSlug/packageSlug/together/llama-3")).toBe(false); | |
| 36 | 52 | }); |
| 37 | 53 | |
| 38 | 54 | it("should handle case insensitivity", () => { |
| 39 | - expect(supportsFn("CLAUDE-3-5-sonnet")).toBe(true); | |
| 40 | - expect(supportsFn("GPT-4-turbo")).toBe(true); | |
| 41 | - expect(supportsFn("GEMINI-pro")).toBe(true); | |
| 55 | + expect( | |
| 56 | + supportsFn("ownerSlug/packageSlug/anthropic/CLAUDE-3-5-sonnet"), | |
| 57 | + ).toBe(true); | |
| 58 | + expect(supportsFn("ownerSlug/packageSlug/openai/GPT-4-turbo")).toBe(true); | |
| 59 | + expect(supportsFn("ownerSlug/packageSlug/gemini/GEMINI-pro")).toBe(true); | |
| 42 | 60 | }); |
| 43 | 61 | }); |
| 44 | 62 | |
| @@ -56,8 +74,8 @@ | ||
| 56 | 74 | }); |
| 57 | 75 | |
| 58 | 76 | it("should return undefined for unsupported models", () => { |
| 59 | - expect(supportsFn("claude-2")).toBeUndefined(); | |
| 60 | - expect(supportsFn("claude-instant")).toBeUndefined(); | |
| 77 | + expect(supportsFn("claude-2")).toBe(false); | |
| 78 | + expect(supportsFn("claude-instant")).toBe(false); | |
| 61 | 79 | }); |
| 62 | 80 | |
| 63 | 81 | it("should handle case insensitivity", () => { |
| @@ -81,8 +99,8 @@ | ||
| 81 | 99 | }); |
| 82 | 100 | |
| 83 | 101 | it("should return undefined for unsupported models", () => { |
| 84 | - expect(supportsFn("gpt-3.5-turbo")).toBeUndefined(); | |
| 85 | - expect(supportsFn("davinci")).toBeUndefined(); | |
| 102 | + expect(supportsFn("gpt-3.5-turbo")).toBe(false); | |
| 103 | + expect(supportsFn("davinci")).toBe(false); | |
| 86 | 104 | }); |
| 87 | 105 | |
| 88 | 106 | it("should handle case insensitivity", () => { |
| @@ -115,31 +133,49 @@ | ||
| 115 | 133 | const supportsFn = PROVIDER_TOOL_SUPPORT["bedrock"]; |
| 116 | 134 | |
| 117 | 135 | it("should return true for Claude 3.5 Sonnet models", () => { |
| 118 | - expect(supportsFn("anthropic.claude-3-5-sonnet-20240620-v1:0")).toBe(true); | |
| 119 | - expect(supportsFn("anthropic.claude-3.5-sonnet-20240620-v1:0")).toBe(true); | |
| 136 | + expect(supportsFn("anthropic.claude-3-5-sonnet-20240620-v1:0")).toBe( | |
| 137 | + true, | |
| 138 | + ); | |
| 139 | + expect(supportsFn("anthropic.claude-3.5-sonnet-20240620-v1:0")).toBe( | |
| 140 | + true, | |
| 141 | + ); | |
| 120 | 142 | }); |
| 121 | 143 | |
| 122 | 144 | it("should return true for Claude 3.7 Sonnet models", () => { |
| 123 | - expect(supportsFn("anthropic.claude-3-7-sonnet-20240620-v1:0")).toBe(true); | |
| 124 | - expect(supportsFn("anthropic.claude-3.7-sonnet-20240620-v1:0")).toBe(true); | |
| 145 | + expect(supportsFn("anthropic.claude-3-7-sonnet-20240620-v1:0")).toBe( | |
| 146 | + true, | |
| 147 | + ); | |
| 148 | + expect(supportsFn("anthropic.claude-3.7-sonnet-20240620-v1:0")).toBe( | |
| 149 | + true, | |
| 150 | + ); | |
| 125 | 151 | }); |
| 126 | 152 | |
| 127 | 153 | it("should return undefined for Claude Haiku and Opus models", () => { |
| 128 | - expect(supportsFn("anthropic.claude-3-5-haiku-20240307-v1:0")).toBeUndefined(); | |
| 129 | - expect(supportsFn("anthropic.claude-3.5-haiku-20240620-v1:0")).toBeUndefined(); | |
| 130 | - expect(supportsFn("anthropic.claude-3-7-haiku-20240620-v1:0")).toBeUndefined(); | |
| 131 | - expect(supportsFn("anthropic.claude-3-5-opus-20240620-v1:0")).toBeUndefined(); | |
| 132 | - expect(supportsFn("anthropic.claude-3.7-opus-20240620-v1:0")).toBeUndefined(); | |
| 154 | + expect(supportsFn("anthropic.claude-3-5-haiku-20240307-v1:0")).toBe( | |
| 155 | + false, | |
| 156 | + ); | |
| 157 | + expect(supportsFn("anthropic.claude-3.5-haiku-20240620-v1:0")).toBe( | |
| 158 | + false, | |
| 159 | + ); | |
| 160 | + expect(supportsFn("anthropic.claude-3-7-haiku-20240620-v1:0")).toBe( | |
| 161 | + false, | |
| 162 | + ); | |
| 163 | + expect(supportsFn("anthropic.claude-3-5-opus-20240620-v1:0")).toBe(false); | |
| 164 | + expect(supportsFn("anthropic.claude-3.7-opus-20240620-v1:0")).toBe(false); | |
| 133 | 165 | }); |
| 134 | 166 | |
| 135 | 167 | it("should return undefined for other unsupported models", () => { |
| 136 | - expect(supportsFn("anthropic.claude-instant-v1")).toBeUndefined(); | |
| 137 | - expect(supportsFn("anthropic.titan-text-express-v1")).toBeUndefined(); | |
| 168 | + expect(supportsFn("anthropic.claude-instant-v1")).toBe(false); | |
| 169 | + expect(supportsFn("anthropic.titan-text-express-v1")).toBe(false); | |
| 138 | 170 | }); |
| 139 | 171 | |
| 140 | 172 | it("should handle case insensitivity", () => { |
| 141 | - expect(supportsFn("ANTHROPIC.CLAUDE-3-5-SONNET-20240620-v1:0")).toBe(true); | |
| 142 | - expect(supportsFn("ANTHROPIC.CLAUDE-3.7-SONNET-20240620-v1:0")).toBe(true); | |
| 173 | + expect(supportsFn("ANTHROPIC.CLAUDE-3-5-SONNET-20240620-v1:0")).toBe( | |
| 174 | + true, | |
| 175 | + ); | |
| 176 | + expect(supportsFn("ANTHROPIC.CLAUDE-3.7-SONNET-20240620-v1:0")).toBe( | |
| 177 | + true, | |
| 178 | + ); | |
| 143 | 179 | }); |
| 144 | 180 | }); |
| 145 | 181 | |
| @@ -206,9 +242,9 @@ | ||
| 206 | 242 | }); |
| 207 | 243 | |
| 208 | 244 | it("should return undefined for other models", () => { |
| 209 | - expect(supportsFn("llama2")).toBeUndefined(); | |
| 210 | - expect(supportsFn("phi-2")).toBeUndefined(); | |
| 211 | - expect(supportsFn("falcon")).toBeUndefined(); | |
| 245 | + expect(supportsFn("llama2")).toBe(false); | |
| 246 | + expect(supportsFn("phi-2")).toBe(false); | |
| 247 | + expect(supportsFn("falcon")).toBe(false); | |
| 212 | 248 | }); |
| 213 | 249 | |
| 214 | 250 | it("should handle case insensitivity", () => { |
| @@ -221,16 +257,16 @@ | ||
| 221 | 257 | describe("edge cases", () => { |
| 222 | 258 | it("should handle empty model names", () => { |
| 223 | 259 | expect(PROVIDER_TOOL_SUPPORT["continue-proxy"]("")).toBe(false); |
| 224 | - expect(PROVIDER_TOOL_SUPPORT["anthropic"]("")).toBeUndefined(); | |
| 225 | - expect(PROVIDER_TOOL_SUPPORT["openai"]("")).toBeUndefined(); | |
| 260 | + expect(PROVIDER_TOOL_SUPPORT["anthropic"]("")).toBe(false); | |
| 261 | + expect(PROVIDER_TOOL_SUPPORT["openai"]("")).toBe(false); | |
| 226 | 262 | expect(PROVIDER_TOOL_SUPPORT["gemini"]("")).toBe(false); |
| 227 | - expect(PROVIDER_TOOL_SUPPORT["bedrock"]("")).toBeUndefined(); | |
| 228 | - expect(PROVIDER_TOOL_SUPPORT["ollama"]("")).toBeUndefined(); | |
| 263 | + expect(PROVIDER_TOOL_SUPPORT["bedrock"]("")).toBe(false); | |
| 264 | + expect(PROVIDER_TOOL_SUPPORT["ollama"]("")).toBe(false); | |
| 229 | 265 | }); |
| 230 | 266 | |
| 231 | 267 | it("should handle non-existent provider", () => { |
| 232 | 268 | // @ts-ignore - Testing runtime behavior with invalid provider |
| 233 | - expect(PROVIDER_TOOL_SUPPORT["non-existent"]).toBeUndefined(); | |
| 269 | + expect(PROVIDER_TOOL_SUPPORT["non-existent"]).toBe(undefined); | |
| 234 | 270 | }); |
| 235 | 271 | }); |
| 236 | 272 | }); |
modified core/llm/toolSupport.ts +258 −223
| @@ -1,238 +1,273 @@ | ||
| 1 | -export const PROVIDER_TOOL_SUPPORT: Record< | |
| 2 | - string, | |
| 3 | - (model: string) => boolean | undefined | |
| 4 | -> = { | |
| 5 | - "continue-proxy": (model) => { | |
| 6 | - // see getContinueProxyModelName | |
| 7 | - const provider = model.split("/")[2]; | |
| 8 | - const _model = model.split("/")[3]; | |
| 9 | - if (provider && _model && provider !== "continue-proxy") { | |
| 10 | - const fn = PROVIDER_TOOL_SUPPORT[provider]; | |
| 11 | - if (fn) { | |
| 12 | - return fn(_model); | |
| 1 | +import { parseProxyModelName } from "@continuedev/config-yaml"; | |
| 2 | + | |
| 3 | +export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> = | |
| 4 | + { | |
| 5 | + "continue-proxy": (model) => { | |
| 6 | + try { | |
| 7 | + const { provider, model: _model } = parseProxyModelName(model); | |
| 8 | + if (provider && _model && provider !== "continue-proxy") { | |
| 9 | + const fn = PROVIDER_TOOL_SUPPORT[provider]; | |
| 10 | + if (fn) { | |
| 11 | + return fn(_model); | |
| 12 | + } | |
| 13 | + } | |
| 14 | + } catch (e) {} | |
| 15 | + | |
| 16 | + return [ | |
| 17 | + "claude-3-5", | |
| 18 | + "claude-3.5", | |
| 19 | + "claude-3-7", | |
| 20 | + "claude-3.7", | |
| 21 | + "claude-4", | |
| 22 | + "gpt-4", | |
| 23 | + "o3", | |
| 24 | + "gemini", | |
| 25 | + ].some((part) => model.toLowerCase().startsWith(part)); | |
| 26 | + }, | |
| 27 | + anthropic: (model) => { | |
| 28 | + if ( | |
| 29 | + [ | |
| 30 | + "claude-3-5", | |
| 31 | + "claude-3.5", | |
| 32 | + "claude-3-7", | |
| 33 | + "claude-3.7", | |
| 34 | + "claude-4", | |
| 35 | + ].some((part) => model.toLowerCase().startsWith(part)) | |
| 36 | + ) { | |
| 37 | + return true; | |
| 13 | 38 | } |
| 14 | - } | |
| 15 | - return [ | |
| 16 | - "claude-3-5", | |
| 17 | - "claude-3.5", | |
| 18 | - "claude-3-7", | |
| 19 | - "claude-3.7", | |
| 20 | - "claude-sonnet-4", | |
| 21 | - "gpt-4", | |
| 22 | - "o3", | |
| 23 | - "gemini", | |
| 24 | - ].some((part) => model.toLowerCase().startsWith(part)); | |
| 25 | - }, | |
| 26 | - anthropic: (model) => { | |
| 27 | - if ( | |
| 28 | - ["claude-3-5", "claude-3.5", "claude-3-7", "claude-3.7","claude-sonnet-4"].some((part) => | |
| 29 | - model.toLowerCase().startsWith(part), | |
| 39 | + | |
| 40 | + return false; | |
| 41 | + }, | |
| 42 | + azure: (model) => { | |
| 43 | + if ( | |
| 44 | + model.toLowerCase().startsWith("gpt-4") || | |
| 45 | + model.toLowerCase().startsWith("o3") | |
| 30 | 46 | ) |
| 31 | - ) { | |
| 32 | - return true; | |
| 33 | - } | |
| 34 | - }, | |
| 35 | - azure: (model) => { | |
| 36 | - if ( | |
| 37 | - model.toLowerCase().startsWith("gpt-4") || | |
| 38 | - model.toLowerCase().startsWith("o3") | |
| 39 | - ) | |
| 40 | - return true; | |
| 41 | - return false; | |
| 42 | - }, | |
| 43 | - openai: (model) => { | |
| 44 | - // https://platform.openai.com/docs/guides/function-calling#models-supporting-function-calling | |
| 45 | - if ( | |
| 46 | - model.toLowerCase().startsWith("gpt-4") || | |
| 47 | - model.toLowerCase().startsWith("o3") | |
| 48 | - ) { | |
| 49 | - return true; | |
| 50 | - } | |
| 51 | - // firworks-ai https://docs.fireworks.ai/guides/function-calling | |
| 52 | - if (model.startsWith("accounts/fireworks/models/")) { | |
| 53 | - switch (model.substring(26)) { | |
| 54 | - case "llama-v3p1-405b-instruct": | |
| 55 | - case "llama-v3p1-70b-instruct": | |
| 56 | - case "qwen2p5-72b-instruct": | |
| 57 | - case "firefunction-v1": | |
| 58 | - case "firefunction-v2": | |
| 59 | - return true; | |
| 60 | - default: | |
| 61 | - return false; | |
| 47 | + return true; | |
| 48 | + return false; | |
| 49 | + }, | |
| 50 | + openai: (model) => { | |
| 51 | + // https://platform.openai.com/docs/guides/function-calling#models-supporting-function-calling | |
| 52 | + if ( | |
| 53 | + model.toLowerCase().startsWith("gpt-4") || | |
| 54 | + model.toLowerCase().startsWith("o3") | |
| 55 | + ) { | |
| 56 | + return true; | |
| 57 | + } | |
| 58 | + // firworks-ai https://docs.fireworks.ai/guides/function-calling | |
| 59 | + if (model.startsWith("accounts/fireworks/models/")) { | |
| 60 | + switch (model.substring(26)) { | |
| 61 | + case "llama-v3p1-405b-instruct": | |
| 62 | + case "llama-v3p1-70b-instruct": | |
| 63 | + case "qwen2p5-72b-instruct": | |
| 64 | + case "firefunction-v1": | |
| 65 | + case "firefunction-v2": | |
| 66 | + return true; | |
| 67 | + default: | |
| 68 | + return false; | |
| 69 | + } | |
| 62 | 70 | } |
| 63 | - } | |
| 64 | - }, | |
| 65 | - gemini: (model) => { | |
| 66 | - // All gemini models support function calling | |
| 67 | - return model.toLowerCase().includes("gemini"); | |
| 68 | - }, | |
| 69 | - vertexai: (model) => { | |
| 70 | - // All gemini models except flash 2.0 lite support function calling | |
| 71 | - return ( | |
| 72 | - model.toLowerCase().includes("gemini") && | |
| 73 | - !model.toLowerCase().includes("lite") | |
| 74 | - ); | |
| 75 | - }, | |
| 76 | - bedrock: (model) => { | |
| 77 | - // For Bedrock, only support Claude Sonnet models with versions 3.5/3-5 and 3.7/3-7 | |
| 78 | - if ( | |
| 79 | - model.toLowerCase().includes("sonnet") && | |
| 80 | - ["claude-3-5", "claude-3.5", "claude-3-7", "claude-3.7","claude-sonnet-4"].some((part) => | |
| 81 | - model.toLowerCase().includes(part), | |
| 82 | - ) | |
| 83 | - ) { | |
| 84 | - return true; | |
| 85 | - } | |
| 86 | - }, | |
| 87 | - mistral: (model) => { | |
| 88 | - // https://docs.mistral.ai/capabilities/function_calling/ | |
| 89 | - return ( | |
| 90 | - !model.toLowerCase().includes("mamba") && | |
| 91 | - [ | |
| 92 | - "devstral", | |
| 93 | - "codestral", | |
| 94 | - "mistral-large", | |
| 95 | - "mistral-small", | |
| 96 | - "pixtral", | |
| 97 | - "ministral", | |
| 98 | - "mistral-nemo", | |
| 99 | - ].some((part) => model.toLowerCase().includes(part)) | |
| 100 | - ); | |
| 101 | - }, | |
| 102 | - // https://ollama.com/search?c=tools | |
| 103 | - ollama: (model) => { | |
| 104 | - let modelName = ""; | |
| 105 | - // Extract the model name after the last slash to support other registries | |
| 106 | - if (model.includes("/")) { | |
| 107 | - let parts = model.split("/"); | |
| 108 | - modelName = parts[parts.length - 1]; | |
| 109 | - } else { | |
| 110 | - modelName = model; | |
| 111 | - } | |
| 112 | 71 | |
| 113 | - if ( | |
| 114 | - ["vision", "math", "guard", "mistrallite", "mistral-openorca"].some( | |
| 115 | - (part) => modelName.toLowerCase().includes(part), | |
| 116 | - ) | |
| 117 | - ) { | |
| 118 | 72 | return false; |
| 119 | - } | |
| 120 | - if ( | |
| 121 | - [ | |
| 122 | - "cogito", | |
| 123 | - "llama3.3", | |
| 124 | - "qwq", | |
| 125 | - "llama3.2", | |
| 126 | - "llama3.1", | |
| 127 | - "qwen2", | |
| 128 | - "qwen3", | |
| 129 | - "mixtral", | |
| 130 | - "command-r", | |
| 131 | - "smollm2", | |
| 132 | - "hermes3", | |
| 133 | - "athene-v2", | |
| 134 | - "nemotron", | |
| 135 | - "llama3-groq", | |
| 136 | - "granite3", | |
| 137 | - "granite-3", | |
| 138 | - "aya-expanse", | |
| 139 | - "firefunction-v2", | |
| 140 | - "mistral", | |
| 141 | - "devstral", | |
| 142 | - ].some((part) => modelName.toLowerCase().includes(part)) | |
| 143 | - ) { | |
| 144 | - return true; | |
| 145 | - } | |
| 146 | - }, | |
| 147 | - sambanova: (model) => { | |
| 148 | - // https://docs.sambanova.ai/cloud/docs/capabilities/function-calling | |
| 149 | - if ( | |
| 150 | - model.toLowerCase().startsWith("meta-llama-3") || | |
| 151 | - model.toLowerCase().includes("llama-4") || | |
| 152 | - model.toLowerCase().includes("deepseek") | |
| 153 | - ) { | |
| 154 | - return true; | |
| 155 | - } | |
| 156 | - }, | |
| 157 | - deepseek: (model) => { | |
| 158 | - if (model !== "deepseek-reasoner") { | |
| 159 | - return true; | |
| 160 | - } | |
| 161 | - }, | |
| 162 | - watsonx: (model) => { | |
| 163 | - if (model.toLowerCase().includes("guard")) return false; | |
| 164 | - if ( | |
| 165 | - ["llama-3", "llama-4", "mistral", "codestral", "granite-3"].some((part) => | |
| 166 | - model.toLowerCase().includes(part), | |
| 167 | - ) | |
| 168 | - ) | |
| 169 | - return true; | |
| 170 | - }, | |
| 171 | - openrouter: (model) => { | |
| 172 | - // https://openrouter.ai/models?fmt=cards&supported_parameters=tools | |
| 173 | - if ( | |
| 174 | - ["vision", "math", "guard", "mistrallite", "mistral-openorca"].some( | |
| 175 | - (part) => model.toLowerCase().includes(part), | |
| 176 | - ) | |
| 177 | - ) { | |
| 73 | + }, | |
| 74 | + gemini: (model) => { | |
| 75 | + // All gemini models support function calling | |
| 76 | + return model.toLowerCase().includes("gemini"); | |
| 77 | + }, | |
| 78 | + vertexai: (model) => { | |
| 79 | + // All gemini models except flash 2.0 lite support function calling | |
| 80 | + return ( | |
| 81 | + model.toLowerCase().includes("gemini") && | |
| 82 | + !model.toLowerCase().includes("lite") | |
| 83 | + ); | |
| 84 | + }, | |
| 85 | + bedrock: (model) => { | |
| 86 | + // For Bedrock, only support Claude Sonnet models with versions 3.5/3-5 and 3.7/3-7 | |
| 87 | + if ( | |
| 88 | + model.toLowerCase().includes("sonnet") && | |
| 89 | + [ | |
| 90 | + "claude-3-5", | |
| 91 | + "claude-3.5", | |
| 92 | + "claude-3-7", | |
| 93 | + "claude-3.7", | |
| 94 | + "claude-4", | |
| 95 | + ].some((part) => model.toLowerCase().includes(part)) | |
| 96 | + ) { | |
| 97 | + return true; | |
| 98 | + } | |
| 99 | + | |
| 178 | 100 | return false; |
| 179 | - } | |
| 101 | + }, | |
| 102 | + mistral: (model) => { | |
| 103 | + // https://docs.mistral.ai/capabilities/function_calling/ | |
| 104 | + return ( | |
| 105 | + !model.toLowerCase().includes("mamba") && | |
| 106 | + [ | |
| 107 | + "codestral", | |
| 108 | + "mistral-large", | |
| 109 | + "mistral-small", | |
| 110 | + "pixtral", | |
| 111 | + "ministral", | |
| 112 | + "mistral-nemo", | |
| 113 | + "devstral", | |
| 114 | + ].some((part) => model.toLowerCase().includes(part)) | |
| 115 | + ); | |
| 116 | + }, | |
| 117 | + // https://ollama.com/search?c=tools | |
| 118 | + ollama: (model) => { | |
| 119 | + let modelName = ""; | |
| 120 | + // Extract the model name after the last slash to support other registries | |
| 121 | + if (model.includes("/")) { | |
| 122 | + let parts = model.split("/"); | |
| 123 | + modelName = parts[parts.length - 1]; | |
| 124 | + } else { | |
| 125 | + modelName = model; | |
| 126 | + } | |
| 127 | + | |
| 128 | + if ( | |
| 129 | + ["vision", "math", "guard", "mistrallite", "mistral-openorca"].some( | |
| 130 | + (part) => modelName.toLowerCase().includes(part), | |
| 131 | + ) | |
| 132 | + ) { | |
| 133 | + return false; | |
| 134 | + } | |
| 135 | + if ( | |
| 136 | + [ | |
| 137 | + "cogito", | |
| 138 | + "llama3.3", | |
| 139 | + "qwq", | |
| 140 | + "llama3.2", | |
| 141 | + "llama3.1", | |
| 142 | + "qwen2", | |
| 143 | + "qwen3", | |
| 144 | + "mixtral", | |
| 145 | + "command-r", | |
| 146 | + "smollm2", | |
| 147 | + "hermes3", | |
| 148 | + "athene-v2", | |
| 149 | + "nemotron", | |
| 150 | + "llama3-groq", | |
| 151 | + "granite3", | |
| 152 | + "granite-3", | |
| 153 | + "aya-expanse", | |
| 154 | + "firefunction-v2", | |
| 155 | + "mistral", | |
| 156 | + "devstral", | |
| 157 | + ].some((part) => modelName.toLowerCase().includes(part)) | |
| 158 | + ) { | |
| 159 | + return true; | |
| 160 | + } | |
| 180 | 161 | |
| 181 | - const supportedPrefixes = [ | |
| 182 | - "openai/gpt-3.5", | |
| 183 | - "openai/gpt-4", | |
| 184 | - "openai/o1", | |
| 185 | - "openai/o3", | |
| 186 | - "openai/o4", | |
| 187 | - "anthropic/claude-3", | |
| 188 | - "microsoft/phi-3", | |
| 189 | - "google/gemini-flash-1.5", | |
| 190 | - "google/gemini-2", | |
| 191 | - "google/gemini-pro", | |
| 192 | - "x-ai/grok", | |
| 193 | - "qwen/qwen3", | |
| 194 | - "qwen/qwen-", | |
| 195 | - "cohere/command-r", | |
| 196 | - "ai21/jamba-1.6", | |
| 197 | - "mistralai/mistral", | |
| 198 | - "mistralai/ministral", | |
| 199 | - "mistralai/codestral", | |
| 200 | - "mistralai/mixtral", | |
| 201 | - "mistral/ministral", | |
| 202 | - "mistralai/pixtral", | |
| 203 | - "meta-llama/llama-3.3", | |
| 204 | - "amazon/nova", | |
| 205 | - "deepseek/deepseek-r1", | |
| 206 | - "deepseek/deepseek-chat", | |
| 207 | - "meta-llama/llama-4", | |
| 208 | - "all-hands/openhands-lm-32b", | |
| 209 | - ]; | |
| 210 | - for (const prefix of supportedPrefixes) { | |
| 211 | - if (model.toLowerCase().startsWith(prefix)) { | |
| 162 | + return false; | |
| 163 | + }, | |
| 164 | + sambanova: (model) => { | |
| 165 | + // https://docs.sambanova.ai/cloud/docs/capabilities/function-calling | |
| 166 | + if ( | |
| 167 | + model.toLowerCase().startsWith("meta-llama-3") || | |
| 168 | + model.toLowerCase().includes("llama-4") || | |
| 169 | + model.toLowerCase().includes("deepseek") | |
| 170 | + ) { | |
| 212 | 171 | return true; |
| 213 | 172 | } |
| 214 | - } | |
| 215 | 173 | |
| 216 | - const specificModels = [ | |
| 217 | - "qwen/qwq-32b", | |
| 218 | - "qwen/qwen-2.5-72b-instruct", | |
| 219 | - "meta-llama/llama-3.2-3b-instruct", | |
| 220 | - "meta-llama/llama-3-8b-instruct", | |
| 221 | - "meta-llama/llama-3-70b-instruct", | |
| 222 | - "arcee-ai/caller-large", | |
| 223 | - "nousresearch/hermes-3-llama-3.1-70b", | |
| 224 | - ]; | |
| 225 | - for (const model of specificModels) { | |
| 226 | - if (model.toLowerCase() === model) { | |
| 174 | + return false; | |
| 175 | + }, | |
| 176 | + deepseek: (model) => { | |
| 177 | + if (model !== "deepseek-reasoner") { | |
| 227 | 178 | return true; |
| 228 | 179 | } |
| 229 | - } | |
| 230 | 180 | |
| 231 | - const supportedContains = ["llama-3.1"]; | |
| 232 | - for (const model of supportedContains) { | |
| 233 | - if (model.toLowerCase().includes(model)) { | |
| 181 | + return false; | |
| 182 | + }, | |
| 183 | + watsonx: (model) => { | |
| 184 | + if (model.toLowerCase().includes("guard")) { | |
| 185 | + return false; | |
| 186 | + } | |
| 187 | + if ( | |
| 188 | + [ | |
| 189 | + "llama-3", | |
| 190 | + "llama-4", | |
| 191 | + "mistral", | |
| 192 | + "codestral", | |
| 193 | + "granite-3", | |
| 194 | + "devstral", | |
| 195 | + ].some((part) => model.toLowerCase().includes(part)) | |
| 196 | + ) { | |
| 234 | 197 | return true; |
| 235 | 198 | } |
| 236 | - } | |
| 237 | - }, | |
| 238 | -}; | |
| 199 | + | |
| 200 | + return false; | |
| 201 | + }, | |
| 202 | + openrouter: (model) => { | |
| 203 | + // https://openrouter.ai/models?fmt=cards&supported_parameters=tools | |
| 204 | + if ( | |
| 205 | + ["vision", "math", "guard", "mistrallite", "mistral-openorca"].some( | |
| 206 | + (part) => model.toLowerCase().includes(part), | |
| 207 | + ) | |
| 208 | + ) { | |
| 209 | + return false; | |
| 210 | + } | |
| 211 | + | |
| 212 | + const supportedPrefixes = [ | |
| 213 | + "openai/gpt-3.5", | |
| 214 | + "openai/gpt-4", | |
| 215 | + "openai/o1", | |
| 216 | + "openai/o3", | |
| 217 | + "openai/o4", | |
| 218 | + "anthropic/claude-3", | |
| 219 | + "anthropic/claude-4", | |
| 220 | + "microsoft/phi-3", | |
| 221 | + "google/gemini-flash-1.5", | |
| 222 | + "google/gemini-2", | |
| 223 | + "google/gemini-pro", | |
| 224 | + "x-ai/grok", | |
| 225 | + "qwen/qwen3", | |
| 226 | + "qwen/qwen-", | |
| 227 | + "cohere/command-r", | |
| 228 | + "ai21/jamba-1.6", | |
| 229 | + "mistralai/mistral", | |
| 230 | + "mistralai/ministral", | |
| 231 | + "mistralai/codestral", | |
| 232 | + "mistralai/mixtral", | |
| 233 | + "mistral/ministral", | |
| 234 | + "mistral/devstral", | |
| 235 | + "mistralai/pixtral", | |
| 236 | + "meta-llama/llama-3.3", | |
| 237 | + "amazon/nova", | |
| 238 | + "deepseek/deepseek-r1", | |
| 239 | + "deepseek/deepseek-chat", | |
| 240 | + "meta-llama/llama-4", | |
| 241 | + "all-hands/openhands-lm-32b", | |
| 242 | + ]; | |
| 243 | + for (const prefix of supportedPrefixes) { | |
| 244 | + if (model.toLowerCase().startsWith(prefix)) { | |
| 245 | + return true; | |
| 246 | + } | |
| 247 | + } | |
| 248 | + | |
| 249 | + const specificModels = [ | |
| 250 | + "qwen/qwq-32b", | |
| 251 | + "qwen/qwen-2.5-72b-instruct", | |
| 252 | + "meta-llama/llama-3.2-3b-instruct", | |
| 253 | + "meta-llama/llama-3-8b-instruct", | |
| 254 | + "meta-llama/llama-3-70b-instruct", | |
| 255 | + "arcee-ai/caller-large", | |
| 256 | + "nousresearch/hermes-3-llama-3.1-70b", | |
| 257 | + ]; | |
| 258 | + for (const model of specificModels) { | |
| 259 | + if (model.toLowerCase() === model) { | |
| 260 | + return true; | |
| 261 | + } | |
| 262 | + } | |
| 263 | + | |
| 264 | + const supportedContains = ["llama-3.1"]; | |
| 265 | + for (const model of supportedContains) { | |
| 266 | + if (model.toLowerCase().includes(model)) { | |
| 267 | + return true; | |
| 268 | + } | |
| 269 | + } | |
| 270 | + | |
| 271 | + return false; | |
| 272 | + }, | |
| 273 | + }; |
modified extensions/vscode/src/extension/VsCodeMessenger.ts +2 −1
| @@ -236,8 +236,9 @@ | ||
| 236 | 236 | data: { |
| 237 | 237 | prompt: stripImages(prompt), |
| 238 | 238 | completion: fileAfterEdit ?? "", |
| 239 | - modelProvider: model.providerName, | |
| 239 | + modelProvider: model.underlyingProviderName, | |
| 240 | 240 | modelTitle: model.title ?? "", |
| 241 | + filepath: msg.data.range.filepath, | |
| 241 | 242 | }, |
| 242 | 243 | }); |
| 243 | 244 |
modified gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx +3 −0
| @@ -40,6 +40,7 @@ | ||
| 40 | 40 | const chatModelConfig = { |
| 41 | 41 | model: chatModel.params.model, |
| 42 | 42 | provider: chatProvider.provider, |
| 43 | + underlyingProviderName: chatProvider.provider, | |
| 43 | 44 | apiKey: chatApiKey, |
| 44 | 45 | title: chatModel.params.title, |
| 45 | 46 | }; |
| @@ -47,6 +48,7 @@ | ||
| 47 | 48 | const repoMapConfig = { |
| 48 | 49 | model: repoMapModel.params.model, |
| 49 | 50 | provider: chatProvider.provider, |
| 51 | + underlyingProviderName: chatProvider.provider, | |
| 50 | 52 | apiKey: chatApiKey, |
| 51 | 53 | title: repoMapModel.params.title, |
| 52 | 54 | }; |
| @@ -54,6 +56,7 @@ | ||
| 54 | 56 | const autocompleteModelConfig = { |
| 55 | 57 | title: autocompleteModel.params.title, |
| 56 | 58 | provider: autocompleteProvider.provider, |
| 59 | + underlyingProviderName: autocompleteProvider.provider, | |
| 57 | 60 | model: autocompleteModel.params.model, |
| 58 | 61 | apiKey: autocompleteApiKey, |
| 59 | 62 | }; |
modified gui/src/redux/thunks/streamNormalInput.ts +1 −1
| @@ -79,7 +79,7 @@ | ||
| 79 | 79 | data: { |
| 80 | 80 | prompt: next.value.prompt, |
| 81 | 81 | completion: next.value.completion, |
| 82 | - modelProvider: selectedChatModel.provider, | |
| 82 | + modelProvider: selectedChatModel.underlyingProviderName, | |
| 83 | 83 | modelTitle: selectedChatModel.title, |
| 84 | 84 | sessionId: state.session.id, |
| 85 | 85 | }, |
modified packages/config-yaml/src/index.ts +1 −0
| @@ -8,6 +8,7 @@ | ||
| 8 | 8 | export * from "./load/proxySecretResolution.js"; |
| 9 | 9 | export * from "./load/typeGuards.js"; |
| 10 | 10 | export * from "./load/unroll.js"; |
| 11 | +export * from "./modelName.js"; | |
| 11 | 12 | export * from "./registryClient.js"; |
| 12 | 13 | export * from "./schemas/data/index.js"; |
| 13 | 14 | export * from "./schemas/index.js"; |
added packages/config-yaml/src/modelName.test.ts +43 −0
| @@ -0,0 +1,43 @@ | ||
| 1 | +import { parseProxyModelName } from "./modelName.js"; | |
| 2 | + | |
| 3 | +describe("parseProxyModelName", () => { | |
| 4 | + it("parses a basic model name correctly", () => { | |
| 5 | + const result = parseProxyModelName("owner/package/provider/model"); | |
| 6 | + expect(result).toEqual({ | |
| 7 | + ownerSlug: "owner", | |
| 8 | + packageSlug: "package", | |
| 9 | + provider: "provider", | |
| 10 | + model: "model", | |
| 11 | + }); | |
| 12 | + }); | |
| 13 | + | |
| 14 | + it("handles model names with slashes in the model part", () => { | |
| 15 | + const result = parseProxyModelName( | |
| 16 | + "owner/package/provider/model/with/slashes", | |
| 17 | + ); | |
| 18 | + expect(result).toEqual({ | |
| 19 | + ownerSlug: "owner", | |
| 20 | + packageSlug: "package", | |
| 21 | + provider: "provider", | |
| 22 | + model: "model/with/slashes", | |
| 23 | + }); | |
| 24 | + }); | |
| 25 | + | |
| 26 | + it("throws an error for invalid model formats (missing provider)", () => { | |
| 27 | + expect(() => { | |
| 28 | + parseProxyModelName("owner/package"); | |
| 29 | + }).toThrow("Invalid model format"); | |
| 30 | + }); | |
| 31 | + | |
| 32 | + it("throws an error for invalid model formats (missing model)", () => { | |
| 33 | + expect(() => { | |
| 34 | + parseProxyModelName("owner/package/provider"); | |
| 35 | + }).toThrow("Invalid model format"); | |
| 36 | + }); | |
| 37 | + | |
| 38 | + it("throws an error for empty string", () => { | |
| 39 | + expect(() => { | |
| 40 | + parseProxyModelName(""); | |
| 41 | + }).toThrow("Invalid model format"); | |
| 42 | + }); | |
| 43 | +}); |
added packages/config-yaml/src/modelName.ts +19 −0
| @@ -0,0 +1,19 @@ | ||
| 1 | +export interface ProxyModelName { | |
| 2 | + ownerSlug: string; | |
| 3 | + packageSlug: string; | |
| 4 | + provider: string; | |
| 5 | + model: string; | |
| 6 | +} | |
| 7 | + | |
| 8 | +export function parseProxyModelName(modelName: string): ProxyModelName { | |
| 9 | + const parts = modelName.split("/"); | |
| 10 | + | |
| 11 | + const [ownerSlug, packageSlug, provider, ...modelParts] = parts; | |
| 12 | + const model = modelParts.join("/"); | |
| 13 | + | |
| 14 | + if (!provider || !model) { | |
| 15 | + throw new Error("Invalid model format"); | |
| 16 | + } | |
| 17 | + | |
| 18 | + return { provider, model, ownerSlug, packageSlug }; | |
| 19 | +} |
modified packages/config-yaml/src/schemas/data/editInteraction/index.ts +1 −0
| @@ -9,4 +9,5 @@ | ||
| 9 | 9 | modelTitle: z.string(), |
| 10 | 10 | prompt: z.string(), |
| 11 | 11 | completion: z.string(), |
| 12 | + filepath: z.string(), | |
| 12 | 13 | }); |
modified packages/config-yaml/src/schemas/data/editInteraction/v0.2.0.ts +1 −0
| @@ -15,6 +15,7 @@ | ||
| 15 | 15 | completion: true, |
| 16 | 16 | modelTitle: true, |
| 17 | 17 | modelProvider: true, |
| 18 | + filepath: true, | |
| 18 | 19 | }); |
| 19 | 20 | |
| 20 | 21 | export const editInteractionEventSchema_0_2_0_noCode = |