diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.py index fa7faf3035d..2956db122d5 100644 --- a/litellm/litellm_core_utils/streaming_handler.py +++ b/litellm/litellm_core_utils/streaming_handler.py @@ -269,6 +269,9 @@ class CustomStreamWrapper: if len(self.chunks) < 2: return + if not self.chunks[-1].choices or not self.chunks[-2].choices: + return + last_content = self.chunks[-1].choices[0].delta.content if (