mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
perf(cost): short-circuit above-threshold key discovery with cheap substring pre-filter
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
6a2a7a3930
commit
26a2704010
1 changed files with 2 additions and 1 deletions
|
|
@ -248,10 +248,11 @@ def _get_token_base_cost(
|
|||
threshold_keys = [
|
||||
k
|
||||
for k in model_info
|
||||
if k.startswith(_ABOVE_THRESHOLD_KEY_PREFIXES)
|
||||
if "_above_" in k
|
||||
and k.endswith("_tokens")
|
||||
and "_above_1hr" not in k
|
||||
and not k.endswith(_SERVICE_TIER_SUFFIXES)
|
||||
and k.startswith(_ABOVE_THRESHOLD_KEY_PREFIXES)
|
||||
]
|
||||
if not threshold_keys:
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue