Update utils.py

Fix for creating an empty choices if no choices passed in
This commit is contained in:
Tasha Upchurch 2024-03-22 23:39:17 -04:00 committed by GitHub
parent 541155c08d
commit 2c1fb7e881

View file

@ -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: