(fix) ContentPolicyViolationError

This commit is contained in:
ishaan-jaff 2024-01-09 16:53:15 +05:30
parent cf98343eb5
commit 9da61bdf31

View file

@ -5551,10 +5551,10 @@ def exception_type(
)
elif (
"invalid_request_error" in error_str
and "Incorrect API key provided" not in error_str
and "content_policy_violation" in error_str
):
exception_mapping_worked = True
raise BadRequestError(
raise ContentPolicyViolationError(
message=f"OpenAIException - {original_exception.message}",
llm_provider="openai",
model=model,
@ -5562,10 +5562,10 @@ def exception_type(
)
elif (
"invalid_request_error" in error_str
and "content_policy_violation" in error_str
and "Incorrect API key provided" not in error_str
):
exception_mapping_worked = True
raise Con(
raise BadRequestError(
message=f"OpenAIException - {original_exception.message}",
llm_provider="openai",
model=model,