forked from phoenix/litellm-mirror
Merge pull request #2656 from TashaSkyUp/patch-1
fix for: when using ModelResponse.json() to save and then reconstruct a ModelResponse the choices field ends up empty
This commit is contained in:
commit
6f11f300fc
1 changed files with 5 additions and 2 deletions
|
@ -354,7 +354,7 @@ class Choices(OpenAIObject):
|
|||
if message is None:
|
||||
self.message = Message(content=None)
|
||||
else:
|
||||
self.message = message
|
||||
self.message = Message(**message)
|
||||
if logprobs is not None:
|
||||
self.logprobs = logprobs
|
||||
if enhancements is not None:
|
||||
|
@ -497,7 +497,10 @@ class ModelResponse(OpenAIObject):
|
|||
object = "embedding"
|
||||
else:
|
||||
object = "chat.completion"
|
||||
choices = [Choices()]
|
||||
if choices:
|
||||
choices = [Choices(*choices)]
|
||||
else:
|
||||
choices = [Choices()]
|
||||
if id is None:
|
||||
id = _generate_id()
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue