mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
Merge de0452680d into 321be01877
This commit is contained in:
commit
31df6f9f5e
1 changed files with 16 additions and 0 deletions
16
tests/test_token_counter_invariants.py
Normal file
16
tests/test_token_counter_invariants.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import pytest
|
||||
|
||||
def normalize_model_name(name: str) -> str:
|
||||
if not name:
|
||||
return ""
|
||||
return name.strip().lower().replace("openai/", "").replace("anthropic/", "")
|
||||
|
||||
def test_empty_and_whitespace_model_normalization():
|
||||
assert normalize_model_name("") == ""
|
||||
assert normalize_model_name(" ") == ""
|
||||
assert normalize_model_name("openai/gpt-4o") == "gpt-4o"
|
||||
assert normalize_model_name("Anthropic/claude-3-5-sonnet-20241022") == "claude-3-5-sonnet-20241022"
|
||||
|
||||
def test_model_name_casing_invariance():
|
||||
assert normalize_model_name("GPT-4-TURBO") == "gpt-4-turbo"
|
||||
assert normalize_model_name("text-embedding-3-small") == "text-embedding-3-small"
|
||||
Loading…
Add table
Reference in a new issue