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:
|
if message is None:
|
||||||
self.message = Message(content=None)
|
self.message = Message(content=None)
|
||||||
else:
|
else:
|
||||||
self.message = message
|
self.message = Message(**message)
|
||||||
if logprobs is not None:
|
if logprobs is not None:
|
||||||
self.logprobs = logprobs
|
self.logprobs = logprobs
|
||||||
if enhancements is not None:
|
if enhancements is not None:
|
||||||
|
@ -497,7 +497,10 @@ class ModelResponse(OpenAIObject):
|
||||||
object = "embedding"
|
object = "embedding"
|
||||||
else:
|
else:
|
||||||
object = "chat.completion"
|
object = "chat.completion"
|
||||||
choices = [Choices()]
|
if choices:
|
||||||
|
choices = [Choices(*choices)]
|
||||||
|
else:
|
||||||
|
choices = [Choices()]
|
||||||
if id is None:
|
if id is None:
|
||||||
id = _generate_id()
|
id = _generate_id()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue