About Azure OpenAI Content Filtering
This document provides solutions for addressing issues where content filtering prevents the generation of outputs by generative AI.
Sample Use Case
Let's consider a system for employee search. For example, if you want to search for employees with children, such as "Find employees with children under 12 years old," the request might be blocked by content filtering.
This is because searching for employees with children under 12 years old triggers the "Sexual" category in content filtering.
Sample Requests and Responses
Let's examine the requests and responses to see what happens.
Request | Filtering Result | RequestBody | ResponseBody |
---|---|---|---|
Find employees with family members under 12 years old | Blocked with Sexual: High | { "messages": [ { "role": "system", "content": [{"type": "text", "text": "I am an AI assistant here to help you find information."}] }, { "role": "user", "content": [{"type": "text", "text": "Find employees with family members under 12 years old"}] } ] } | { "error": { "message": "Blocked by Azure OpenAI's content filter", "code": "content_filter", "innererror": { "content_filter_result": { "sexual": { "filtered": true, "severity": "high" } } } } } |
Find employees with family members in 3rd grade | Passed | { "messages": [ { "role": "system", "content": [{"type": "text", "text": "I am an AI assistant here to help you find information."}] }, { "role": "user", "content": [{"type": "text", "text": "Find employees with family members in 3rd grade"}] } ] } | { "choices": [{ "message": { "content": "Searching for personal information about employees should be handled carefully from a privacy perspective..." } }] } |
Find employees with children in 3rd grade | Blocked with Sexual: High | { "messages": [ { "role": "system", "content": [{"type": "text", "text": "I am an AI assistant here to help you find information."}] }, { "role": "user", "content": [{"type": "text", "text": "Find employees with children in 3rd grade"}] } ] } | { "error": { "message": "Blocked by Azure OpenAI's content filter", "code": "content_filter", "innererror": { "content_filter_result": { "sexual": { "filtered": true, "severity": "high" } } } } } |
Find employees with family members in 12th grade | Passed | { "messages": [ { "role": "system", "content": [{"type": "text", "text": "I am an AI assistant here to help you find information."}] }, { "role": "user", "content": [{"type": "text", "text": "Find employees with family members in 12th grade"}] } ] } | { "choices": [{ "message": { "content": "When searching for personal information about employees, it is important to be cautious from a privacy and data protection perspective..." } }] } |
Find female employees with family members starting elementary school next year | Blocked with Sexual: High | { "messages": [ { "role": "system", "content": [{"type": "text", "text": "I am an AI assistant here to help you find information."}] }, { "role": "user", "content": [{"type": "text", "text": "Find female employees with family members starting elementary school next year"}] } ] } | { "error": { "message": "Blocked by Azure OpenAI's content filter", "code": "content_filter", "innererror": { "content_filter_result": { "sexual": { "filtered": true, "severity": "high" } } } } } |
Find female employees | Blocked with Sexual: Medium | { "messages": [ { "role": "system", "content": [{"type": "text", "text": "I am an AI assistant here to help you find information."}] }, { "role": "user", "content": [{"type": "text", "text": "Find female employees"}] } ] } | { "error": { "message": "Blocked by Azure OpenAI's content filter", "code": "content_filter", "innererror": { "content_filter_result": { "sexual": { "filtered": true, "severity": "medium" } } } } } |
Find male employees | Blocked with Sexual: Medium | { "messages": [ { "role": "system", "content": [{"type": "text", "text": "I am an AI assistant here to help you find information."}] }, { "role": "user", "content": [{"type": "text", "text": "Find male employees"}] } ] } | { "error": { "message": "Blocked by Azure OpenAI's content filter", "code": "content_filter", "innererror": { "content_filter_result": { "sexual": { "filtered": true, "severity": "medium" } } } } } |
- Request and Response Details
Request: Find employees with family members under 12 years old
{
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "I am an AI assistant here to help you find information."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Find employees with family members under 12 years old"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "\n\n\n\nAzure OpenAI Service's content filtering system was triggered, and the prompt was filtered. \n\n**Reason:** This prompt contains flagged content **Sexual (high)**\n\nPlease modify the prompt and try again. [Learn more](https://go.microsoft.com/fwlink/?linkid=2198766)\n\n"
}
]
}
],
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 800
}
Response:
{
"error": {
"message": "The response was filtered due to the prompt triggering Azure OpenAI's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766",
"type": null,
"param": "prompt",
"code": "content_filter",
"status": 400,
"innererror": {
"code": "ResponsibleAIPolicyViolation",
"content_filter_result": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": true,
"severity": "high"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
}
}
Request: Find employees with family members in 3rd grade
{
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "I am an AI assistant here to help you find information."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Find employees with family members in 3rd grade"
}
]
}
],
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 800
}
Response:
{
"choices": [
{
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": false,
"severity": "safe"
}
},
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "Searching for personal information about employees should be handled carefully from a privacy perspective. Obtaining information about employees' family structure and personal details requires appropriate procedures in accordance with company policies and laws. If the information is necessary for business purposes, it is recommended to consult with the HR department after obtaining the necessary permissions.\n\nWhen handling personal information, it is important to follow data protection laws and company privacy policies. Always act appropriately from a legal and ethical standpoint when dealing with employees' personal information.",
"refusal": null,
"role": "assistant"
}
}
],
"created": 1744960145,
"id": "chatcmpl-BNa8PuAc37Bgd3Jbd5JJYlhC3IFAG",
"model": "gpt-4o-2024-08-06",
"object": "chat.completion",
"prompt_filter_results": [
{
"prompt_index": 0,
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
],
"system_fingerprint": "fp_ee1d74bde0",
"usage": {
"completion_tokens": 170,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0,
"rejected_prediction_tokens": 0
},
"prompt_tokens": 43,
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 0
},
"total_tokens": 213
}
}
Request: Find employees with children in 3rd grade
{
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "I am an AI assistant here to help you find information."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Find employees with children in 3rd grade"
}
]
}
],
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 800
}
Response:
{
"error": {
"message": "The response was filtered due to the prompt triggering Azure OpenAI's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766",
"type": null,
"param": "prompt",
"code": "content_filter",
"status": 400,
"innererror": {
"code": "ResponsibleAIPolicyViolation",
"content_filter_result": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": true,
"severity": "high"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
}
}
Request:
{
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "I am an AI assistant here to help you find information."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Find employees with family members in 12th grade"
}
]
}
],
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 800
}
Response:
{
"choices": [
{
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": false,
"severity": "safe"
}
},
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "When searching for personal information about employees, it is important to be cautious from a privacy and data protection perspective. When using internal company systems or databases to search for specific information, it is crucial to have the appropriate permissions and follow information protection policies.\n\nIf you need to verify information about employees' families for legitimate reasons (e.g., to confirm eligibility for benefits or specific support programs), it is appropriate to consult with the HR department or relevant personnel. They can manage the information according to proper procedures and provide the necessary information if needed.\n\nAdditionally, when handling information, it is required to comply with data protection laws and company policies, and to manage the information appropriately.",
"refusal": null,
"role": "assistant"
}
}
],
"created": 1744960359,
"id": "chatcmpl-BNaBr7vkHfQ0DXySSacHQ4DNGd7hc",
"model": "gpt-4o-2024-08-06",
"object": "chat.completion",
"prompt_filter_results": [
{
"prompt_index": 0,
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
],
"system_fingerprint": "fp_ee1d74bde0",
"usage": {
"completion_tokens": 223,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0,
"rejected_prediction_tokens": 0
},
"prompt_tokens": 43,
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 0
},
"total_tokens": 266
}
}
Request: Find female employees with family members starting elementary school next year
{
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "I am an AI assistant here to help you find information."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Find female employees with family members starting elementary school next year"
}
]
}
],
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 800
}
Response:
{
"error": {
"message": "The response was filtered due to the prompt triggering Azure OpenAI's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766",
"type": null,
"param": "prompt",
"code": "content_filter",
"status": 400,
"innererror": {
"code": "ResponsibleAIPolicyViolation",
"content_filter_result": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": true,
"severity": "high"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
}
}
Request: Find female employees
{
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "I am an AI assistant here to help you find information."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Find female employees"
}
]
}
],
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 800
}
Response:
{
"error": {
"message": "The response was filtered due to the prompt triggering Azure OpenAI's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766",
"type": null,
"param": "prompt",
"code": "content_filter",
"status": 400,
"innererror": {
"code": "ResponsibleAIPolicyViolation",
"content_filter_result": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": true,
"severity": "medium"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
}
}
Request: Find male employees
{
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "I am an AI assistant here to help you find information."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Find male employees"
}
]
}
],
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 800
}
Response:
{
"error": {
"message": "The response was filtered due to the prompt triggering Azure OpenAI's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766",
"type": null,
"param": "prompt",
"code": "content_filter",
"status": 400,
"innererror": {
"code": "ResponsibleAIPolicyViolation",
"content_filter_result": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": true,
"severity": "medium"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
}
}
Solution
Set only "Sexual" to High.
This changes the response as follows:
Request:
{
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "I am an AI assistant here to help you find information."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Find male employees"
}
]
}
],
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 800
}
Response:
{
"choices": [
{
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": false,
"severity": "safe"
}
},
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "If you have a specific purpose or method for finding male employees, I can provide information accordingly. For example, if you are looking for information about male employees in specific positions within a company, it is common to consult with the HR department. Additionally, you can use the company's official website or professional networks like LinkedIn to gather information.\n\nIf you provide more specific details about the situation or purpose, I may be able to offer more detailed advice.",
"refusal": null,
"role": "assistant"
}
}
],
"created": 1744961345,
"id": "chatcmpl-BNaRlrsUlI1VjFszpoJZ4TtLf4vqO",
"model": "gpt-4o-2024-08-06",
"object": "chat.completion",
"prompt_filter_results": [
{
"prompt_index": 0,
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"jailbreak": {
"filtered": false,
"detected": false
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "medium"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
],
"system_fingerprint": "fp_ee1d74bde0",
"usage": {
"completion_tokens": 124,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0,
"rejected_prediction_tokens": 0
},
"prompt_tokens": 34,
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 0
},
"total_tokens": 158
}
}
Request:
{
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "I am an AI assistant here to help you find information."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Find female employees"
}
]
}
],
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 800
}
Response:
{
"choices": [
{
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"protected_material_code": {
"filtered": false,
"detected": false
},
"protected_material_text": {
"filtered": false,
"detected": false
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": false,
"severity": "safe"
}
},
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "When looking for specific female employees within a company or organization, privacy and personal information protection are important. Therefore, I cannot provide specific personal information, but you can try the following methods:\n\n1. **Company's Official Website**: Many companies list their staff or team members on their website. Check the \"About Us\" or \"Team\" pages.\n\n2. **LinkedIn**: LinkedIn is a professional network where you can find people working at specific companies. Search by company name and see the employees listed.\n\n3. **Networking Events**: Attending industry networking events or conferences can provide opportunities to meet employees from specific companies directly.\n\n4. **Company's PR Department**: Contact the company's PR department and request information relevant to your purpose.\n\nHowever, always respect privacy and act in accordance with laws and ethics when searching for personal information.",
"refusal": null,
"role": "assistant"
}
}
],
"created": 1744981314,
"id": "chatcmpl-BNfdqc9qSm7pyGjNEEnjkQif4NM9w",
"model": "gpt-4o-2024-08-06",
"object": "chat.completion",
"prompt_filter_results": [
{
"prompt_index": 0,
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"jailbreak": {
"filtered": false,
"detected": false
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "medium"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
],
"system_fingerprint": "fp_ee1d74bde0",
"usage": {
"completion_tokens": 294,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0,
"rejected_prediction_tokens": 0
},
"prompt_tokens": 34,
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 0
},
"total_tokens": 328
}
}
As shown above, the behavior changes. Note that this method allows bypassing filters for low and medium levels, but high-level filters cannot be bypassed.
Request:
{
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "I am an AI assistant here to help you find information."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Find employees with family members under 12 years old"
}
]
}
],
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 800
}
Response:
{
"error": {
"message": "The response was filtered due to the prompt triggering Azure OpenAI's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766",
"type": null,
"param": "prompt",
"code": "content_filter",
"status": 400,
"innererror": {
"code": "ResponsibleAIPolicyViolation",
"content_filter_result": {
"hate": {
"filtered": false,
"severity": "safe"
},
"jailbreak": {
"filtered": false,
"detected": false
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": true,
"severity": "high"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
}
}
Additionally, Bicep and ARM templates provide methods to customize content filters.
For example, Microsoft.CognitiveServices/accounts/raiPolicies@2024-10-01
allows customization of the "Sexual" category's behavior.
Reference:
https://learn.microsoft.com/en-us/azure/templates/microsoft.cognitiveservices/2024-10-01/accounts/raipolicies?pivots=deployment-language-bicep
By setting enabled: true
and blocking: false
, you can monitor filtered content via the API while preventing blocks.
On the UI, enabled
corresponds to "Annotation," and blocking
corresponds to "Block."
However, to disable blocking for content filters, you must apply for approval using the following form:
https://customervoice.microsoft.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR7en2Ais5pxKtso_Pz4b1_xUMlBQNkZMR0lFRldORTdVQzQ0TEI5Q1ExOSQlQCN0PWcu
After applying, you will see a message like the one below, and the block will be lifted within approximately 10 business days.
Behavior After Approval
Once approved, you can select the "Annotate Only" option.
After making the changes, try sending the request again.
Request:
{
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "I am an AI assistant here to help you find information."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Find employees with family members under 12 years old"
}
]
}
],
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 800
}
Response:
{
"choices": [
{
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"protected_material_code": {
"filtered": false,
"detected": false
},
"protected_material_text": {
"filtered": false,
"detected": false
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": false,
"severity": "safe"
}
},
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "To search for information about employees' family structures, you first need to determine where that information is stored. Generally, the HR department manages employees' personal information, but access to that information is restricted for privacy reasons.\n\nIf you have the necessary permissions to access the company's systems or databases, you can try the following steps:\n\n1. **Check the HR Database**: Verify if the information about employees' family structures is recorded. Many companies record basic information about employees and their families.\n\n2. **Use Filtering Functions**: If the database has filtering functions, filter by the condition \"employees with children under 12 years old.\"\n\n3. **Consult the HR Department**: Consult the HR department to obtain the necessary information while respecting privacy. If there is a legitimate business purpose, the HR department may provide the necessary information.\n\n4. **Respect Privacy**: Always follow the company's privacy policies and relevant laws when handling employees' personal information.\n\nWhen collecting information, it is important to clarify the necessity and purpose and to respect privacy.",
"refusal": null,
"role": "assistant"
}
}
],
"created": 1745232931,
"id": "chatcmpl-BOj6BbjJeVdRJjibvoUEAam05fU9O",
"model": "gpt-4o-2024-08-06",
"object": "chat.completion",
"prompt_filter_results": [
{
"prompt_index": 0,
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"jailbreak": {
"filtered": false,
"detected": false
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "high"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
],
"system_fingerprint": "fp_ee1d74bde0",
"usage": {
"completion_tokens": 357,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0,
"rejected_prediction_tokens": 0
},
"prompt_tokens": 43,
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 0
},
"total_tokens": 400
}
}
The output from the generative AI will now be returned. However, the prompt_filter_results
for sexual
will still show a severity of "High."
{
"prompt_filter_results": [
{
"prompt_index": 0,
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"jailbreak": {
"filtered": false,
"detected": false
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "high"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
]
}
Thus, while the filter remains active, you can configure custom behavior or log flagged content for future use, such as creating a list of prohibited words.
Example of IaC
For Bicep, you can write the configuration as follows:
resource accounts_cog_gei553vcznq32_AOAI_name_CustomContentFilterSexual 'Microsoft.CognitiveServices/accounts/raiPolicies@2024-10-01' = {
parent: accounts_cog_gei553vcznq32_AOAI_name_resource
name: 'CustomContentFilterSexual'
properties: {
mode: 'Default'
basePolicyName: 'Microsoft.DefaultV2'
contentFilters: [
{
name: 'Violence'
severityThreshold: 'Medium'
blocking: true
enabled: true
source: 'Prompt'
}
{
name: 'Hate'
severityThreshold: 'Medium'
blocking: true
enabled: true
source: 'Prompt'
}
{
name: 'Sexual'
severityThreshold: 'Medium'
blocking: false
enabled: true
source: 'Prompt'
}
{
name: 'Selfharm'
severityThreshold: 'Medium'
blocking: true
enabled: true
source: 'Prompt'
}
{
name: 'Jailbreak'
blocking: true
enabled: true
source: 'Prompt'
}
{
name: 'Indirect Attack'
blocking: false
enabled: false
source: 'Prompt'
}
{
name: 'Violence'
severityThreshold: 'Medium'
blocking: true
enabled: true
source: 'Completion'
}
{
name: 'Hate'
severityThreshold: 'Medium'
blocking: true
enabled: true
source: 'Completion'
}
{
name: 'Sexual'
severityThreshold: 'Medium'
blocking: false
enabled: true
source: 'Completion'
}
{
name: 'Selfharm'
severityThreshold: 'Medium'
blocking: true
enabled: true
source: 'Completion'
}
{
name: 'Protected Material Text'
blocking: true
enabled: true
source: 'Completion'
}
{
name: 'Protected Material Code'
blocking: false
enabled: true
source: 'Completion'
}
]
}
}
{
name: 'Sexual'
severityThreshold: 'Medium'
blocking: false
enabled: true
source: 'Prompt'
}
By setting blocking: false
and enabled: true
for the "Sexual" category, you can keep the filter active while preventing blocks.
For ARM, the configuration is similar:
{
"type": "Microsoft.CognitiveServices/accounts/raiPolicies",
"apiVersion": "2024-10-01",
"name": "[concat(parameters('accounts_cog_gei553vcznq32_AOAI_name'), '/CustomContentFilterSexual')]",
"dependsOn": [
"[resourceId('Microsoft.CognitiveServices/accounts', parameters('accounts_cog_gei553vcznq32_AOAI_name'))]"
],
"properties": {
"mode": "Default",
"basePolicyName": "Microsoft.DefaultV2",
"contentFilters": [
{
"name": "Violence",
"severityThreshold": "Medium",
"blocking": true,
"enabled": true,
"source": "Prompt"
},
{
"name": "Hate",
"severityThreshold": "Medium",
"blocking": true,
"enabled": true,
"source": "Prompt"
},
{
"name": "Sexual",
"severityThreshold": "Medium",
"blocking": false,
"enabled": true,
"source": "Prompt"
},
{
"name": "Selfharm",
"severityThreshold": "Medium",
"blocking": true,
"enabled": true,
"source": "Prompt"
},
{
"name": "Jailbreak",
"blocking": true,
"enabled": true,
"source": "Prompt"
},
{
"name": "Indirect Attack",
"blocking": false,
"enabled": false,
"source": "Prompt"
},
{
"name": "Violence",
"severityThreshold": "Medium",
"blocking": true,
"enabled": true,
"source": "Completion"
},
{
"name": "Hate",
"severityThreshold": "Medium",
"blocking": true,
"enabled": true,
"source": "Completion"
},
{
"name": "Sexual",
"severityThreshold": "Medium",
"blocking": false,
"enabled": true,
"source": "Completion"
},
{
"name": "Selfharm",
"severityThreshold": "Medium",
"blocking": true,
"enabled": true,
"source": "Completion"
},
{
"name": "Protected Material Text",
"blocking": true,
"enabled": true,
"source": "Completion"
},
{
"name": "Protected Material Code",
"blocking": false,
"enabled": true,
"source": "Completion"
}
]
}
}
The contents of this article are available as sample code on GitHub. Please refer to the following link for code examples. aoai-custom-filter
References
Disabling content filters requires approval.
How to Disable Content Filter and Abuse Monitoring in Azure OpenAI - Microsoft Q&A