(feat) alerts proxy budgets

This commit is contained in:
ishaan-jaff 2024-01-25 10:01:32 -08:00 committed by Krrish Dholakia
parent 565531fe9e
commit 55115a75b0

View file

@ -186,7 +186,23 @@ class ProxyLogging:
type: Literal["token_budget", "user_budget", "user_and_proxy_budget"], type: Literal["token_budget", "user_budget", "user_and_proxy_budget"],
user_max_budget: float, user_max_budget: float,
user_current_spend: float, user_current_spend: float,
user_info=None,
): ):
# percent of max_budget left to spend
percent_left = (user_max_budget - user_current_spend) / user_max_budget
# check if 15% of max budget is left
if percent_left <= 0.15:
pass
# check if 5% of max budget is left
if percent_left <= 0.05:
pass
# check if crossed budget
if user_current_spend >= user_max_budget:
pass
pass pass
async def alerting_handler( async def alerting_handler(