mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
(fix) pydantic errors openai usage
This commit is contained in:
parent
604b2f8ef2
commit
3f30f93516
1 changed files with 5 additions and 3 deletions
|
@ -3079,7 +3079,9 @@ def convert_to_model_response_object(response_object: Optional[dict]=None, model
|
||||||
model_response_object.choices = choice_list
|
model_response_object.choices = choice_list
|
||||||
|
|
||||||
if "usage" in response_object:
|
if "usage" in response_object:
|
||||||
model_response_object.usage = response_object["usage"]
|
model_response_object.usage.completion_tokens = response_object["usage"]["completion_tokens"]
|
||||||
|
model_response_object.usage.prompt_tokens = response_object["usage"]["prompt_tokens"]
|
||||||
|
model_response_object.usage.total_tokens = response_object["usage"]["total_tokens"]
|
||||||
|
|
||||||
if "id" in response_object:
|
if "id" in response_object:
|
||||||
model_response_object.id = response_object["id"]
|
model_response_object.id = response_object["id"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue