litellm/tests/unit/integrations/websearch_interception
agustin18 3f526a5017
fix(websearch): strip Claude Code instructional prefix in short-circuit search (#43458)
* fix(websearch): strip Claude Code instructional prefix in short-circuit search

Signed-off-by: agustin18 <agustinsaiz02@gmail.com>

* fix(websearch): preserve quotes for unwrapped search queries

Signed-off-by: agustin18 <agustinsaiz02@gmail.com>

* test(websearch): replace mock with pure unit tests and cover empty queries

Signed-off-by: agustin18 <agustinsaiz02@gmail.com>

* style(websearch): fix ruff formatting blank line in handler

Signed-off-by: agustin18 <agustinsaiz02@gmail.com>

* refactor(websearch): enforce Final annotations, prevent rebinding, and retain e2e coverage

Signed-off-by: agustin18 <agustinsaiz02@gmail.com>

* test(websearch): assert server_tool_use block unconditionally

Signed-off-by: agustin18 <agustinsaiz02@gmail.com>

* fix(websearch): search only the query inside Claude Code's web search prompt

Match Claude Code's exact "Perform a web search for the query:" prefix instead of a broad regex family, keep any quotes the user typed so exact-phrase searches still work, and test the search request at the HTTP boundary.

---------

Signed-off-by: agustin18 <agustinsaiz02@gmail.com>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-10-28 16:03:03 -07:00
..
__init__.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
test_websearch_agentic_loop_cap.py refactor(anthropic): rename llms/anthropic/pass_through to llms/anthropic/messages (#48510) 2026-10-27 10:08:25 -07:00
test_websearch_chat_completion.py fix(ci): stop stale CI reds, keep unit tests off the host env, retry CyberArk policy conflicts (#43294) 2026-09-26 09:25:13 -07:00
test_websearch_interception_handler.py fix(websearch_interception): intercept the bare web_search tool type on chat completions (#46736) 2026-10-15 14:08:51 -07:00
test_websearch_interception_thinking.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
test_websearch_native_blocks.py fix(exa): return highlights, highlight scores, score and the response envelope from Exa search (#47423) 2026-10-19 15:45:56 -07:00
test_websearch_responses.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
test_websearch_rich_query_shape.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
test_websearch_short_circuit.py fix(websearch): strip Claude Code instructional prefix in short-circuit search (#43458) 2026-10-28 16:03:03 -07:00
test_websearch_streaming_wrap.py refactor(anthropic): rename llms/anthropic/pass_through to llms/anthropic/messages (#48510) 2026-10-27 10:08:25 -07:00
test_websearch_thinking_constraint.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00