mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
test(proxy): use local_model_cost_map fixture for alias listing test
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
0a81c6d3a8
commit
8549189cbb
1 changed files with 16 additions and 21 deletions
|
|
@ -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"):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue