Skip to content

Commit

Permalink
fix(utils.py): add coverage for azure img gen content policy violatio…
Browse files Browse the repository at this point in the history
…n error
  • Loading branch information
krrishdholakia committed Jun 4, 2024
1 parent 0d16ecc commit 7b474ec
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions litellm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7b474ec

Please sign in to comment.