mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-07 07:58:09 +00:00
fix(cost): read the stored breakdown total through the logging object's typed field
This commit is contained in:
parent
9a1e0f868d
commit
7520be3585
1 changed files with 2 additions and 2 deletions
|
|
@ -1506,8 +1506,8 @@ def _response_time_ms_for_cost(
|
|||
|
||||
|
||||
def _breakdown_total(litellm_logging_obj: LitellmLoggingObject | None) -> float | None:
|
||||
breakdown: Final[object] = getattr(litellm_logging_obj, "cost_breakdown", None)
|
||||
total: Final[object] = breakdown.get("total_cost") if isinstance(breakdown, Mapping) else None
|
||||
breakdown: Final = None if litellm_logging_obj is None else litellm_logging_obj.cost_breakdown
|
||||
total: Final[object] = None if breakdown is None else breakdown.get("total_cost")
|
||||
return float(total) if isinstance(total, (int, float)) and not isinstance(total, bool) else None
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue