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
* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
@@ -67,7 +60,7 @@ In the command below, replace `<your_api_key>`, `<your_endpoint>`, and other nec
67
60
### Create new category version
68
61
69
62
```bash
70
-
curl -X PUT "<your_endpoint>/contentsafety/text/categories/survival-advice?api-version=2024-09-15-preview" \
63
+
curl -X PUT "<your_endpoint>/contentsafety/text/categories/<your_category_name>?api-version=2024-09-15-preview" \
71
64
-H "Ocp-Apim-Subscription-Key: <your_api_key>" \
72
65
-H "Content-Type: application/json" \
73
66
-d "{
@@ -77,29 +70,56 @@ curl -X PUT "<your_endpoint>/contentsafety/text/categories/survival-advice?api-v
77
70
}"
78
71
```
79
72
> [!TIP]
80
-
> 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.
81
-
### Get new category version
73
+
> 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.
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.
107
+
Replace <your_api_key> and <your_endpoint> with your own values, and also **append the version number in the url 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.
97
108
98
109
```bash
99
110
curl -X POST "<your_endpoint>/contentsafety/text/categories/survival-advice:build?api-version=2024-09-15-preview&version={version}" \
|`customCategoryAnalysis`| Object containing the analysis result for the category. | — |
163
+
|`detected`| Indicates whether the specified category was detected. | false |
127
164
128
165
129
166
#### [Python](#tab/python)
@@ -231,11 +268,122 @@ version = 1
231
268
result = analyze_text_with_customized_category(text, category_name, version)
232
269
print(result)
233
270
```
271
+
---
272
+
273
+
## Other custom categories operations
274
+
275
+
Remember to replace the placeholders below with your actual values for the API key, endpoint, and specific content (category name, definition, and so on). These examples help you to manage the customized categories in your account.
276
+
277
+
#### [cURL](#tab/curl)
278
+
279
+
### Get a customized category or a specific version of it
280
+
281
+
Replace the placeholders with your own values and run the following command in a terminal window:
282
+
283
+
```bash
284
+
curl -X GET "<endpoint>/contentsafety/text/categories/<your_category_name>?api-version=2024-09-15-preview&version=1" \
285
+
-H "Ocp-Apim-Subscription-Key: <your_api_key>" \
286
+
-H "Content-Type: application/json"
287
+
```
288
+
289
+
### List categories of their latest versions
290
+
291
+
Replace the placeholders with your own values and run the following command in a terminal window:
292
+
293
+
```bash
294
+
curl -X GET "<endpoint>/contentsafety/text/categories?api-version=2024-09-15-preview" \
295
+
-H "Ocp-Apim-Subscription-Key: <your_api_key>" \
296
+
-H "Content-Type: application/json"
297
+
```
298
+
299
+
### Delete a customized category or a specific version of it
300
+
301
+
Replace the placeholders with your own values and run the following command in a terminal window:
0 commit comments