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 9201c122e7
commit 79201449d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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: