Commit Graph

8 Commits

Author SHA1 Message Date
giulio-leone 7b0ed0ff91 fix: replace sk-fake with safe test key to avoid secret scanner
Replace 'sk-fake' with 'fake-key-for-testing' in websearch interception
tests to prevent false-positive secret scanner triggers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-05 18:29:28 +01:00
giulio-leone 12691dcce3 fix: WebSearch interception fails with thinking enabled + SpendLimit constraint 2026-03-04 22:44:52 +01:00
michelligabriele 4630793fb0 fix(websearch_interception): preserve thinking blocks in agentic loop follow-up messages
When extended thinking is enabled, the websearch interception agentic loop
builds a follow-up assistant message with only tool_use blocks. Anthropic's
API requires assistant messages to start with thinking/redacted_thinking
blocks when thinking is enabled, causing a 400 Bad Request.

Extract thinking blocks from the model's initial response, thread them
through the agentic loop, and prepend them to the follow-up assistant
message — matching the pattern used by anthropic_messages_pt in factory.py.

Fixes the error: "Expected 'thinking' or 'redacted_thinking', but found
'tool_use'"
2026-02-19 21:51:00 +01:00
michelligabriele 053ee4826f fix(websearch_interception): fix pre_call_deployment_hook not triggering via proxy router (#21433)
* fix(websearch_interception): fix pre_call_deployment_hook not triggering via proxy router

Fix provider lookup (check top-level kwargs + fallback to get_llm_provider),
return full kwargs dict instead of partial, and use OpenAI-format tool definition.

* remove unnecessary inline import
2026-02-19 06:38:45 -08:00
Sameer Kankute 4e94ecb08d Add tests for WebSearch interception with chat completions API 2026-02-09 13:41:29 +05:30
mpcusack-altos 88f8f49e1d fix(websearch_interception): filter internal kwargs before follow-up request (#19577)
The websearch interception handler was passing internal flags like
`_websearch_interception_converted_stream` to the follow-up LLM request.
This caused "Extra inputs are not permitted" errors from providers like
Bedrock that use strict Pydantic validation.

Fix: Filter out all kwargs starting with `_websearch_interception` prefix
before making the follow-up anthropic_messages.acreate() call.
2026-01-22 10:42:20 -08:00
John Greek aa4b0e0149 Fix duplicate test_handler.py filenames causing pytest collection errors (#19385) 2026-01-21 08:47:50 -08:00
Ishaan Jaff 104283ae8f [Feat] Claude Code - Add Websearch support using LiteLLM /search (using web search interception hook) (#19263)
* init WebSearchInterceptionLogger

* test_websearch_interception_real_call

* init async_should_run_agentic_completion

* async_should_run_agentic_loop

* async_run_agentic_loop

* refactor folder

* fix organization

* WebSearchTransformation

* WebSearchInterceptionLogger

* _call_agentic_completion_hooks

* WebSearch Interception Architecture

* test_websearch_interception_real_call

* add streaming

* add transform_request for streaming

* get_llm_provider

* test fix

* fix info

* init from config.yaml

* fixes

* test handler

* fix _is_streaming_response

* async_run_agentic_loop

* mypy fix
2026-01-16 21:10:05 -08:00