From ce45d6a09d5bf4dde0f8b7ce11c463d7c73ddd2d Mon Sep 17 00:00:00 2001 From: yucheng Date: Tue, 15 Sep 2026 02:28:03 +0000 Subject: [PATCH] style: drop explanatory docstrings from converted-stream helpers and tests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/caching/caching_handler.py | 2 -- litellm/utils.py | 2 -- tests/test_litellm/caching/test_caching_handler.py | 2 -- tests/test_litellm/test_utils.py | 9 --------- 4 files changed, 15 deletions(-) diff --git a/litellm/caching/caching_handler.py b/litellm/caching/caching_handler.py index 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.py index 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 CustomStreamWrapper from litellm.responses.streaming_iterator import BaseResponsesAPIStreamingIterator diff --git a/tests/test_litellm/caching/test_caching_handler.py b/tests/test_litellm/caching/test_caching_handler.py index 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.asyncio async 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 litellm from litellm.caching.caching import Cache from litellm.types.utils import CallTypes diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.py index 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(mon class _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_k async 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_ob async 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 BaseResponsesAPIStreamingIterator capture: Final = _install_converted_stream_callbacks(monkeypatch) @@ -5446,8 +5440,6 @@ async def test_wrapper_async_logs_converted_responses_stream_with_standard_loggi async 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 BaseResponsesAPIStreamingIterator capture: Final = _install_converted_stream_callbacks(monkeypatch)