mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix: sync model_list with models_by_provider
25 model groups were present in models_by_provider but missing from model_list, causing visible inconsistency (e.g. bedrock showed only 7 models in model_list vs 450+ in models_by_provider). Also added ai21_chat_models to models_by_provider["ai21"] and a docker_model_runner entry which existed in model_list but had no models_by_provider key. Added a regression test to catch future drift between the two. Fixes #29274
This commit is contained in:
parent
f27df8d516
commit
a756256a76
2 changed files with 42 additions and 1 deletions
|
|
@ -1031,6 +1031,31 @@ model_list = list(
|
|||
| reducto_models
|
||||
| bedrock_mantle_models
|
||||
| set(clarifai_models)
|
||||
| set(petals_models)
|
||||
| bedrock_converse_models
|
||||
| vertex_anthropic_models
|
||||
| vertex_vision_models
|
||||
| vertex_deepseek_models
|
||||
| vertex_minimax_models
|
||||
| vertex_moonshot_models
|
||||
| vertex_zai_models
|
||||
| fireworks_ai_models
|
||||
| fireworks_ai_embedding_models
|
||||
| mistral_chat_models
|
||||
| sambanova_embedding_models
|
||||
| nebius_models
|
||||
| nebius_embedding_models
|
||||
| aiml_models
|
||||
| hyperbolic_models
|
||||
| amazon_nova_models
|
||||
| stability_models
|
||||
| github_copilot_models
|
||||
| chatgpt_models
|
||||
| minimax_models
|
||||
| aws_polly_models
|
||||
| gigachat_models
|
||||
| llamagate_models
|
||||
| ovhcloud_embedding_models
|
||||
)
|
||||
|
||||
model_list_set = set(model_list)
|
||||
|
|
@ -1060,7 +1085,7 @@ models_by_provider: dict = {
|
|||
| vertex_minimax_models
|
||||
| vertex_moonshot_models
|
||||
| vertex_zai_models,
|
||||
"ai21": ai21_models,
|
||||
"ai21": ai21_models | ai21_chat_models,
|
||||
"bedrock": bedrock_models | bedrock_converse_models,
|
||||
"petals": petals_models,
|
||||
"ollama": ollama_models,
|
||||
|
|
@ -1137,6 +1162,7 @@ models_by_provider: dict = {
|
|||
"llamagate": llamagate_models,
|
||||
"reducto": reducto_models,
|
||||
"bedrock_mantle": bedrock_mantle_models,
|
||||
"docker_model_runner": docker_model_runner_models,
|
||||
}
|
||||
|
||||
# mapping for those models which have larger equivalents
|
||||
|
|
|
|||
|
|
@ -2516,3 +2516,18 @@ def test_get_base_model_from_metadata():
|
|||
# Test 6: None input
|
||||
result = _get_base_model_from_metadata(None)
|
||||
assert result is None, f"Expected None for None input, got {result}"
|
||||
|
||||
|
||||
def test_model_list_models_by_provider_in_sync():
|
||||
model_list_set = set(litellm.model_list)
|
||||
missing_from_model_list = []
|
||||
for provider, models in litellm.models_by_provider.items():
|
||||
model_set = set(models) if isinstance(models, list) else models
|
||||
for model in model_set:
|
||||
if model not in model_list_set:
|
||||
missing_from_model_list.append(f"{provider}: {model}")
|
||||
|
||||
assert not missing_from_model_list, (
|
||||
f"{len(missing_from_model_list)} models in models_by_provider are missing from model_list:\n"
|
||||
+ "\n".join(missing_from_model_list[:20])
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue