The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(websearch): keep _inject_native_blocks untyped rather than dodge the write
mateo-berri86e7bcaf54d1
diff --git a/litellm/integrations/websearch_interception/handler.py b/litellm/integrations/websearch_interception/handler.pyindex f6b40836c3a..e59ef0449d0 100644--- a/litellm/integrations/websearch_interception/handler.py+++ b/litellm/integrations/websearch_interception/handler.py@@ -10,7 +10,7 @@ import asyncioimport mathimport uuidfrom collections.abc import AsyncIterator, Mapping, Sequence-from typing import TYPE_CHECKING, Any, Final, TypedDict, TypeVar, cast+from typing import TYPE_CHECKING, Any, Final, TypedDict, castfrom typing_extensions import ReadOnly@@ -106,9 +106,6 @@ class _UserAuthView(TypedDict):team_id: ReadOnly[str | None]-_ResponseT: Final = TypeVar("_ResponseT")--class WebSearchInterceptionLogger(CustomLogger):"""CustomLogger that intercepts WebSearch tool calls for models that don't@@ -929,7 +926,7 @@ class WebSearchInterceptionLogger(CustomLogger):)@staticmethod- def _inject_native_blocks(response: _ResponseT, native_blocks: Sequence[Mapping[str, object]]) -> _ResponseT:+ def _inject_native_blocks(response: Any, native_blocks: Sequence[Mapping[str, object]]) -> Any:"""Prepend native blocks to response content, dict or object form."""if not native_blocks:return response@@ -939,7 +936,7 @@ class WebSearchInterceptionLogger(CustomLogger):return responseexisting = getattr(response, "content", None) or []try:- setattr(response, "content", list(native_blocks) + list(existing))+ response.content = list(native_blocks) + list(existing)except (AttributeError, TypeError):# Object refused write — fall through and leave the response# untouched rather than crash the request.