diff options
| author | YurenHao0426 <blackhao0426@gmail.com> | 2026-02-14 01:36:41 +0000 |
|---|---|---|
| committer | YurenHao0426 <blackhao0426@gmail.com> | 2026-02-14 01:36:41 +0000 |
| commit | 9170f7dba01c076f1ac1367549095fd69524ba9d (patch) | |
| tree | 44ff847efc90a30a42f211ff867acb9294035125 | |
| parent | 51b5208b9b5ac51b7e531ddeb59093c1cb381491 (diff) | |
Enable web search for Claude models via web_search_20250305 tool
stream_claude was missing enable_google_search handling, so Claude models
could never perform web searches. Now passes the Anthropic web search tool
when enabled, affecting all modes (normal run, council, debate).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| -rw-r--r-- | backend/app/services/llm.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/backend/app/services/llm.py b/backend/app/services/llm.py index c22ada3..3f99f23 100644 --- a/backend/app/services/llm.py +++ b/backend/app/services/llm.py @@ -483,6 +483,10 @@ async def stream_claude(messages: list[Message], config: LLMConfig, attachments: messages=merged, ) + # Enable web search tool for Claude if requested + if config.enable_google_search: + stream_params["tools"] = [{"type": "web_search_20250305", "name": "web_search", "max_uses": 5}] + if has_file_references: # Use beta endpoint for Files API references async with client.beta.messages.stream( |
