Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cognitive Services - Azure AI Content Safety] GA Restful API #25498

Merged
merged 18 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"title": "Add BlockItems To Text Blocklist",
"operationId": "TextBlocklists_AddBlockItems",
"title": "Add or Update BlocklistItems To Text Blocklist",
"operationId": "TextBlocklists_AddOrUpdateBlocklistItems",
"parameters": {
"api-version": "2023-04-30-preview",
"api-version": "2023-10-01",
"blocklistName": "TestBlocklist",
"body": {
"blockItems": [
"blocklistItems": [
{
"description": "Hate word",
"text": "hate"
Expand All @@ -16,9 +16,9 @@
"responses": {
"200": {
"body": {
"value": [
"blocklistItems": [
{
"blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec",
"blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec",
"description": "Hate word",
"text": "hate"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"title": "Analyze Image",
"operationId": "ImageOperations_AnalyzeImage",
"parameters": {
"api-version": "2023-10-01",
"body": {
"image": {
"content": "Y29udGVudDE="
}
}
},
"responses": {
"200": {
"body": {
"categoriesAnalysis": [
{
"category": "Hate",
"severity": 0
},
{
"category": "SelfHarm",
"severity": 0
},
{
"category": "Sexual",
"severity": 0
},
{
"category": "Violence",
"severity": 2
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"title": "Analyze Text",
"operationId": "TextOperations_AnalyzeText",
"parameters": {
"api-version": "2023-10-01",
"body": {
"text": "This is text example"
}
},
"responses": {
"200": {
"body": {
"blocklistsMatch": [],
"categoriesAnalysis": [
{
"category": "Hate",
"severity": 0
},
{
"category": "SelfHarm",
"severity": 0
},
{
"category": "Sexual",
"severity": 0
},
{
"category": "Violence",
"severity": 0
}
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Create Or Update Text Blocklist",
"operationId": "TextBlocklists_CreateOrUpdateTextBlocklist",
"parameters": {
"api-version": "2023-04-30-preview",
"api-version": "2023-10-01",
"blocklistName": "TestBlocklist",
"resource": {
"description": "Test Blocklist"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Delete Text Blocklist By blocklistName",
"operationId": "TextBlocklists_DeleteTextBlocklist",
"parameters": {
"api-version": "2023-04-30-preview",
"api-version": "2023-10-01",
"blocklistName": "TestBlocklist"
},
"responses": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Get Text Blocklist By blocklistName",
"operationId": "TextBlocklists_GetTextBlocklist",
"parameters": {
"api-version": "2023-04-30-preview",
"api-version": "2023-10-01",
"blocklistName": "TestBlocklist"
},
"responses": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"title": "Get BlockItem By blocklistName And blockItemId",
"title": "Get BlockItem By blocklistName And blocklistItemId",
"operationId": "TextBlocklists_GetTextBlocklistItem",
"parameters": {
"api-version": "2023-04-30-preview",
"api-version": "2023-10-01",
"blocklistName": "TestBlocklist",
"blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec"
"blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec"
},
"responses": {
"200": {
"body": {
"blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec",
"blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec",
"description": "Hate word",
"text": "hate"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"title": "Get All BlockItems By blocklistName",
"operationId": "TextBlocklists_ListTextBlocklistItems",
"parameters": {
"api-version": "2023-04-30-preview",
"api-version": "2023-10-01",
"blocklistName": "TestBlocklist"
},
"responses": {
"200": {
"body": {
"value": [
{
"blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec",
"blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec",
"description": "Hate word",
"text": "hate"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Get All Text Blocklists",
"operationId": "TextBlocklists_ListTextBlocklists",
"parameters": {
"api-version": "2023-04-30-preview"
"api-version": "2023-10-01"
},
"responses": {
"200": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"title": "Remove BlockItems From Text Blocklist",
"operationId": "TextBlocklists_RemoveBlockItems",
"operationId": "TextBlocklists_RemoveBlocklistItems",
"parameters": {
"api-version": "2023-04-30-preview",
"api-version": "2023-10-01",
"blocklistName": "TestBlocklist",
"body": {
"blockItemIds": [
"blocklistItemIds": [
"9511969e-f1e3-4604-9127-05ee16c509ec"
]
}
Expand Down
13 changes: 11 additions & 2 deletions specification/cognitiveservices/ContentSafety/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ using Azure.Core;
title: "ContentSafety Service",
})
@versioned(ContentSafety.Versions)
@useAuth(ApiKeyAuth<ApiKeyLocation.header, "Ocp-Apim-Subscription-Key">)
@useAuth(
ApiKeyAuth<ApiKeyLocation.header, "Ocp-Apim-Subscription-Key"> | OAuth2Auth<[
{
type: OAuth2FlowType.clientCredentials,
tokenUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/token",
refreshUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/token",
scopes: ["https://cognitiveservices.azure.com/.default"],
}
]>
)
@server(
"{endpoint}/contentsafety",
"Analyze harmful content",
Expand All @@ -31,5 +40,5 @@ namespace ContentSafety;
#suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107"
enum Versions {
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
v2023_04_30_Preview: "2023-04-30-preview",
v2023_10_01: "2023-10-01",
}
Loading