mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix(adapter): pass allowed_domains through web_search_options to Responses API
When translating Anthropic web_search tools to chat/completions format,
allowed_domains was silently dropped (web_search_options set to {}).
Now extract allowed_domains from the tool and pass it as
filters.allowed_domains in web_search_options, which the Responses API
bridge forwards to the web_search tool.
This commit is contained in:
parent
54eed72ecd
commit
fe555bd08f
1 changed files with 7 additions and 1 deletions
|
|
@ -1049,7 +1049,13 @@ class LiteLLMAnthropicMessagesAdapter:
|
|||
regular_tools.append(cast(AllAnthropicToolsValues, tool))
|
||||
|
||||
if web_search_tools:
|
||||
new_kwargs["web_search_options"] = {} # type: ignore
|
||||
web_search_options: Dict[str, Any] = {}
|
||||
for wst in web_search_tools:
|
||||
wst_dict = cast(Dict[str, Any], wst)
|
||||
allowed = wst_dict.get("allowed_domains")
|
||||
if allowed:
|
||||
web_search_options.setdefault("filters", {})["allowed_domains"] = allowed
|
||||
new_kwargs["web_search_options"] = web_search_options # type: ignore
|
||||
|
||||
if not regular_tools:
|
||||
# No regular tools left — drop tool_choice to avoid
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue