forked from phoenix/litellm-mirror
(feat) completion_cost: improve model=None error
This commit is contained in:
parent
f211009263
commit
00b001b96b
1 changed files with 4 additions and 0 deletions
|
@ -2848,6 +2848,10 @@ def completion_cost(
|
|||
elif len(prompt) > 0:
|
||||
prompt_tokens = token_counter(model=model, text=prompt)
|
||||
completion_tokens = token_counter(model=model, text=completion)
|
||||
if model == None:
|
||||
raise ValueError(
|
||||
f"Model is None and does not exist in passed completion_response. Passed completion_response={completion_response}, model={model}"
|
||||
)
|
||||
|
||||
# Calculate cost based on prompt_tokens, completion_tokens
|
||||
if "togethercomputer" in model or "together_ai" in model:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue