From af0e0f478a6254f24d1b7d9f63895d89bf129fe7 Mon Sep 17 00:00:00 2001 From: lei_lei <96427312+leilei3167@users.noreply.github.com> Date: Sun, 30 Aug 2026 12:35:12 +0800 Subject: [PATCH] fix(websearch): avoid mutable key check --- litellm/integrations/websearch_interception/tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/integrations/websearch_interception/tools.py b/litellm/integrations/websearch_interception/tools.py index d5c72f6eae6..e5ca0b8ba8f 100644 --- a/litellm/integrations/websearch_interception/tools.py +++ b/litellm/integrations/websearch_interception/tools.py @@ -195,7 +195,7 @@ def is_web_search_tool_chat_completion(tool: dict[str, Any]) -> bool: # The conventional name is only recognized for the name-only shape. # A user-defined function may also be named ``web_search``; preserving # any additional definition fields lets that tool pass through intact. - if function_name == "web_search" and set(function_def) == {"name"}: + if function_name == "web_search" and len(function_def) == 1 and "name" in function_def: return True # Check for LiteLLM standard tool (Anthropic format) @@ -285,7 +285,7 @@ def is_web_search_tool(tool: dict[str, Any]) -> bool: return True # Do not hijack a user-defined function that happens to use the # conventional name and carries its own schema or description. - if function_name == "web_search" and set(function_def) == {"name"}: + if function_name == "web_search" and len(function_def) == 1 and "name" in function_def: return True # Check for LiteLLM standard tool (Anthropic format)