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)