From 04f3765e1afd9236de5205678ff5c40169d86388 Mon Sep 17 00:00:00 2001 From: yucheng-berri <293926326+yucheng-berri@users.noreply.github.com> Date: Tue, 20 Oct 2026 14:47:29 -0700 Subject: [PATCH] fix(streaming): read the chunk's finish reason for the sticky flag --- litellm/litellm_core_utils/streaming_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.py index d867f926d87..ce06f744e6f 100644 --- a/litellm/litellm_core_utils/streaming_handler.py +++ b/litellm/litellm_core_utils/streaming_handler.py @@ -1534,7 +1534,7 @@ class CustomStreamWrapper: return _ProviderChunkEarlyReturn(None) completion_obj["content"] = response_obj["text"] self.intermittent_finish_reason = response_obj.get("finish_reason", None) - self.received_any_finish_reason |= self.intermittent_finish_reason is not None + self.received_any_finish_reason |= response_obj["finish_reason"] is not None if response_obj["is_finished"]: if response_obj["finish_reason"] == "error": raise Exception(