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
Follow this guide to use Azure AI Content Safety Custom categories (standard) REST API to create your own content categories for your use case and train Azure AI Content Safety to detect them in new text content.
@@ -59,7 +63,21 @@ In the command below, replace `<your_api_key>`, `<your_endpoint>`, and other nec
59
63
### Create new category version
60
64
61
65
```bash
62
-
curl -X PUT "<your_endpoint>/contentsafety/text/categories/survival-advice?api-version=2024-02-15-preview" \
66
+
curl -X PUT "<your_endpoint>/contentsafety/text/categories/survival-advice?api-version=2024-09-15-preview" \
67
+
-H "Ocp-Apim-Subscription-Key: <your_api_key>" \
68
+
-H "Content-Type: application/json" \
69
+
-d "{
70
+
\"categoryName\": \"survival-advice\",
71
+
\"definition\": \"text prompts about survival advice in camping/wilderness situations\",
> Every time you change your category name, definition or samples, a new version will be created. You can use the version number to trace back to previous versions. Please remember this version number, as it will be required in the URL for the next step- training custom categories.
77
+
### Get new category version
78
+
79
+
```bash
80
+
curl -X PUT "<your_endpoint>/contentsafety/text/categories/survival-advice?api-version=2024-09-15-preview" \
63
81
-H "Ocp-Apim-Subscription-Key: <your_api_key>" \
64
82
-H "Content-Type: application/json" \
65
83
-d "{
@@ -71,10 +89,10 @@ curl -X PUT "<your_endpoint>/contentsafety/text/categories/survival-advice?api-v
71
89
72
90
### Start the category build process:
73
91
74
-
Replace `<your_api_key>` and `<your_endpoint>` with your own values. Allow enough time for model training: the end-to-end execution of custom category training can take from around five hours to ten hours. Plan your moderation pipeline accordingly. After you receive the response, store the operation ID (referred to as `id`) in a temporary location. This ID will be necessary for retrieving the build status using the **Get status** API in the next section.
92
+
Replace <your_api_key> and <your_endpoint> with your own values, and also **append the version number you obtained from the last step.** Allow enough time for model training: the end-to-end execution of custom category training can take from around five hours to ten hours. Plan your moderation pipeline accordingly. After you receive the response, store the operation ID (referred to as `id`) in a temporary location. This ID will be necessary for retrieving the build status using the **Get status** API in the next section.
75
93
76
94
```bash
77
-
curl -X POST "<your_endpoint>/contentsafety/text/categories/survival-advice:build?api-version=2024-02-15-preview" \
95
+
curl -X POST "<your_endpoint>/contentsafety/text/categories/survival-advice:build?api-version=2024-09-15-preview**&version={version}**" \
78
96
-H "Ocp-Apim-Subscription-Key: <your_api_key>" \
79
97
-H "Content-Type: application/json"
80
98
```
@@ -83,7 +101,7 @@ curl -X POST "<your_endpoint>/contentsafety/text/categories/survival-advice:buil
83
101
To retrieve the status, utilize the `id` obtained from the previous API response and place it in the path of the API below.
84
102
85
103
```bash
86
-
curl -X GET "<your_endpoint>/contentsafety/text/categories/operations/<id>?api-version=2024-02-15-preview" \
104
+
curl -X GET "<your_endpoint>/contentsafety/text/categories/operations/<id>?api-version=2024-09-15-preview" \
87
105
-H "Ocp-Apim-Subscription-Key: <your_api_key>" \
88
106
-H "Content-Type: application/json"
89
107
```
@@ -93,7 +111,7 @@ curl -X GET "<your_endpoint>/contentsafety/text/categories/operations/<id>?api-v
93
111
Run the following command to analyze text with your customized category. Replace `<your_api_key>` and `<your_endpoint>` with your own values.
94
112
95
113
```bash
96
-
curl -X POST "<your_endpoint>/contentsafety/text:analyzeCustomCategory?api-version=2024-02-15-preview" \
114
+
curl -X POST "<your_endpoint>/contentsafety/text:analyzeCustomCategory?api-version=2024-09-15-preview" \
97
115
-H "Ocp-Apim-Subscription-Key: <your_api_key>" \
98
116
-H "Content-Type: application/json" \
99
117
-d "{
@@ -132,7 +150,7 @@ You can create a new category with *category name*, *definition* and *sample_blo
0 commit comments