From 57852bada9075b4d831d80776bd057fb2905cb30 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 26 Jun 2024 16:01:50 -0700 Subject: [PATCH] fix handle_openai_chat_completion_chunk --- litellm/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index a33a160e4de..76c93d5898b 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -8301,7 +8301,7 @@ class CustomStreamWrapper: logprobs = None usage = None original_chunk = None # this is used for function/tool calling - if len(str_line.choices) > 0: + if str_line and str_line.choices and len(str_line.choices) > 0: if ( str_line.choices[0].delta is not None and str_line.choices[0].delta.content is not None