litellm/tests/test_litellm/integrations/websearch_interception
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
..
test_websearch_chat_completion.py Add tests for WebSearch interception with chat completions API 2026-02-09 13:41:29 +05:30
test_websearch_interception_handler.py fix(websearch_interception): fix pre_call_deployment_hook not triggering via proxy router (#21433) 2026-02-19 06:38:45 -08:00
test_websearch_interception_thinking.py fix(websearch_interception): preserve thinking blocks in agentic loop follow-up messages 2026-02-19 21:51:00 +01:00