From 20c7453425c5004e3e6c99e227b587a62bb920db Mon Sep 17 00:00:00 2001 From: Shariq Riaz Date: Sat, 24 May 2025 01:28:42 +0400 Subject: [PATCH] Remove claude-3.7-sonnet and claude-3.7-sonnet:thinking from vscodelm (#3895) * Remove claude-3.7-sonnet and claude-3.7-sonnet:thinking from vscodelm provider in api.ts (not supported via API) * Add static blacklist for unsupported VS Code Language Model IDs --------- Co-authored-by: Ruakij --- src/api/providers/vscode-lm.ts | 7 +++++-- src/shared/api.ts | 26 -------------------------- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/src/api/providers/vscode-lm.ts b/src/api/providers/vscode-lm.ts index 85a17cc265..c06510c26c 100644 --- a/src/api/providers/vscode-lm.ts +++ b/src/api/providers/vscode-lm.ts @@ -555,10 +555,13 @@ export class VsCodeLmHandler extends BaseProvider implements SingleCompletionHan } } +// Static blacklist of VS Code Language Model IDs that should be excluded from the model list e.g. because they will never work +const VSCODE_LM_STATIC_BLACKLIST: string[] = ["claude-3.7-sonnet", "claude-3.7-sonnet-thought"] + export async function getVsCodeLmModels() { try { - const models = await vscode.lm.selectChatModels({}) - return models || [] + const models = (await vscode.lm.selectChatModels({})) || [] + return models.filter((model) => !VSCODE_LM_STATIC_BLACKLIST.includes(model.id)) } catch (error) { console.error( `Error fetching VS Code LM models: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`, diff --git a/src/shared/api.ts b/src/shared/api.ts index 6f63471788..e336d5ce23 100644 --- a/src/shared/api.ts +++ b/src/shared/api.ts @@ -1473,32 +1473,6 @@ export const vscodeLlmModels = { supportsToolCalling: true, maxInputTokens: 81638, }, - "claude-3.7-sonnet": { - contextWindow: 89827, - supportsImages: true, - supportsPromptCache: false, - inputPrice: 0, - outputPrice: 0, - family: "claude-3.7-sonnet", - version: "claude-3.7-sonnet", - name: "Claude 3.7 Sonnet", - supportsToolCalling: true, - maxInputTokens: 89827, - }, - "claude-3.7-sonnet-thought": { - contextWindow: 89827, - supportsImages: true, - supportsPromptCache: false, - inputPrice: 0, - outputPrice: 0, - family: "claude-3.7-sonnet-thought", - version: "claude-3.7-sonnet-thought", - name: "Claude 3.7 Sonnet Thinking", - supportsToolCalling: false, - maxInputTokens: 89827, - supportsReasoningBudget: true, - requiredReasoningBudget: true, - }, "gemini-2.0-flash-001": { contextWindow: 127827, supportsImages: true,