fix(utils.py): fix recreating model response object when stream usage is true

This commit is contained in:
Krrish Dholakia 2024-07-11 21:00:46 -07:00
parent e112379d2f
commit b2e46086dd
3 changed files with 88 additions and 17 deletions

View file

@ -573,6 +573,8 @@ class ModelResponse(OpenAIObject):
_new_choice = choice # type: ignore
elif isinstance(choice, dict):
_new_choice = Choices(**choice) # type: ignore
else:
_new_choice = choice
new_choices.append(_new_choice)
choices = new_choices
else: