mirror of
https://github.com/AgentOps-AI/tokencost.git
synced 2024-06-22 04:30:40 +03:00
fix: 🐛 Skip updating estimates if event isn't a prompt nor message
This commit is contained in:
@@ -39,6 +39,8 @@ class TokenCostHandler(BaseCallbackHandler):
|
||||
estimates = calculate_all_costs_and_tokens(
|
||||
messages_str, response, self.model
|
||||
)
|
||||
else:
|
||||
return
|
||||
|
||||
self.prompt_cost += estimates["prompt_cost"]
|
||||
self.completion_cost += estimates["completion_cost"]
|
||||
|
||||
Reference in New Issue
Block a user