From 5d24b47d2b621153fab0e0936bc84bf53a3eef36 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 20 May 2024 16:23:48 -0700 Subject: [PATCH 1/3] fix standardize llm exception alert to msg: `value` --- litellm/proxy/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 09e772e10b1..3dac1563cb8 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -436,7 +436,7 @@ class ProxyLogging: asyncio.create_task( self.alerting_handler( - message=f"LLM API call failed: {exception_str}", + message=f"LLM API call failed: `{exception_str}`", level="High", alert_type="llm_exceptions", request_data=request_data, From 8263d15ca354291f2fb07de6a8603f60d8630886 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 20 May 2024 16:26:11 -0700 Subject: [PATCH 2/3] fix - standardize slack alerting format --- litellm/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index 8ac6b58d846..c12741a978c 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -8315,18 +8315,18 @@ def exception_type( _deployment = _metadata.get("deployment") extra_information = f"\nModel: {model}" if _api_base: - extra_information += f"\nAPI Base: {_api_base}" + extra_information += f"\nAPI Base: `{_api_base}`" if messages and len(messages) > 0: - extra_information += f"\nMessages: {messages}" + extra_information += f"\nMessages: `{messages}`" if _model_group is not None: - extra_information += f"\nmodel_group: {_model_group}\n" + extra_information += f"\nmodel_group: `{_model_group}`\n" if _deployment is not None: - extra_information += f"\ndeployment: {_deployment}\n" + extra_information += f"\ndeployment: `{_deployment}`\n" if _vertex_project is not None: - extra_information += f"\nvertex_project: {_vertex_project}\n" + extra_information += f"\nvertex_project: `{_vertex_project}`\n" if _vertex_location is not None: - extra_information += f"\nvertex_location: {_vertex_location}\n" + extra_information += f"\nvertex_location: `{_vertex_location}`\n" # on litellm proxy add key name + team to exceptions extra_information = _add_key_name_and_team_to_alert( From f11de863f6553dab0c1ecf3e3d842856719cc318 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 20 May 2024 16:29:16 -0700 Subject: [PATCH 3/3] fix - standardize format of exceptions occuring on slack alerts --- litellm/router.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/router.py b/litellm/router.py index 6400ff64e23..a45b9d39627 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -3775,7 +3775,7 @@ class Router: ) asyncio.create_task( proxy_logging_obj.slack_alerting_instance.send_alert( - message=f"Router: Cooling down Deployment:\nModel Name: {_model_name}\nAPI Base: {_api_base}\n{self.cooldown_time} seconds. Got exception: {str(exception_status)}. Change 'cooldown_time' + 'allowed_fails' under 'Router Settings' on proxy UI, or via config - https://docs.litellm.ai/docs/proxy/reliability#fallbacks--retries--timeouts--cooldowns", + message=f"Router: Cooling down Deployment:\nModel Name: `{_model_name}`\nAPI Base: `{_api_base}`\nCooldown Time: `{self.cooldown_time}` seconds\nException Status Code: `{str(exception_status)}`\n\nChange 'cooldown_time' + 'allowed_fails' under 'Router Settings' on proxy UI, or via config - https://docs.litellm.ai/docs/proxy/reliability#fallbacks--retries--timeouts--cooldowns", alert_type="cooldown_deployment", level="Low", )