mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix(slack_alerting.py): check if webhook is in alerting list before triggering it
Fixes https://github.com/BerriAI/litellm/issues/4193
This commit is contained in:
parent
cb7521b11f
commit
74d8605f5c
1 changed files with 10 additions and 1 deletions
|
|
@ -788,7 +788,13 @@ class SlackAlerting(CustomLogger):
|
|||
response_cost: Optional[float],
|
||||
max_budget: Optional[float],
|
||||
):
|
||||
if end_user_id is not None and token is not None and response_cost is not None:
|
||||
if (
|
||||
self.alerting is not None
|
||||
and "webhook" in self.alerting
|
||||
and end_user_id is not None
|
||||
and token is not None
|
||||
and response_cost is not None
|
||||
):
|
||||
# log customer spend
|
||||
event = WebhookEvent(
|
||||
spend=response_cost,
|
||||
|
|
@ -1195,6 +1201,9 @@ Model Info:
|
|||
Currently only implemented for budget alerts
|
||||
|
||||
Returns -> True if sent, False if not.
|
||||
|
||||
Raises Exception
|
||||
- if WEBHOOK_URL is not set
|
||||
"""
|
||||
|
||||
webhook_url = os.getenv("WEBHOOK_URL", None)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue