mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
refactor(cost_calculator): add debug logging on fallback to param-size pricing
Address Greptile review: bare except was silently swallowing errors. Log the original exception at debug level so fallbacks are traceable
This commit is contained in:
parent
282f73b0cd
commit
7a8c1c3719
1 changed files with 8 additions and 1 deletions
|
|
@ -60,6 +60,13 @@ def cost_per_token(model: str, usage: Usage) -> Tuple[float, float]:
|
|||
"""
|
||||
try:
|
||||
return generic_cost_per_token(model=model, usage=usage, custom_llm_provider="fireworks_ai")
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
from litellm._logging import verbose_logger
|
||||
|
||||
verbose_logger.debug(
|
||||
"fireworks_ai cost_per_token: model=%s not found, falling back to param-size pricing. Error: %s",
|
||||
model,
|
||||
str(e),
|
||||
)
|
||||
base_model = get_base_model_for_pricing(model_name=model)
|
||||
return generic_cost_per_token(model=base_model, usage=usage, custom_llm_provider="fireworks_ai")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue