From 13460010f0c510b2edfddad788f4adda024f0437 Mon Sep 17 00:00:00 2001 From: Tanmay Mandal Date: Sun, 10 May 2026 16:33:04 +0530 Subject: [PATCH] fix(streaming): enhance ModelResponseStream handling for custom LLM providers --- litellm/litellm_core_utils/streaming_handler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.py index f27c18e9b65..fae74f7d2e3 100644 --- a/litellm/litellm_core_utils/streaming_handler.py +++ b/litellm/litellm_core_utils/streaming_handler.py @@ -1128,7 +1128,10 @@ class CustomStreamWrapper: completion_obj: Dict[str, Any] = {"content": ""} from litellm.types.utils import GenericStreamingChunk as GChunk - if isinstance(chunk, ModelResponseStream): + if isinstance(chunk, ModelResponseStream) and ( + self.custom_llm_provider + and self.custom_llm_provider in litellm._custom_providers + ): _has_content = bool( chunk.choices and chunk.choices[0].delta is not None