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
style: drop explanatory docstrings from converted-stream helpers and tests
yuchengce45d6a09d5b
diff --git a/litellm/caching/caching_handler.py b/litellm/caching/caching_handler.pyindex 1ddc0559547..a0ddbdb37ec 100644--- a/litellm/caching/caching_handler.py+++ b/litellm/caching/caching_handler.py@@ -109,8 +109,6 @@ def _is_chat_completion_cached_dict(cached_result: dict) -> bool:def _stream_replay_requested(kwargs: Mapping[str, object]) -> bool:- """True when the caller must receive a stream, including when a deployment hook downgraded- `kwargs["stream"]` to False for the provider call."""return kwargs.get("stream", False) is True or converted_stream_requested(kwargs)diff --git a/litellm/utils.py b/litellm/utils.pyindex 8dc6576cc97..35ad48dd062 100644--- a/litellm/utils.py+++ b/litellm/utils.py@@ -847,8 +847,6 @@ def _is_streaming_response_for_correlation(result: object) -> bool:def _is_converted_stream_result(result: object) -> bool:- """True if `result` is a lazy stream wrapper the caller must iterate, even when a deployment- hook downgraded `kwargs["stream"]` to False for the provider call."""from litellm.litellm_core_utils.streaming_handler import CustomStreamWrapperfrom litellm.responses.streaming_iterator import BaseResponsesAPIStreamingIteratordiff --git a/tests/test_litellm/caching/test_caching_handler.py b/tests/test_litellm/caching/test_caching_handler.pyindex 12f141353bb..dd826d80208 100644--- a/tests/test_litellm/caching/test_caching_handler.py+++ b/tests/test_litellm/caching/test_caching_handler.py@@ -697,8 +697,6 @@ async def test_cache_hit_records_the_looked_up_key_as_the_preset_cache_key(monke@pytest.mark.asyncioasync def test_converted_stream_cache_hit_replayed_as_plain_object_logs_at_hit_time(monkeypatch):- """A converted-stream Anthropic Messages request that hits a non-stream cache entry gets a plain dict back,- so the success callbacks must fire now; nothing else will fire them."""import litellmfrom litellm.caching.caching import Cachefrom litellm.types.utils import CallTypesdiff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.pyindex 8b83ca29dd7..02ea06ccf80 100644--- a/tests/test_litellm/test_utils.py+++ b/tests/test_litellm/test_utils.py@@ -5312,8 +5312,6 @@ async def test_wrapper_async_restores_originating_task_context_after_success(monclass _ConvertStreamDeploymentHook(CustomLogger):- """Headroom-style interception: downgrade stream=True to a non-streaming provider call."""-async def async_pre_call_deployment_hook(self, kwargs: dict[str, object], call_type: CallTypes | None) -> dict[str, object] | None:@@ -5372,8 +5370,6 @@ def _assert_cache_hit_logged_as_stream(capture: _SuccessKwargsCapture, success_kasync def test_wrapper_async_logs_converted_chat_stream_with_standard_logging_object(monkeypatch: pytest.MonkeyPatch,) -> None:- """Regression LIT-7729: the fake CustomStreamWrapper hit the non-streaming success path, which- built no standard_logging_object and deduped the wrapper's own end-of-stream dispatch."""capture: Final = _install_converted_stream_callbacks(monkeypatch)response: Final = await litellm.acompletion(@@ -5400,8 +5396,6 @@ async def test_wrapper_async_logs_converted_chat_stream_with_standard_logging_obasync def test_wrapper_async_logs_converted_responses_stream_with_standard_logging_object(monkeypatch: pytest.MonkeyPatch,) -> None:- """Regression LIT-7729, Responses surface: the fake MockResponsesAPIStreamingIterator took the- same non-streaming success path and lost its standard_logging_object."""from litellm.responses.streaming_iterator import BaseResponsesAPIStreamingIteratorcapture: Final = _install_converted_stream_callbacks(monkeypatch)@@ -5446,8 +5440,6 @@ async def test_wrapper_async_logs_converted_responses_stream_with_standard_loggiasync def test_wrapper_async_replays_cached_converted_chat_stream_as_stream(monkeypatch: pytest.MonkeyPatch,) -> None:- """A cache hit for a converted stream must replay as a stream: the caller still iterates the- result even though the deployment hook set kwargs["stream"] to False."""capture: Final = _install_converted_stream_callbacks(monkeypatch)monkeypatch.setattr(litellm, "cache", Cache(type="local"))request: Final = {@@ -5476,7 +5468,6 @@ async def test_wrapper_async_replays_cached_converted_chat_stream_as_stream(async def test_wrapper_async_replays_cached_converted_responses_stream_as_stream(monkeypatch: pytest.MonkeyPatch,) -> None:- """Responses surface of the cache-hit replay: the hit must come back as a streaming iterator."""from litellm.responses.streaming_iterator import BaseResponsesAPIStreamingIteratorcapture: Final = _install_converted_stream_callbacks(monkeypatch)