mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
test(cost): cover garbage-string token counts
This commit is contained in:
parent
cc2d9f10df
commit
5573c446fc
1 changed files with 10 additions and 0 deletions
|
|
@ -4785,3 +4785,13 @@ def test_cost_per_token_string_token_counts_coerced():
|
|||
)
|
||||
assert prompt_cost == expected_prompt
|
||||
assert completion_cost == expected_completion
|
||||
|
||||
|
||||
def test_cost_per_token_garbage_string_counts_cost_zero():
|
||||
prompt_cost, completion_cost = cost_per_token(
|
||||
model="gpt-4o-mini", prompt_tokens="abc", completion_tokens=5
|
||||
)
|
||||
expected_prompt, _ = cost_per_token(
|
||||
model="gpt-4o-mini", prompt_tokens=0, completion_tokens=5
|
||||
)
|
||||
assert prompt_cost == expected_prompt
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue