Merge pull request #3828 from BerriAI/litellm_outage_alerting

fix(slack_alerting.py): support region based outage alerting
This commit is contained in:
Krish Dholakia 2024-05-24 19:13:17 -07:00 committed by GitHub
commit d25ed9c4d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 414 additions and 78 deletions

View file

@ -420,6 +420,8 @@ def mock_completion(
api_key="mock-key",
)
if isinstance(mock_response, Exception):
if isinstance(mock_response, openai.APIError):
raise mock_response
raise litellm.APIError(
status_code=500, # type: ignore
message=str(mock_response),
@ -463,7 +465,9 @@ def mock_completion(
return model_response
except:
except Exception as e:
if isinstance(e, openai.APIError):
raise e
traceback.print_exc()
raise Exception("Mock completion response failed")
@ -864,6 +868,7 @@ def completion(
user=user,
optional_params=optional_params,
litellm_params=litellm_params,
custom_llm_provider=custom_llm_provider,
)
if mock_response:
return mock_completion(