mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
Improved wildcard route handling on /models
and /model_group/info
(#8473)
* fix(model_checks.py): update returning known model from wildcard to filter based on given model prefix ensures wildcard route - `vertex_ai/gemini-*` just returns known vertex_ai/gemini- models * test(test_proxy_utils.py): add unit testing for new 'get_known_models_from_wildcard' helper * test(test_models.py): add e2e testing for `/model_group/info` endpoint * feat(prometheus.py): support tracking total requests by user_email on prometheus adds initial support for tracking total requests by user_email * test(test_prometheus.py): add testing to ensure user email is always tracked * test: update testing for new prometheus metric * test(test_prometheus_unit_tests.py): add user email to total proxy metric * test: update tests * test: fix spend tests * test: fix test * fix(pagerduty.py): fix linting error
This commit is contained in:
parent
5e58ae0347
commit
57e5ec07cc
15 changed files with 190 additions and 38 deletions
|
@ -1618,7 +1618,31 @@ def test_provider_specific_header():
|
|||
},
|
||||
}
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"wildcard_model, expected_models",
|
||||
[
|
||||
(
|
||||
"anthropic/*",
|
||||
["anthropic/claude-3-5-haiku-20241022", "anthropic/claude-3-opus-20240229"],
|
||||
),
|
||||
(
|
||||
"vertex_ai/gemini-*",
|
||||
["vertex_ai/gemini-1.5-flash", "vertex_ai/gemini-1.5-pro"],
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_get_known_models_from_wildcard(wildcard_model, expected_models):
|
||||
from litellm.proxy.auth.model_checks import get_known_models_from_wildcard
|
||||
|
||||
wildcard_models = get_known_models_from_wildcard(wildcard_model=wildcard_model)
|
||||
# Check if all expected models are in the returned list
|
||||
print(f"wildcard_models: {wildcard_models}\n")
|
||||
for model in expected_models:
|
||||
if model not in wildcard_models:
|
||||
print(f"Missing expected model: {model}")
|
||||
|
||||
assert all(model in wildcard_models for model in expected_models)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"data, user_api_key_dict, expected_model",
|
||||
[
|
||||
|
@ -1667,3 +1691,4 @@ def test_update_model_if_team_alias_exists(data, user_api_key_dict, expected_mod
|
|||
|
||||
# Check if model was updated correctly
|
||||
assert test_data.get("model") == expected_model
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue