mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix(ptu): zero the Maps grounding rate on PTU deployments
This commit is contained in:
parent
241daa4cb7
commit
31f0d82f00
3 changed files with 14 additions and 3 deletions
|
|
@ -28,6 +28,7 @@ PTU_ZEROED_PRICING_FIELDS: Final = tuple(f for f in MirroredPricingParams.model_
|
|||
"cache_creation_input_token_cost_above_1hr",
|
||||
"cache_creation_input_token_cost_above_200k_tokens",
|
||||
"cache_read_input_token_cost_above_200k_tokens",
|
||||
"google_maps_grounding_cost_per_query",
|
||||
)
|
||||
# tiered_pricing is emptied rather than zeroed: its tiers outrank the zeros written beside
|
||||
# them, so a zero here would leave the cost map's tiers billing the traffic the reserved
|
||||
|
|
|
|||
|
|
@ -358,9 +358,10 @@ def _validate_ptu_model_info(model_info: Mapping[str, object]) -> None:
|
|||
raise HTTPException(status_code=400, detail=error)
|
||||
|
||||
|
||||
# The mirrored per-token pricing fields plus the three remaining fields
|
||||
# Router._inherit_builtin_cache_pricing back-fills from the public cost map. An unset field is
|
||||
# what that back-fill targets, so a field left out here is one a PTU deployment still bills.
|
||||
# The mirrored per-token pricing fields plus the remaining rates the public cost map or a
|
||||
# provider default would otherwise supply (the cache back-fills, the Maps grounding rate). An
|
||||
# unset field falls back to those sources, so a field left out here is one a PTU deployment
|
||||
# still bills.
|
||||
# tiered_pricing is the one mirrored field that is a table of ranges, not a rate, so it is stored
|
||||
# empty (see _PTU_EMPTIED_PRICING_FIELDS): its tiers outrank the zeros written beside them, so
|
||||
# dropping it would leave the cost map's tiers billing the traffic the reserved capacity covers.
|
||||
|
|
|
|||
|
|
@ -134,6 +134,15 @@ def test_the_search_context_table_is_zeroed_in_place_on_every_deployment():
|
|||
assert dict(override[field]) == dict.fromkeys(SEARCH_CONTEXT_SIZES, 0.0)
|
||||
|
||||
|
||||
def test_the_maps_grounding_rate_is_zeroed_on_every_deployment():
|
||||
"""An absent rate falls back to the Maps default rather than free, so it is written
|
||||
even when the deployment never declared one."""
|
||||
override = _with_flag(_VALID)
|
||||
|
||||
assert override is not None
|
||||
assert override["google_maps_grounding_cost_per_query"] == 0.0
|
||||
|
||||
|
||||
def test_a_declared_table_does_not_become_a_scalar():
|
||||
"""Zeroing it as a plain 0.0 would leave the provider's reader without a table to
|
||||
consult, which is the same as absent."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue