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