forked from phoenix/litellm-mirror
fix(cost_calculator.py): fix completion_response check
This commit is contained in:
parent
1b14202582
commit
f62884da14
1 changed files with 4 additions and 3 deletions
|
@ -473,9 +473,10 @@ def completion_cost(
|
||||||
prompt_characters = 0
|
prompt_characters = 0
|
||||||
completion_tokens = 0
|
completion_tokens = 0
|
||||||
completion_characters = 0
|
completion_characters = 0
|
||||||
if completion_response is not None and isinstance(
|
if completion_response is not None and (
|
||||||
completion_response, BaseModel
|
isinstance(completion_response, BaseModel)
|
||||||
):
|
or isinstance(completion_response, dict)
|
||||||
|
): # tts returns a custom class
|
||||||
# get input/output tokens from completion_response
|
# get input/output tokens from completion_response
|
||||||
prompt_tokens = completion_response.get("usage", {}).get("prompt_tokens", 0)
|
prompt_tokens = completion_response.get("usage", {}).get("prompt_tokens", 0)
|
||||||
completion_tokens = completion_response.get("usage", {}).get(
|
completion_tokens = completion_response.get("usage", {}).get(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue