You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/openai/how-to/use-blocklists.md
+12-25Lines changed: 12 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,12 @@ description: Learn how to use blocklists with Azure OpenAI Service
6
6
manager: nitinme
7
7
ms.service: azure-ai-openai
8
8
ms.topic: how-to
9
-
ms.date: 10/03/2024
9
+
ms.date: 12/05/2024
10
10
author: PatrickFarley
11
11
ms.author: pafarley
12
12
---
13
13
14
-
# Use a blocklist in Azure OpenAI
14
+
# Use a blocklist with Azure OpenAI
15
15
16
16
The configurable content filters are sufficient for most content moderation needs. However, you may need to filter terms specific to your use case.
17
17
@@ -25,6 +25,8 @@ The configurable content filters are sufficient for most content moderation need
25
25
26
26
## Use blocklists
27
27
28
+
#### [Azure OpenAI API](#tab/api)
29
+
28
30
You can create blocklists with the Azure OpenAI API. The following steps help you get started.
29
31
30
32
### Get your token
@@ -61,7 +63,7 @@ The response code should be `201` (created a new list) or `200` (updated an exis
61
63
62
64
### Apply a blocklist to a content filter
63
65
64
-
If you haven't yet created a content filter, you can do so in the Studio in the Content Filters tab on the left hand side. In order to use the blocklist, make sure this Content Filter is applied to an Azure OpenAI deployment. You can do this in the Deployments tab on the left hand side.
66
+
If you haven't yet created a content filter, you can do so in Azure AI Foundry. See [Content filtering](/azure/ai-services/openai/how-to/content-filters#create-a-content-filter-in-azure-ai-foundry).
65
67
66
68
To apply a **completion** blocklist to a content filter, use the following cURL command:
67
69
@@ -132,9 +134,7 @@ The response code should be `200`.
132
134
133
135
### Analyze text with a blocklist
134
136
135
-
Now you can test out your deployment that has the blocklist. The easiest way to do this is in the [Azure OpenAI Studio](https://oai.azure.com/portal/). If the content was blocked either in prompt or completion, you should see an error message saying the content filtering system was triggered.
136
-
137
-
For instruction on calling the Azure OpenAI endpoints, visit the [Quickstart](/azure/ai-services/openai/quickstart).
137
+
Now you can test out your deployment that has the blocklist. For instructions on calling the Azure OpenAI endpoints, visit the [Quickstart](/azure/ai-services/openai/quickstart).
138
138
139
139
In the below example, a GPT-35-Turbo deployment with a blocklist is blocking the prompt. The response returns a `400` error.
140
140
@@ -249,26 +249,13 @@ If the completion itself is blocked, the response returns `200`, as the completi
249
249
}
250
250
```
251
251
252
-
## Use blocklists in Azure OpenAI Studio
253
-
254
-
You can also create custom blocklists in the Azure OpenAI Studio as part of your content filtering configurations (public preview). Instructions on how to create custom content filters can be found [here](/azure/ai-services/openai/how-to/content-filters). The following steps show how to create custom blocklists as part of your content filters via Azure OpenAI Studio.
255
-
256
-
1. Select Content Filters from the left menu. Select the Blocklists tab next to Content filters tab. Then select Create Blocklist.
257
-
:::image type="content" source="../media/content-filters/blocklist-select-create.png" alt-text="Screenshot of blocklist create selection." lightbox="../media/content-filters/blocklist-select-create.png":::
258
-
1. Create a name for your blocklist, add a description and select on Create Blocklist.
259
-
:::image type="content" source="../media/content-filters/create-blocklist.png" alt-text="Screenshot of blocklist name and description." lightbox="../media/content-filters/create-blocklist.png":::
260
-
1. Select your custom blocklist once it's created, and select Add new term.
261
-
:::image type="content" source="../media/content-filters/custom-blocklist-add.png" alt-text="Screenshot of custom blocklist add term." lightbox="../media/content-filters/custom-blocklist-add.png":::
262
-
1. Add a term that should be filtered, and select Add term. You can also create a regex.
263
-
:::image type="content" source="../media/content-filters/custom-blocklist-add-item.png" alt-text="Screenshot of custom blocklist add item." lightbox="../media/content-filters/custom-blocklist-add-item.png":::
264
-
1. You can delete each term in your blocklist.
265
-
:::image type="content" source="../media/content-filters/custom-blocklist-edit.png" alt-text="Screenshot of custom blocklist edit screen." lightbox="../media/content-filters/custom-blocklist-edit.png":::
266
-
1. Once the blocklist is ready, navigate to the Content filters (Preview) section and create a new customized content filter configuration. This opens a wizard with several AI content safety components. You can find more information on how to configure the main filters and optional models [here](/azure/ai-services/openai/how-to/content-filters). Go to Add blocklist (Optional).
267
-
1. You'll now see all available blocklists. There are two types of blocklists – the blocklists you created, and prebuilt blocklists that Microsoft provides, in this case a Profanity blocklist (English)
268
-
1. You can now decide which of the available blocklists you would like to include in your content filtering configuration. In the below example, we apply CustomBlocklist1 that we just created. The last step is to review and finish the content filtering configuration by clicking on Next.
269
-
:::image type="content" source="../media/content-filters/filtering-configuration-manage.png" alt-text="Screenshot of filtering configuration management." lightbox="../media/content-filters/filtering-configuration-manage.png":::
270
-
1. You can always go back and edit your configuration. Once it’s ready, select on Create content filter. The new configuration that includes your blocklists can now be applied to a deployment. Detailed instructions can be found [here](/azure/ai-services/openai/how-to/content-filters).
Copy file name to clipboardExpand all lines: articles/ai-studio/how-to/use-blocklists.md
+1-17Lines changed: 1 addition & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,20 +17,4 @@ author: PatrickFarley
17
17
18
18
You can create custom blocklists in the Azure AI Foundry portal as part of your content filtering configurations. The following steps show how to create custom blocklists as part of your content filters in Azure AI Foundry portal.
19
19
20
-
## Create a blocklist
21
-
22
-
1. Go to [Azure AI Foundry](https://ai.azure.com/) and navigate to your project/hub. Then select the **Safety+ Security** page on the left nav and select the **Blocklists** tab.
23
-
:::image type="content" source="../media/content-safety/content-filter/select-blocklists.png" lightbox="../media/content-safety/content-filter/select-blocklists.png" alt-text="Screenshot of the Blocklists page tab.":::
24
-
1. Select **Create a blocklist**. Enter a name for your blocklist, add a description, and select an Azure OpenAI resource to connect it to. Then select **Create Blocklist**.
25
-
1. Select your new blocklist once it's created. On the blocklist's page, select **Add new term**.
26
-
1. Enter the term that should be filtered and select **Add term**. You can also use a regex.
27
-
You can delete each term in your blocklist.
28
-
29
-
## Attach a blocklist to a content filter configuration
30
-
31
-
1. Once the blocklist is ready, go back to the **Safety+ Security** page and select the **Content filters** tab. Create a new content filter configuration. This opens a wizard with several AI content safety components.
32
-
:::image type="content" source="../media/content-safety/content-filter/create-content-filter.png" lightbox="../media/content-safety/content-filter/create-content-filter.png" alt-text="Screenshot of the Create content filter button.":::
33
-
1. On the **Input filter** and **Output filter** screens, toggle the **Blocklist** button on. You can then select a blocklist from the list.
34
-
There are two types of blocklists: the custom blocklists you created, and prebuilt blocklists that Microsoft provides—in this case a Profanity blocklist (English).
35
-
1. You can now decide which of the available blocklists you want to include in your content filtering configuration. The last step is to review and finish the content filtering configuration by selecting **Next**.
36
-
You can always go back and edit your configuration. Once it’s ready, select a **Create content filter**. The new configuration that includes your blocklists can now be applied to a deployment.
1. Go to [Azure AI Foundry](https://ai.azure.com/) and navigate to your project/hub. Then select the **Safety+ Security** page on the left nav and select the **Blocklists** tab.
17
+
:::image type="content" source="../media/content-safety/content-filter/select-blocklists.png" lightbox="../media/content-safety/content-filter/select-blocklists.png" alt-text="Screenshot of the Blocklists page tab.":::
18
+
1. Select **Create a blocklist**. Enter a name for your blocklist, add a description, and select an Azure OpenAI resource to connect it to. Then select **Create Blocklist**.
19
+
1. Select your new blocklist once it's created. On the blocklist's page, select **Add new term**.
20
+
1. Enter the term that should be filtered and select **Add term**. You can also use a regex.
21
+
You can delete each term in your blocklist.
22
+
23
+
## Attach a blocklist to a content filter configuration
24
+
25
+
1. Once the blocklist is ready, go back to the **Safety+ Security** page and select the **Content filters** tab. Create a new content filter configuration. This opens a wizard with several AI content safety components.
26
+
:::image type="content" source="../media/content-safety/content-filter/create-content-filter.png" lightbox="../media/content-safety/content-filter/create-content-filter.png" alt-text="Screenshot of the Create content filter button.":::
27
+
1. On the **Input filter** and **Output filter** screens, toggle the **Blocklist** button on. You can then select a blocklist from the list.
28
+
There are two types of blocklists: the custom blocklists you created, and prebuilt blocklists that Microsoft provides—in this case a Profanity blocklist (English).
29
+
1. You can now decide which of the available blocklists you want to include in your content filtering configuration. The last step is to review and finish the content filtering configuration by selecting **Next**.
30
+
You can always go back and edit your configuration. Once it’s ready, select a **Create content filter**. The new configuration that includes your blocklists can now be applied to a deployment.
0 commit comments