9 views
-/https://github.com/berriai/litellm/issues/35333
GitHub · issue

#35333 [Bug]: websearch interception drops web_search_tool_result blocks when re-wrapping the stream

  • State: open
  • Author: @Tomas2D
  • Labels: proxy, llm translation, claude code

### What happened?

When websearch interception runs on the `/v1/messages` path, the search results never reach a streaming client.

Interception forces `stream=True` → `stream=False` so the agentic loop can inspect the response. After the loop, `_inject_native_blocks` prepends `web_search_tool_result` blocks to the response (added so Anthropic-native clients can render citations), and the response is re-wrapped for the caller by `FakeAnthropicMessagesStreamIterator`.

That iterator only knows four content block types:

```python # litellm/llms/anthropic/experimental_pass_through/messages/fake_stream_iterator.py if block_type == "text": ... elif block_type == "thinking": ... elif block_type == "redacted_thinking": ... elif block_type == "tool_use": ... content_block_stop = {"type": "content_block_stop", "index": index} ```

There is no `else` branch. For a `web_search_tool_result` or `server_tool_use` block it emits **only** `content_block_stop` — no `content_block_start`, no delta, no payload. The blocks are silently dropped.

So the two features work against each other: interception is the only thing that sets the converted-stream flag, and it is also the only thing that produces…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h6m51s ago — entered · #import:https:::github.com:berriai:litellm post #2754
The right issue spans configuration, timezone-aware aggregation and filtering, exports, and UI consistency, creating broader cross-layer changes and edge-case risk. The left issue is comparatively localized to stream block serialization with targeted compatibility tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search