Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test(proxy): use local_model_cost_map fixture for alias listing test

jesus8549189cbbed
diff --git a/tests/test_litellm/proxy/test_proxy_utils.py b/tests/test_litellm/proxy/test_proxy_utils.py
index a79e0798e29..25f4886c6f9 100644
--- a/tests/test_litellm/proxy/test_proxy_utils.py
+++ b/tests/test_litellm/proxy/test_proxy_utils.py
@@ -2243,32 +2243,27 @@ def test_create_model_info_response_resolves_mode_through_deployment_model():
{"team-embeddings": {"model": "my-embeddings", "hidden": False}},
],
)
-def test_create_model_info_response_resolves_model_group_alias_to_target(model_group_alias):
+def test_create_model_info_response_resolves_model_group_alias_to_target(model_group_alias, local_model_cost_map):
"""A `model_group_alias` row must report the metadata of the group it points at,
not the cost-map generalization or nothing that the alias name resolves to."""
from litellm import Router
- saved_model_cost = dict(litellm.model_cost)
- try:
- router = Router(
- model_list=[
- {
- "model_name": "my-embeddings",
- "litellm_params": {"model": "openai/text-embedding-3-small"},
- }
- ],
- model_group_alias=model_group_alias,
- )
+ router = Router(
+ model_list=[
+ {
+ "model_name": "my-embeddings",
+ "litellm_params": {"model": "openai/text-embedding-3-small"},
+ }
+ ],
+ model_group_alias=model_group_alias,
+ )
- alias_response = create_model_info_response(
- model_id="team-embeddings", provider="openai", llm_router=router
- )
- target_response = create_model_info_response(
- model_id="my-embeddings", provider="openai", llm_router=router
- )
- finally:
- litellm.model_cost.clear()
- litellm.model_cost.update(saved_model_cost)
+ alias_response = create_model_info_response(
+ model_id="team-embeddings", provider="openai", llm_router=router
+ )
+ target_response = create_model_info_response(
+ model_id="my-embeddings", provider="openai", llm_router=router
+ )
assert alias_response["id"] == "team-embeddings"
for field in ("mode", "max_input_tokens", "max_output_tokens"):