From 7b474ec267b0df4fb4f121ef0f59c786c459c328 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 4 Jun 2024 08:02:25 -0700 Subject: [PATCH] fix(utils.py): add coverage for azure img gen content policy violation error --- litellm/utils.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index 48ba32fafb9..4dcee6be45f 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -9838,15 +9838,19 @@ def exception_type( response=original_exception.response, ) elif ( - "invalid_request_error" in error_str - and "content_policy_violation" in error_str - ) or ( - "The response was filtered due to the prompt triggering Azure OpenAI's content management" - in error_str + ( + "invalid_request_error" in error_str + and "content_policy_violation" in error_str + ) + or ( + "The response was filtered due to the prompt triggering Azure OpenAI's content management" + in error_str + ) + or "Your task failed as a result of our safety system" in error_str ): exception_mapping_worked = True raise ContentPolicyViolationError( - message=f"AzureException ContentPolicyViolationError - {original_exception.message}", + message=f"litellm.ContentPolicyViolationError: AzureException - {original_exception.message}", llm_provider="azure", model=model, litellm_debug_info=extra_information,