mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-06 07:48:06 +00:00
fix(cost_calculator): narrow exception catch to model-not-found only
Replace bare 'except Exception' with a targeted check for the 'isn't mapped yet' message, re-raising all other exceptions so real pricing failures remain visible. Adds noqa: BLE001 to satisfy the ruff strict budget. Addresses review feedback from greptile and veria-ai bots.
This commit is contained in:
parent
ed43c74bfa
commit
47ffbcd3d8
1 changed files with 3 additions and 1 deletions
|
|
@ -606,7 +606,9 @@ def cost_per_token(
|
|||
service_tier=service_tier,
|
||||
data_residency=data_residency,
|
||||
)
|
||||
except Exception:
|
||||
except Exception as e: # noqa: BLE001
|
||||
if "isn't mapped yet" not in str(e):
|
||||
raise
|
||||
verbose_logger.debug(
|
||||
"cost_per_token: unknown model=%s, custom_llm_provider=openai. Returning 0.0, 0.0",
|
||||
model,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue