From ebdbeeb549247ae9252acbd379ef0510b354c92a Mon Sep 17 00:00:00 2001 From: bxclib2 Date: Mon, 4 May 2026 08:10:34 +0000 Subject: [PATCH] fix: enable native web search for DeepSeek models in auto mode Add a thirdPartyNativeSearchModelPatterns list for Anthropic-compatible providers that support web_search_20250305 but whose model IDs don't contain "claude". DeepSeek models (deepseek-*) are the first entry. Co-Authored-By: Claude Opus 4.7 --- src/tools/WebSearchTool/backend.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tools/WebSearchTool/backend.ts b/src/tools/WebSearchTool/backend.ts index 281b8bd5..df83c6b9 100644 --- a/src/tools/WebSearchTool/backend.ts +++ b/src/tools/WebSearchTool/backend.ts @@ -37,6 +37,11 @@ const WEB_SEARCH_MODES = new Set([ const unsupportedNativeModels = new Set() +// Third-party Anthropic-compatible providers whose model IDs don't contain +// "claude" but do support the web_search_20250305 server tool (e.g. DeepSeek, +// Kimi, Zhipu GLM). Add model patterns here to enable native web search. +const thirdPartyNativeSearchModelPatterns = [/^deepseek-/] + export function isLikelyClaudeModel(model: string | undefined): boolean { if (!model) { return false @@ -177,7 +182,10 @@ export function makeWebSearchUnavailableOutput( function canUseAnthropicNativeWebSearch(model: string | undefined): boolean { const key = normalizeModelKey(model) - return isLikelyClaudeModel(model) && (!key || !unsupportedNativeModels.has(key)) + if (!key || unsupportedNativeModels.has(key)) { + return false + } + return isLikelyClaudeModel(model) || thirdPartyNativeSearchModelPatterns.some(p => p.test(key)) } function normalizeModelKey(model: string | undefined): string | null {