diff --git a/litellm/integrations/slack_alerting.py b/litellm/integrations/slack_alerting.py index b9c05d8bf8..adc56698c3 100644 --- a/litellm/integrations/slack_alerting.py +++ b/litellm/integrations/slack_alerting.py @@ -152,7 +152,6 @@ class SlackAlerting: raise e def _get_deployment_latencies_to_alert(self, metadata=None): - if metadata is None: return None @@ -447,12 +446,6 @@ class SlackAlerting: level: str - Low|Medium|High - if calls might fail (Medium) or are failing (High); Currently, no alerts would be 'Low'. message: str - what is the alert about """ - print( - "inside send alert for slack, message: ", - message, - "self.alerting: ", - self.alerting, - ) if self.alerting is None: return diff --git a/litellm/router_strategy/lowest_latency.py b/litellm/router_strategy/lowest_latency.py index 221a666dca..19780f708d 100644 --- a/litellm/router_strategy/lowest_latency.py +++ b/litellm/router_strategy/lowest_latency.py @@ -345,6 +345,21 @@ class LowestLatencyLoggingHandler(CustomLogger): if isinstance(_call_latency, float): total += _call_latency item_latency = total / len(item_latency) + + # -------------- # + # Debugging Logic + # -------------- # + # We use _latency_per_deployment to log to langfuse, slack - this is not used to make a decision on routing + # this helps a user to debug why the router picked a specfic deployment # + _deployment_api_base = _deployment.get("litellm_params", {}).get( + "api_base", "" + ) + if _deployment_api_base is not None: + _latency_per_deployment[_deployment_api_base] = item_latency + # -------------- # + # End of Debugging Logic + # -------------- # + if item_latency == 0: deployment = _deployment break @@ -356,12 +371,6 @@ class LowestLatencyLoggingHandler(CustomLogger): elif item_latency < lowest_latency: lowest_latency = item_latency deployment = _deployment - - # _latency_per_deployment is used for debuggig - _deployment_api_base = _deployment.get("litellm_params", {}).get( - "api_base", "" - ) - _latency_per_deployment[_deployment_api_base] = item_latency if request_kwargs is not None and "metadata" in request_kwargs: request_kwargs["metadata"][ "_latency_per_deployment"