mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-12 08:42:18 +00:00
fix(bedrock): consult the base model row when a regional CRIS row omits tier pricing
Some checks are pending
Cost map pins recheck / rerun-cost-map-guard (push) Waiting to run
LiteLLM Rust DB / db-queries (push) Waiting to run
LiteLLM Rust / rust-lint (push) Waiting to run
LiteLLM Rust / rust-test (push) Waiting to run
LiteLLM Rust / rust-wheel (push) Waiting to run
Terraform Provider / gofmt, vet, build, test (push) Waiting to run
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Waiting to run
Some checks are pending
Cost map pins recheck / rerun-cost-map-guard (push) Waiting to run
LiteLLM Rust DB / db-queries (push) Waiting to run
LiteLLM Rust / rust-lint (push) Waiting to run
LiteLLM Rust / rust-test (push) Waiting to run
LiteLLM Rust / rust-wheel (push) Waiting to run
Terraform Provider / gofmt, vet, build, test (push) Waiting to run
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Waiting to run
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
8928219d13
commit
05bb13d996
2 changed files with 8 additions and 3 deletions
|
|
@ -1334,14 +1334,16 @@ def bedrock_serves_service_tier(model: str, service_tier: str) -> bool:
|
|||
row for exactly the models that serve a tier, so a non-null price is the capability signal (the
|
||||
proxy normalizes every row to the full ModelInfo shape, so key presence alone means nothing). ``default``
|
||||
and ``auto`` are always served, and a model absent from the price map has no signal and is
|
||||
forwarded as before.
|
||||
forwarded as before. Regional CRIS rows (``eu.``, ``apac.``, ``us-gov.``) often omit the tier
|
||||
prices their base row carries, so the base row is consulted too.
|
||||
"""
|
||||
from litellm.litellm_core_utils.llm_cost_calc.utils import get_service_tier_cost_key
|
||||
|
||||
cost_key: Final = get_service_tier_cost_key("input_cost_per_token", service_tier)
|
||||
if cost_key == "input_cost_per_token":
|
||||
return True
|
||||
entries: Final = tuple(entry for entry in _bedrock_price_map_entries(model) if entry is not None)
|
||||
candidates: Final = (*_bedrock_price_map_entries(model), _model_cost_entry(get_bedrock_base_model(model)))
|
||||
entries: Final = tuple(entry for entry in candidates if entry is not None)
|
||||
if not entries:
|
||||
return True
|
||||
return any(entry.get(cost_key) is not None for entry in entries)
|
||||
|
|
|
|||
|
|
@ -2286,6 +2286,7 @@ _STANDARD_ONLY_ROW: Final = {
|
|||
("tiered.model-v1:0", "priority", True),
|
||||
("tiered.model-v1:0", "flex", True),
|
||||
("bedrock/us-west-2/tiered.model-v1:0", "flex", True),
|
||||
("eu.tiered.model-v1:0", "priority", True),
|
||||
("standard.model-v1:0", "priority", False),
|
||||
("standard.model-v1:0", "flex", False),
|
||||
("standard.model-v1:0", "default", True),
|
||||
|
|
@ -2298,8 +2299,10 @@ def test_bedrock_serves_service_tier_follows_price_map_tier_rows(
|
|||
) -> None:
|
||||
"""A Bedrock model serves a tier exactly when its price-map row carries a non-null price for that tier.
|
||||
The proxy expands every row to the full ModelInfo shape, so a null price (standard-only row) is no signal,
|
||||
`default` and `auto` are always served, and an unknown model keeps being forwarded."""
|
||||
`default` and `auto` are always served, and an unknown model keeps being forwarded. A regional CRIS row
|
||||
that omits the tier prices does not hide the base row that carries them."""
|
||||
monkeypatch.setitem(litellm.model_cost, "tiered.model-v1:0", dict(_TIER_PRICED_ROW))
|
||||
monkeypatch.setitem(litellm.model_cost, "eu.tiered.model-v1:0", dict(_STANDARD_ONLY_ROW))
|
||||
monkeypatch.setitem(litellm.model_cost, "standard.model-v1:0", dict(_STANDARD_ONLY_ROW))
|
||||
|
||||
assert bedrock_serves_service_tier(model, service_tier) is expected
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue