fix: resolve review budget feedback
This commit is contained in:
+11
-11
@@ -163,15 +163,15 @@ def equivalent_cost(usage: dict, model: str, price_target: str = "") -> float:
|
||||
"""Estimate comparison cost for one completed iteration."""
|
||||
try:
|
||||
from cost_model import PRICES, Usage, cost
|
||||
target = price_target or os.environ.get("PRAGENT_PRICE_TARGET", "claude-sonnet-5")
|
||||
price = PRICES.get(target)
|
||||
if price is None:
|
||||
return 0.0
|
||||
return cost(Usage(
|
||||
uncached_input=max(0, int(usage.get("input") or 0) - int(usage.get("cache_read") or 0)),
|
||||
cached_input=int(usage.get("cache_read") or 0),
|
||||
cache_writes=int(usage.get("cache_write") or 0),
|
||||
output=int(usage.get("output") or 0),
|
||||
), price)
|
||||
except Exception:
|
||||
except (ImportError, ModuleNotFoundError):
|
||||
return 0.0
|
||||
target = price_target or os.environ.get("PRAGENT_PRICE_TARGET", "claude-sonnet-5")
|
||||
price = PRICES.get(target)
|
||||
if price is None:
|
||||
return 0.0
|
||||
return cost(Usage(
|
||||
uncached_input=max(0, int(usage.get("input") or 0) - int(usage.get("cache_read") or 0)),
|
||||
cached_input=int(usage.get("cache_read") or 0),
|
||||
cache_writes=int(usage.get("cache_write") or 0),
|
||||
output=int(usage.get("output") or 0),
|
||||
), price)
|
||||
|
||||
Reference in New Issue
Block a user