
openai
#10079
safety_violation_error
Request rejected due to a violation of safety system guidelines. Your prompt may contain disallowed content.
This error has been identified and solved.
Reason
The 400 status error in the OpenAI API, specifically the message "Your request was rejected as a result of our safety system. Your prompt may contain text that is not allowed by our safety system," indicates that the prompt you are sending violates OpenAI's content safety policies.
Here are the key reasons for this error:
Content Filtering: OpenAI's safety system uses neural multi-class classification models to detect and filter harmful content, including categories such as hate, sexual content, violence, and self-harm. If your prompt falls into one of these categories, it will be rejected.
Restricted Topics: Certain topics, including those related to public figures or other sensitive subjects, may be restricted by OpenAI's safety policies.
This rejection is a measure to ensure that the API is used responsibly and in compliance with OpenAI's guidelines.
Solution
To resolve the 400 status error in the OpenAI API due to the safety system, you need to ensure your prompts comply with OpenAI's content safety policies. Here are the steps to take:
Review and Adjust Your Prompt
Check your prompt for any content that falls under restricted categories such as hate, sexual content, violence, or self-harm.
Ensure your prompt does not contain text that is not allowed by OpenAI's safety system.
Modify Your Request
Remove or modify any part of the prompt that violates OpenAI's safety guidelines.
Test your prompt again after making the necessary adjustments.
Configure Content Filters (if applicable)
If you are using Azure OpenAI Service, you may need to adjust the content filter settings to align with your specific use case, though this typically requires approval for modifications.
By ensuring your prompts are compliant with OpenAI's safety policies, you can prevent the 400 error and successfully execute your API requests.
Suggested Links
https://cheatsheet.md/chatgpt-cheatsheet/openai-api-error-axioserror-request-failed-status-code-400
https://community.openai.com/t/your-request-was-rejected-as-a-result-of-our-safety-system-your-prompt-may-contain-text-that-is-not-allowed-by-our-safety-system/285641
https://community.openai.com/t/error-in-image-generation-api-rejection-by-safety-system/232241
https://community.openai.com/t/intermittent-error-an-unexpected-error-occurred-error-code-400-error-message-this-model-does-not-support-specifying-dimensions-type-invalid-request-error-param-none-code-none/955807
https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/content-filter?tabs=warning%2Cuser-prompt%2Cpython-new
https://github.com/MicrosoftDocs/azure-ai-docs/blob/main/articles/ai-services/openai/concepts/content-filter.md
https://github.com/Nutlope/aicommits/issues/137
https://community.openai.com/t/getting-400-response-with-already-working-code/509212
https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/content-filters