forked from phoenix/litellm-mirror
fix(utils.py): add coverage for azure img gen content policy violation error
This commit is contained in:
parent
0d16ecc956
commit
7b474ec267
1 changed files with 10 additions and 6 deletions
|
@ -9838,15 +9838,19 @@ def exception_type(
|
||||||
response=original_exception.response,
|
response=original_exception.response,
|
||||||
)
|
)
|
||||||
elif (
|
elif (
|
||||||
|
(
|
||||||
"invalid_request_error" in error_str
|
"invalid_request_error" in error_str
|
||||||
and "content_policy_violation" in error_str
|
and "content_policy_violation" in error_str
|
||||||
) or (
|
)
|
||||||
|
or (
|
||||||
"The response was filtered due to the prompt triggering Azure OpenAI's content management"
|
"The response was filtered due to the prompt triggering Azure OpenAI's content management"
|
||||||
in error_str
|
in error_str
|
||||||
|
)
|
||||||
|
or "Your task failed as a result of our safety system" in error_str
|
||||||
):
|
):
|
||||||
exception_mapping_worked = True
|
exception_mapping_worked = True
|
||||||
raise ContentPolicyViolationError(
|
raise ContentPolicyViolationError(
|
||||||
message=f"AzureException ContentPolicyViolationError - {original_exception.message}",
|
message=f"litellm.ContentPolicyViolationError: AzureException - {original_exception.message}",
|
||||||
llm_provider="azure",
|
llm_provider="azure",
|
||||||
model=model,
|
model=model,
|
||||||
litellm_debug_info=extra_information,
|
litellm_debug_info=extra_information,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue