From f417495b7b062a4b846b4bd8f4827e0b7c9015bd Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 20 May 2024 14:59:06 -0700 Subject: [PATCH] fix - only adding alerting callbacks when alerting is on --- litellm/proxy/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 09e772e10b1..1bafdd89e34 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -131,7 +131,13 @@ class ProxyLogging: alerting_args=alerting_args, ) - if "daily_reports" in self.alert_types: + if ( + self.alerting is not None + and "slack" in self.alerting + and "daily_reports" in self.alert_types + ): + # NOTE: ENSURE we only add callbacks when alerting is on + # We should NOT add callbacks when alerting is off litellm.callbacks.append(self.slack_alerting_instance) # type: ignore if redis_cache is not None: