From 79201449d214d92b5d85b914476c80ac344bc17d Mon Sep 17 00:00:00 2001 From: Tasha Upchurch Date: Fri, 22 Mar 2024 23:39:17 -0400 Subject: [PATCH] Update utils.py Fix for creating an empty choices if no choices passed in --- litellm/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index b2bacb094..99e225556 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -497,7 +497,10 @@ class ModelResponse(OpenAIObject): object = "embedding" else: object = "chat.completion" - choices = [Choices(*choices)] + if choices: + choices = [Choices(*choices)] + else: + choices = [Choices()] if id is None: id = _generate_id() else: