mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
Merge 136e09534a into ec94a1f82a
This commit is contained in:
commit
340d4904d1
2 changed files with 22 additions and 1 deletions
|
|
@ -456,8 +456,9 @@ def _is_cost_explicitly_configured(model: str, llm_router: "Router") -> bool:
|
|||
fields. _get_model_info_helper() then defaults missing costs to 0.
|
||||
This function detects that scenario by checking the raw model_cost entry.
|
||||
"""
|
||||
resolved_model = llm_router._get_model_from_alias(model) or model
|
||||
for deployment in llm_router.model_list:
|
||||
if deployment.get("model_name") != model:
|
||||
if deployment.get("model_name") != resolved_model:
|
||||
continue
|
||||
model_id = deployment.get("model_info", {}).get("id")
|
||||
if model_id is None:
|
||||
|
|
|
|||
|
|
@ -108,6 +108,26 @@ class TestIsModelCostZero:
|
|||
)
|
||||
assert result is True
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"alias_target",
|
||||
[
|
||||
"on-prem-model",
|
||||
{"model": "on-prem-model", "hidden": False},
|
||||
],
|
||||
)
|
||||
def test_zero_cost_model_group_alias(
|
||||
self, mock_router_with_zero_cost_model, alias_target
|
||||
):
|
||||
mock_router_with_zero_cost_model.model_group_alias = {
|
||||
"free-alias": alias_target
|
||||
}
|
||||
|
||||
result = _is_model_cost_zero(
|
||||
model="free-alias", llm_router=mock_router_with_zero_cost_model
|
||||
)
|
||||
|
||||
assert result is True
|
||||
|
||||
def test_paid_model_in_router(self, mock_router_with_zero_cost_model):
|
||||
"""Test that a paid model is correctly identified as non-zero cost."""
|
||||
with patch("litellm.get_model_info") as mock_get_model_info:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue