Skip to content

fix: tool_choice 指定 web_search 等服务端工具时开启对应的 Google 工具 - #214

Open
Mag1cFall wants to merge 1 commit into
mainfrom
fix/hosted-tool-choice
Open

Mag1cFall wants to merge 1 commit into
mainfrom
fix/hosted-tool-choice

Conversation

@Mag1cFall

Copy link
Copy Markdown
Owner

Fixes #212

  • 修了什么:Claude Code 内置的 WebSearch 以 tool_choice: {"type":"tool","name":"web_search"} 指定 web_search_20250305 时,服务返回 400 “tool choice references undeclared function "web_search"”。
  • 原因:named tool 的 tool_choice 一律按客户端函数处理,web_search 是 server tool,转成 Google 搜索后不在函数声明中,于是被当作未声明的函数拒绝。
  • 怎么修的:tool_choice 指定 web_search、web_fetch、code_execution 等 server tool 时,本次只开启对应的 Google 工具并要求模型使用它,不再放进允许调用的函数名单。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Claude Code WebSearch returns HTTP 400 when Anthropic tool_choice forces web_search

1 participant