diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.py index eeccfe53335..5a592e6092f 100644 --- a/litellm/litellm_core_utils/streaming_handler.py +++ b/litellm/litellm_core_utils/streaming_handler.py @@ -1204,7 +1204,7 @@ class CustomStreamWrapper: if response_obj is None: return completion_obj["content"] = response_obj["text"] - self.received_finish_reason = response_obj.get("finish_reason", None) + self.intermittent_finish_reason = response_obj.get("finish_reason", None) if response_obj["is_finished"]: if response_obj["finish_reason"] == "error": raise Exception( @@ -1212,6 +1212,7 @@ class CustomStreamWrapper: self.custom_llm_provider, response_obj ) ) + self.received_finish_reason = response_obj["finish_reason"] if response_obj.get("original_chunk", None) is not None: if hasattr(response_obj["original_chunk"], "id"): model_response = self.set_model_id(