fix(proxy/utils.py): fix slack alerting to only raise alerts for llm api exceptions

don't spam for bad user requests. Closes https://github.com/BerriAI/litellm/issues/3395
This commit is contained in:
Krrish Dholakia 2024-05-02 17:18:21 -07:00
parent 5baeeec899
commit fdc4fdb91a
3 changed files with 78 additions and 10 deletions

View file

@ -387,15 +387,21 @@ class ProxyLogging:
"""
### ALERTING ###
if "llm_exceptions" not in self.alert_types:
return
asyncio.create_task(
self.alerting_handler(
message=f"LLM API call failed: {str(original_exception)}",
level="High",
alert_type="llm_exceptions",
if "llm_exceptions" in self.alert_types and not isinstance(
original_exception, HTTPException
):
"""
Just alert on LLM API exceptions. Do not alert on user errors
Related issue - https://github.com/BerriAI/litellm/issues/3395
"""
asyncio.create_task(
self.alerting_handler(
message=f"LLM API call failed: {str(original_exception)}",
level="High",
alert_type="llm_exceptions",
)
)
)
for callback in litellm.callbacks:
try: