From 02fc507b01e9eaa30dec376d6cb6188a5c4aa105 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 20 May 2024 14:26:30 -0700 Subject: [PATCH] fix divide by 0 bug --- litellm/integrations/slack_alerting.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/integrations/slack_alerting.py b/litellm/integrations/slack_alerting.py index 227db079db..bd07e5dd7a 100644 --- a/litellm/integrations/slack_alerting.py +++ b/litellm/integrations/slack_alerting.py @@ -875,7 +875,8 @@ Model Info: if isinstance(response_obj, litellm.ModelResponse): completion_tokens = response_obj.usage.completion_tokens - final_value = float(response_s.total_seconds() / completion_tokens) + if completion_tokens is not None and completion_tokens > 0: + final_value = float(response_s.total_seconds() / completion_tokens) await self.async_update_daily_reports( DeploymentMetrics(