forked from phoenix/litellm-mirror
fix(utils.py): handle pydantic v1
This commit is contained in:
parent
850b056df5
commit
486c8ccc30
1 changed files with 4 additions and 1 deletions
|
@ -10194,7 +10194,10 @@ class CustomStreamWrapper:
|
|||
for idx, choice in enumerate(original_chunk.choices):
|
||||
try:
|
||||
if isinstance(choice, BaseModel):
|
||||
choice_json = choice.model_dump()
|
||||
try:
|
||||
choice_json = choice.model_dump()
|
||||
except Exception as e:
|
||||
choice_json = choice.dict()
|
||||
choice_json.pop(
|
||||
"finish_reason", None
|
||||
) # for mistral etc. which return a value in their last chunk (not-openai compatible).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue