mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-01 02:02:20 +00:00
test(model_prices): require a priced Bedrock base row when its cross-region profile is priced
This commit is contained in:
parent
61378665b8
commit
e44b7d8539
1 changed files with 27 additions and 0 deletions
|
|
@ -319,6 +319,33 @@ def test_get_model_info_bedrock_cross_region_capability_parity():
|
|||
assert checked > 0, "no cross-region bedrock profiles found - the filter is inert"
|
||||
|
||||
|
||||
|
||||
def test_get_model_info_bedrock_priced_cross_region_profile_has_priced_base():
|
||||
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
|
||||
litellm.model_cost = litellm.get_model_cost_map(url="")
|
||||
|
||||
prefixes = ("us.", "eu.", "apac.", "us-gov.", "au.", "global.")
|
||||
checked = 0
|
||||
|
||||
for k, v in litellm.model_cost.items():
|
||||
if not str(v.get("litellm_provider", "")).startswith("bedrock"):
|
||||
continue
|
||||
base_model_key = next(
|
||||
(k[len(p) :] for p in prefixes if k.startswith(p)),
|
||||
None,
|
||||
)
|
||||
if base_model_key is None or base_model_key not in litellm.model_cost:
|
||||
continue
|
||||
checked += 1
|
||||
base = litellm.model_cost[base_model_key]
|
||||
for cost_key in ("input_cost_per_token", "output_cost_per_token"):
|
||||
if (v.get(cost_key) or 0) > 0:
|
||||
assert (
|
||||
base.get(cost_key) or 0
|
||||
) > 0, f"{k} charges {cost_key} but its base {base_model_key} is free"
|
||||
|
||||
assert checked > 0, "no cross-region bedrock profiles found - the filter is inert"
|
||||
|
||||
def test_get_model_info_huggingface_models(monkeypatch):
|
||||
from litellm import Router
|
||||
from litellm.types.router import ModelGroupInfo
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue