From bd2f46fd7562176a0e1e046338ce42d19dac0a49 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 13 May 2024 14:02:43 -0700 Subject: [PATCH] fix(slack_alerting.py): if 'turn_off_message_logging' enabled, do not log the message to logging integration --- litellm/integrations/slack_alerting.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/litellm/integrations/slack_alerting.py b/litellm/integrations/slack_alerting.py index 74fce079990..7252967d9c0 100644 --- a/litellm/integrations/slack_alerting.py +++ b/litellm/integrations/slack_alerting.py @@ -238,6 +238,8 @@ class SlackAlerting(CustomLogger): end_time=end_time, ) ) + if litellm.turn_off_message_logging: + messages = "Message not logged. `litellm.turn_off_message_logging=True`." request_info = f"\nRequest Model: `{model}`\nAPI Base: `{api_base}`\nMessages: `{messages}`" slow_message = f"`Responses are slow - {round(time_difference_float,2)}s response time > Alerting threshold: {self.alerting_threshold}s`" if time_difference_float > self.alerting_threshold: @@ -460,6 +462,11 @@ class SlackAlerting(CustomLogger): messages = messages[:100] except: messages = "" + + if litellm.turn_off_message_logging: + messages = ( + "Message not logged. `litellm.turn_off_message_logging=True`." + ) request_info = f"\nRequest Model: `{model}`\nMessages: `{messages}`" else: request_info = ""