Skip to content

Commit

Permalink
Fix: Rounding error showing cost (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
AvdiuAndin authored Jul 18, 2024
1 parent ece1049 commit 5c7cb7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions agentops/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import threading
import traceback
import logging
from decimal import Decimal
from decimal import Decimal, ROUND_HALF_UP
from uuid import UUID, uuid4
from typing import Optional, List, Union

Expand Down Expand Up @@ -424,7 +424,7 @@ def end_session(
"This run's cost ${}".format(
"{:.2f}".format(token_cost_d)
if token_cost_d == 0
else "{:.6f}".format(token_cost_d)
else "{:.6f}".format(token_cost_d.quantize(Decimal('0.000001'), rounding=ROUND_HALF_UP))
)
)

Expand Down

0 comments on commit 5c7cb7f

Please sign in to comment.