From 589169c715b209cae73c316126d5868062b76197 Mon Sep 17 00:00:00 2001 From: lido-alexion <71609222+lido-alexion@users.noreply.github.com> Date: Wed, 18 Mar 2026 18:54:19 +0530 Subject: [PATCH] Update litellm/litellm_core_utils/streaming_handler.py Accepting the suugestion. Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- litellm/litellm_core_utils/streaming_handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.py index 7c32e34617a..63698f86bc8 100644 --- a/litellm/litellm_core_utils/streaming_handler.py +++ b/litellm/litellm_core_utils/streaming_handler.py @@ -1109,10 +1109,11 @@ class CustomStreamWrapper: and self.custom_llm_provider in litellm._custom_providers ): if self.received_finish_reason is not None: + _chunk_has_content = isinstance(chunk, dict) and ( _chunk_has_content = isinstance(chunk, dict) and ( bool(chunk.get("text", "")) or chunk.get("tool_use") is not None - or chunk.get("reasoning_content") is not None + or bool(chunk.get("reasoning_content", "")) ) if not _chunk_has_content and ( not isinstance(chunk, dict)