fix(audit): handle None values in dynamic pricing registry
This commit is contained in:
1 parent
e60c74c182
commit
e63af354ec
1 file changed
+4
-4
@@ -101,10 +101,10 @@ class Tools:
|
|||||||
if not pricing: return ""
|
if not pricing: return ""
|
||||||
uncached = max(0, prompt - cached)
|
uncached = max(0, prompt - cached)
|
||||||
actual_output = max(0, completion - reasoning)
|
actual_output = max(0, completion - reasoning)
|
||||||
calc = (cached * pricing.get("input_cached", 0)) + \
|
calc = (cached * (pricing.get("input_cached") or 0)) + \
|
||||||
(uncached * pricing.get("input", 0)) + \
|
(uncached * (pricing.get("input") or 0)) + \
|
||||||
(actual_output * pricing.get("output", 0)) + \
|
(actual_output * (pricing.get("output") or 0)) + \
|
||||||
(reasoning * pricing.get("reasoning", pricing.get("output", 0)))
|
(reasoning * (pricing.get("reasoning") or pricing.get("output") or 0))
|
||||||
delta = reported_cost - calc
|
delta = reported_cost - calc
|
||||||
symbol = "⚠️" if abs(delta) > 0.005 else "✓"
|
symbol = "⚠️" if abs(delta) > 0.005 else "✓"
|
||||||
return f" [calc: ${calc:.4f} {symbol}]"
|
return f" [calc: ${calc:.4f} {symbol}]"
|
||||||
|
|||||||
Reference in new issue
Block a user