Skip to content

Commit c1773fb

Browse files
authored
Merge pull request #280925 from MicrosoftDocs/main
Merge main to live, 4 AM
2 parents 021971c + 87eee5a commit c1773fb

File tree

262 files changed

+1136
-542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+1136
-542
lines changed

.openpublishing.redirection.applied-ai-services.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@
249249
"source_path_from_root": "/articles/ai-services/content-safety/how-to/incident-response.md",
250250
"redirect_url": "/azure/ai-services/content-safety/how-to/custom-categories-rapid",
251251
"redirect_document_id": true
252+
},
253+
{
254+
"source_path_from_root": "/articles/ai-services/content-safety/concepts/custom-categories-rapid.md",
255+
"redirect_url": "/azure/ai-services/content-safety/concepts/custom-categories",
256+
"redirect_document_id": true
252257
}
253258
]
254259
}

articles/ai-services/content-safety/concepts/custom-categories-rapid.md

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
title: "Custom categories in Azure AI Content Safety"
3+
titleSuffix: Azure AI services
4+
description: Learn about custom content categories and the different ways you can use Azure AI Content Safety to handle them on your platform.
5+
#services: cognitive-services
6+
author: PatrickFarley
7+
manager: nitinme
8+
ms.service: azure-ai-content-safety
9+
ms.custom: build-2024
10+
ms.topic: conceptual
11+
ms.date: 07/05/2024
12+
ms.author: pafarley
13+
---
14+
15+
# Custom categories
16+
17+
Azure AI Content Safety lets you create and manage your own content moderation categories for enhanced moderation and filtering that matches your specific policies or use cases.
18+
19+
## Types of customization
20+
21+
There are multiple ways to define and use custom categories, which are detailed and compared in this section.
22+
23+
| API | Functionality |
24+
| :--------- | :------------ |
25+
| [Custom categories (standard) API](#custom-categories-standard-api) | Use a customizable machine learning model to create, get, query, and delete a customized category. Or, list all your customized categories for further annotation tasks. |
26+
| [Custom categories (rapid) API](#custom-categories-rapid-api) | Use a large language model (LLM) to quickly learn specific content patterns in emerging content incidents. |
27+
28+
### Custom categories (standard) API
29+
30+
The Custom categories (standard) API enables customers to define categories specific to their needs, provide sample data, train a custom machine learning model, and use it to classify new content according to the learned categories.
31+
32+
This is the standard workflow for customization with machine learning models. Depending on the training data quality, it can reach very good performance levels, but it can take up to several hours to train the model.
33+
34+
This implementation works on text content, not image content.
35+
36+
### Custom categories (rapid) API
37+
38+
The Custom categories (rapid) API is designed to be quicker and more flexible than the standard method. It's meant to be used for identifying, analyzing, containing, eradicating, and recovering from cyber incidents that involve inappropriate or harmful content on online platforms.
39+
40+
An incident may involve a set of emerging content patterns (text, image, or other modalities) that violate Microsoft community guidelines or the customers' own policies and expectations. These incidents need to be mitigated quickly and accurately to avoid potential live site issues or harm to users and communities.
41+
42+
This implementation works on text content and image content.
43+
44+
> [!TIP]
45+
> One way to deal with emerging content incidents is to use [Blocklists](/azure/ai-services/content-safety/how-to/use-blocklist), but that only allows exact text matching and no image matching. The Custom categories (rapid) API offers the following advanced capabilities:
46+
- semantic text matching using embedding search with a lightweight classifier
47+
- image matching with a lightweight object-tracking model and embedding search.
48+
49+
50+
## How it works
51+
52+
#### [Custom categories (standard) API](#tab/standard)
53+
54+
The Azure AI Content Safety custom category feature uses a multi-step process for creating, training, and using custom content classification models. Here's a look at the workflow:
55+
56+
### Step 1: Definition and setup
57+
58+
When you define a custom category, you need to teach the AI what type of content you want to identify. This involves providing a clear **category name** and a detailed **definition** that encapsulates the content's characteristics.
59+
60+
Then, you collect a balanced dataset with **positive** and (optionally) **negative** examples to help the AI to learn the nuances of your category. This data should be representative of the variety of content that the model will encounter in a real-world scenario.
61+
62+
### Step 2: Model training
63+
64+
After you prepare your dataset and define categories, the Azure AI Content Safety service trains a new machine learning model. This model uses your definitions and uploaded dataset to perform data augmentation using a large language model. As a result, the training dataset is made larger and of higher quality. During training, the AI model analyzes the data and learns to differentiate between content that aligns with the specified category and content that does not.
65+
66+
### Step 3: Model inferencing
67+
68+
After training, you need to evaluate the model to ensure it meets your accuracy requirements. Test the model with new content that it hasn't received before. The evaluation phase helps you identify any potential adjustments you need to make deploying the model into a production environment.
69+
70+
### Step 4: Model usage
71+
72+
You use the **analyzeCustomCategory** API to analyze text content and determine whether it matches the custom category you've defined. The service will return a Boolean indicating whether the content aligns with the specified category
73+
74+
#### [Custom categories (rapid) API](#tab/rapid)
75+
76+
To use the custom category (rapid) API, you first create an **incident** object with a text description. Then, you upload any number of image or text samples to the incident. The LLM on the backend will then use these to evaluate future input content. No training step is needed.
77+
78+
You can include your defined incident in a regular text analysis or image analysis request. The service will indicate whether the submitted content is an instance of your incident. The service can still do other content moderation tasks in the same API call.
79+
80+
---
81+
82+
## Limitations
83+
84+
### Language availability
85+
86+
The Custom categories APIs support all languages that are supported by Content Safety text moderation. See [Language support](/azure/ai-services/content-safety/language-support).
87+
88+
### Input limitations
89+
90+
#### [Custom categories (standard) API](#tab/standard)
91+
92+
93+
See the following table for the input limitations of the custom categories (standard) API:
94+
95+
| Object | Limitation |
96+
| ---------------- | ------------ |
97+
| Supported languages | English only |
98+
| Number of categories per user | 3 |
99+
| Number of versions per category | 3 |
100+
| Number of concurrent builds (processes) per category | 1 |
101+
| Inference operations per second | 5 |
102+
| Number of samples in a category version | Positive samples(required): minimum 50, maximum 5K<br>In total (both negative and positive samples): 10K<br>No duplicate samples allowed. |
103+
| Sample file size | maximum 128000 bytes |
104+
| Length of a text sample | maximum 125K characters |
105+
| Length of a category definition | maximum 1000 chars |
106+
|Length of a category name | maximum 128 characters |
107+
|Length of a blob url | maximum 500 characters |
108+
109+
#### [Custom categories (rapid) API](#tab/rapid)
110+
111+
See the following table for the input limitations of the custom categories (rapid) API:
112+
113+
| Object | Limitation |
114+
| :------------ | :----------- |
115+
| Maximum length of an incident name | 100 characters |
116+
| Maximum number of text/image samples per incident | 1000 |
117+
| Maximum size of each sample | Text: 500 characters<br>Image: 4 MB  |
118+
| Maximum number of text or image incidents per resource| 100 |
119+
| Supported Image formats | BMP, GIF, JPEG, PNG, TIF, WEBP |
120+
121+
### Region availability
122+
123+
To use these APIs, you must create your Azure AI Content Safety resource in one of the supported regions. See [Region availability](../overview.md#region-availability).
124+
125+
126+
## Next steps
127+
128+
Follow a how-to guide to use the Azure AI Content Safety APIs to create custom categories.
129+
130+
* [Use custom category (standard) API](../how-to/custom-categories.md)
131+
* [Use the custom categories (rapid) API](../how-to/custom-categories-rapid.md)
132+
133+
134+

articles/ai-services/content-safety/concepts/response-codes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ The content APIs may return the following error codes:
2424
| InternalError | Some unexpected situations on the server side have been triggered. | You may want to retry a few times after a small period and see it the issue happens again. <br/> Contact Azure Support if this issue persists. |
2525
| ServerBusy | The server side cannot process the request temporarily. | You may want to retry a few times after a small period and see it the issue happens again. <br/>Contact Azure Support if this issue persists. |
2626
| TooManyRequests | The current RPS has exceeded the quota for your current SKU. | Check the pricing table to understand the RPS quota. <br/>Contact Azure Support if you need more QPS. |
27+
28+
29+
## Azure AI Studio error messages
30+
31+
If you encounter the error **Your account does not have access to this resource, please contact your resource owner to get access**, please ensure your account is assigned the role of `Cognitive Services User` for the Content Safety resource or Azure AI Services resource you are using.
32+

articles/ai-services/content-safety/faq.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ sections:
3737
- Azure AI Content Safety offers more accurate and granular detection of harmful content in text and images using state-of-the-art AI models.
3838
- Azure AI Content Safety supports multilingual content moderation in English, Japanese, German, Spanish, French, Portuguese, Italian, and Chinese.
3939
- Azure AI Content Safety enables responsible AI practices by monitoring both user-generated and AI-generated content.
40+
- question: |
41+
Can I detect harmful content in custom categories that I define myself?
42+
answer: |
43+
Yes, you can use the Azure AI Content Safety custom categories API to create categories, upload examples, and train the service to detect similar content. Custom categories are available for both text and image moderation.
4044
- question: |
4145
How does billing work for the Azure AI Content Safety service?
4246
answer: |

articles/ai-services/content-safety/how-to/custom-categories-rapid.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Follow these steps to define an incident with a few examples of text content and
3535
* [cURL](https://curl.haxx.se/) for REST API calls.
3636
* [Python 3.x](https://www.python.org/) installed
3737

38-
<!--tbd env vars-->
3938

4039
## Test the text custom categories (rapid) API
4140

@@ -801,5 +800,5 @@ print(response.text)
801800

802801
## Related content
803802

804-
- [Custom categories (rapid) concepts](../concepts/custom-categories-rapid.md)
803+
- [Custom categories concepts](../concepts/custom-categories.md)
805804
- [What is Azure AI Content Safety?](../overview.md)

0 commit comments

Comments
 (0)