mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(router): handle tools=None in filter_web_search_deployments (#17684)
Fixes #17672 Changed `request_kwargs.get("tools", [])` to `request_kwargs.get("tools") or []` to handle the case where tools is explicitly set to None.
This commit is contained in:
parent
a904067d38
commit
7c2e2111c0
2 changed files with 6 additions and 1 deletions
|
|
@ -110,7 +110,7 @@ def filter_web_search_deployments(
|
|||
return healthy_deployments
|
||||
|
||||
is_web_search_request = False
|
||||
tools = request_kwargs.get("tools", [])
|
||||
tools = request_kwargs.get("tools") or []
|
||||
for tool in tools:
|
||||
# These are the two websearch tools for OpenAI / Azure.
|
||||
if tool.get("type") == "web_search" or tool.get("type") == "web_search_preview":
|
||||
|
|
|
|||
|
|
@ -248,6 +248,11 @@ class TestFilterWebSearchDeployments:
|
|||
result = filter_web_search_deployments(sample_deployments, {"tools": []})
|
||||
assert result == sample_deployments
|
||||
|
||||
def test_none_tools_returns_all(self, sample_deployments):
|
||||
"""When tools is explicitly None, return all deployments (regression test for #17672)"""
|
||||
result = filter_web_search_deployments(sample_deployments, {"tools": None})
|
||||
assert result == sample_deployments
|
||||
|
||||
def test_non_web_search_tools_returns_all(self, sample_deployments):
|
||||
"""When tools don't include web_search, return all deployments"""
|
||||
request_kwargs = {"tools": [{"type": "function", "function": {}}]}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue