mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
test(proxy_server): add independent regression test for _get_proxy_model_info with fresh model
This commit is contained in:
parent
010e960a7e
commit
80f4d7ed19
1 changed files with 14 additions and 3 deletions
|
|
@ -546,7 +546,7 @@ def test_v2_model_info_access_group_paginates_over_the_filtered_set(client, auth
|
|||
def test_enrich_model_info_with_litellm_data_populates_none_keys(monkeypatch):
|
||||
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
|
||||
from litellm.proxy._types import ModelInfo as ProxyModelInfo
|
||||
from litellm.proxy.proxy_server import _enrich_model_info_with_litellm_data, _get_proxy_model_info
|
||||
from litellm.proxy.proxy_server import _enrich_model_info_with_litellm_data
|
||||
|
||||
backend = "bedrock/eu.anthropic.claude-opus-5"
|
||||
p_model_info = ProxyModelInfo(id="d1").model_dump()
|
||||
|
|
@ -558,7 +558,17 @@ def test_enrich_model_info_with_litellm_data_populates_none_keys(monkeypatch):
|
|||
assert mi.get("max_tokens") == 128000
|
||||
assert mi.get("mode") == "chat"
|
||||
|
||||
proxy_info = _get_proxy_model_info(model=model)
|
||||
|
||||
def test_get_proxy_model_info_populates_none_keys(monkeypatch):
|
||||
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
|
||||
from litellm.proxy._types import ModelInfo as ProxyModelInfo
|
||||
from litellm.proxy.proxy_server import _get_proxy_model_info
|
||||
|
||||
backend = "bedrock/eu.anthropic.claude-opus-5"
|
||||
p_model_info = ProxyModelInfo(id="d1").model_dump()
|
||||
fresh_model = {"model_name": "m", "litellm_params": {"model": backend}, "model_info": dict(p_model_info)}
|
||||
|
||||
proxy_info = _get_proxy_model_info(model=fresh_model)
|
||||
p_mi = proxy_info["model_info"]
|
||||
assert p_mi.get("input_cost_per_token") == 5.5e-06
|
||||
assert p_mi.get("max_tokens") == 128000
|
||||
|
|
@ -579,7 +589,8 @@ def test_enrich_model_info_with_litellm_data_preserves_custom_pricing(monkeypatc
|
|||
assert mi.get("input_cost_per_token") == 0.00099
|
||||
assert mi.get("max_tokens") == 128000
|
||||
|
||||
proxy_info = _get_proxy_model_info(model=model)
|
||||
fresh_custom_model = {"model_name": "m", "litellm_params": {"model": backend}, "model_info": dict(custom_model_info)}
|
||||
proxy_info = _get_proxy_model_info(model=fresh_custom_model)
|
||||
p_mi = proxy_info["model_info"]
|
||||
assert p_mi.get("input_cost_per_token") == 0.00099
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue