mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-14 00:23:05 +00:00
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:
+5
-2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user