From 65b8342375f8f21dd2fe972b3ea35a32296eeba2 Mon Sep 17 00:00:00 2001 From: mengaims Date: Thu, 24 Aug 2023 14:41:09 +0800 Subject: [PATCH 01/15] Add ga contract for Content Safety --- .../2023-04-30-preview/AddBlockItems.json | 29 + .../2023-04-30-preview/AnalyzeImage.json | 34 + .../2023-04-30-preview/AnalyzeText.json | 33 + .../CreateOrUpdateTextBlocklist.json | 25 + .../DeleteTextBlocklist.json | 11 + .../2023-04-30-preview/GetTextBlocklist.json | 16 + .../GetTextBlocklistItem.json | 18 + .../ListTextBlocklistItems.json | 21 + .../ListTextBlocklists.json | 19 + .../2023-04-30-preview/RemoveBlockItems.json | 16 + .../ContentSafety/0430/main.tsp | 35 + .../ContentSafety/0430/models.tsp | 195 ++++ .../ContentSafety/0430/routes.tsp | 92 ++ .../ContentSafety/0430/tspconfig.yaml | 31 + .../cognitiveservices/ContentSafety/main.tsp | 13 +- .../ContentSafety/models.tsp | 164 ++- .../ContentSafety/routes.tsp | 40 +- .../ContentSafety/tspconfig.yaml | 24 +- .../stable/2023-10-01/contentsafety.json | 1028 +++++++++++++++++ 19 files changed, 1720 insertions(+), 124 deletions(-) create mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AddBlockItems.json create mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeImage.json create mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeText.json create mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/CreateOrUpdateTextBlocklist.json create mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/DeleteTextBlocklist.json create mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklist.json create mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklistItem.json create mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklistItems.json create mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklists.json create mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/RemoveBlockItems.json create mode 100644 specification/cognitiveservices/ContentSafety/0430/main.tsp create mode 100644 specification/cognitiveservices/ContentSafety/0430/models.tsp create mode 100644 specification/cognitiveservices/ContentSafety/0430/routes.tsp create mode 100644 specification/cognitiveservices/ContentSafety/0430/tspconfig.yaml create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AddBlockItems.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AddBlockItems.json new file mode 100644 index 000000000000..3670641ca73b --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AddBlockItems.json @@ -0,0 +1,29 @@ +{ + "title": "Add BlockItems To Text Blocklist", + "operationId": "TextBlocklists_AddBlockItems", + "parameters": { + "api-version": "2023-04-30-preview", + "blocklistName": "TestBlocklist", + "body": { + "blockItems": [ + { + "description": "Hate word", + "text": "hate" + } + ] + } + }, + "responses": { + "200": { + "body": { + "value": [ + { + "blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", + "description": "Hate word", + "text": "hate" + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeImage.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeImage.json new file mode 100644 index 000000000000..7224de71454c --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeImage.json @@ -0,0 +1,34 @@ +{ + "title": "Analyze Image", + "operationId": "ImageOperations_AnalyzeImage", + "parameters": { + "api-version": "2023-04-30-preview", + "body": { + "image": { + "content": "Y29udGVudDE=" + } + } + }, + "responses": { + "200": { + "body": { + "hateResult": { + "category": "Hate", + "severity": 0 + }, + "selfHarmResult": { + "category": "Hate", + "severity": 0 + }, + "sexualResult": { + "category": "Hate", + "severity": 0 + }, + "violenceResult": { + "category": "Hate", + "severity": 2 + } + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeText.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeText.json new file mode 100644 index 000000000000..5d5bf56e9fcf --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeText.json @@ -0,0 +1,33 @@ +{ + "title": "Analyze Text", + "operationId": "TextOperations_AnalyzeText", + "parameters": { + "api-version": "2023-04-30-preview", + "body": { + "text": "This is text example" + } + }, + "responses": { + "200": { + "body": { + "blocklistsMatchResults": [], + "hateResult": { + "category": "Hate", + "severity": 0 + }, + "selfHarmResult": { + "category": "SelfHarm", + "severity": 0 + }, + "sexualResult": { + "category": "Sexual", + "severity": 0 + }, + "violenceResult": { + "category": "Violence", + "severity": 0 + } + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/CreateOrUpdateTextBlocklist.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/CreateOrUpdateTextBlocklist.json new file mode 100644 index 000000000000..c20bc792687d --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/CreateOrUpdateTextBlocklist.json @@ -0,0 +1,25 @@ +{ + "title": "Create Or Update Text Blocklist", + "operationId": "TextBlocklists_CreateOrUpdateTextBlocklist", + "parameters": { + "api-version": "2023-04-30-preview", + "blocklistName": "TestBlocklist", + "resource": { + "description": "Test Blocklist" + } + }, + "responses": { + "200": { + "body": { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + }, + "201": { + "body": { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/DeleteTextBlocklist.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/DeleteTextBlocklist.json new file mode 100644 index 000000000000..c671893d679a --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/DeleteTextBlocklist.json @@ -0,0 +1,11 @@ +{ + "title": "Delete Text Blocklist By blocklistName", + "operationId": "TextBlocklists_DeleteTextBlocklist", + "parameters": { + "api-version": "2023-04-30-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklist.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklist.json new file mode 100644 index 000000000000..4969426906de --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklist.json @@ -0,0 +1,16 @@ +{ + "title": "Get Text Blocklist By blocklistName", + "operationId": "TextBlocklists_GetTextBlocklist", + "parameters": { + "api-version": "2023-04-30-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "200": { + "body": { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklistItem.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklistItem.json new file mode 100644 index 000000000000..94da2bfbdaa9 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklistItem.json @@ -0,0 +1,18 @@ +{ + "title": "Get BlockItem By blocklistName And blockItemId", + "operationId": "TextBlocklists_GetTextBlocklistItem", + "parameters": { + "api-version": "2023-04-30-preview", + "blocklistName": "TestBlocklist", + "blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec" + }, + "responses": { + "200": { + "body": { + "blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", + "description": "Hate word", + "text": "hate" + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklistItems.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklistItems.json new file mode 100644 index 000000000000..6c7955b98842 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklistItems.json @@ -0,0 +1,21 @@ +{ + "title": "Get All BlockItems By blocklistName", + "operationId": "TextBlocklists_ListTextBlocklistItems", + "parameters": { + "api-version": "2023-04-30-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", + "description": "Hate word", + "text": "hate" + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklists.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklists.json new file mode 100644 index 000000000000..ea72669941d3 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklists.json @@ -0,0 +1,19 @@ +{ + "title": "Get All Text Blocklists", + "operationId": "TextBlocklists_ListTextBlocklists", + "parameters": { + "api-version": "2023-04-30-preview" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/RemoveBlockItems.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/RemoveBlockItems.json new file mode 100644 index 000000000000..fc7ea3a3fea3 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/RemoveBlockItems.json @@ -0,0 +1,16 @@ +{ + "title": "Remove BlockItems From Text Blocklist", + "operationId": "TextBlocklists_RemoveBlockItems", + "parameters": { + "api-version": "2023-04-30-preview", + "blocklistName": "TestBlocklist", + "body": { + "blockItemIds": [ + "9511969e-f1e3-4604-9127-05ee16c509ec" + ] + } + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/ContentSafety/0430/main.tsp b/specification/cognitiveservices/ContentSafety/0430/main.tsp new file mode 100644 index 000000000000..c9d893bf39bd --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/main.tsp @@ -0,0 +1,35 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "./routes.tsp"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; + +@service({ + title: "ContentSafety Service", +}) +@versioned(ContentSafety.Versions) +@useAuth(ApiKeyAuth) +@server( + "{endpoint}/contentsafety", + "Analyze harmful content", + { + @doc(""" +Supported Cognitive Services endpoints (protocol and hostname, for example: +https://.cognitiveservices.azure.com). +""") + endpoint: string, + } +) +@doc("Analyze harmful content") +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", +} diff --git a/specification/cognitiveservices/ContentSafety/0430/models.tsp b/specification/cognitiveservices/ContentSafety/0430/models.tsp new file mode 100644 index 000000000000..d02405ef8d2c --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/models.tsp @@ -0,0 +1,195 @@ +import "@typespec/http"; +import "@typespec/rest"; + +using TypeSpec.Http; +using TypeSpec.Rest; + +namespace ContentSafety; + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" +@doc("Text analyze category") +enum TextCategory { + Hate, + SelfHarm, + Sexual, + Violence, +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" +@doc("Image analyze category") +enum ImageCategory { + Hate, + SelfHarm, + Sexual, + Violence, +} + +@doc("The analysis request of the text.") +model AnalyzeTextOptions { + @doc("The text needs to be scanned. We support at most 1000 characters (unicode code points) in text of one request.") + @maxLength(1000) + text: string; + + @doc("The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned.") + categories?: TextCategory[]; + + @doc("The names of blocklists.") + blocklistNames?: string[]; + + @doc("When set to true, further analyses of harmful content will not be performed in cases where blocklists are hit. When set to false, all analyses of harmful content will be performed, whether or not blocklists are hit.") + breakByBlocklists?: boolean; +} + +@doc("The analysis response of the text") +model AnalyzeTextResult { + @doc("The details of blocklist match.") + blocklistsMatchResults?: TextBlocklistMatchResult[]; + + @doc("Analysis result for Hate category.") + hateResult?: TextAnalyzeSeverityResult; + + @doc("Analysis result for SelfHarm category.") + selfHarmResult?: TextAnalyzeSeverityResult; + + @doc("Analysis result for Sexual category.") + sexualResult?: TextAnalyzeSeverityResult; + + @doc("Analysis result for Violence category.") + violenceResult?: TextAnalyzeSeverityResult; +} + +@doc("The result of blocklist match.") +model TextBlocklistMatchResult { + @doc("The name of matched blocklist.") + @maxLength(64) + blocklistName: string; + + @doc("The id of matched item.") + @maxLength(64) + blockItemId: string; + + @doc("The content of matched item.") + @maxLength(128) + blockItemText: string; + + @doc("The character offset of matched text in original input.") + offset: int32; + + @doc("The length of matched text in original input.") + length: int32; +} + +@doc("Text analysis result.") +model TextAnalyzeSeverityResult { + @doc("The text category.") + category: TextCategory; + + @doc("The higher the severity of input content, the larger this value is. The values could be: 0,2,4,6.") + severity: int32; +} + +@doc("The analysis request of the image.") +model AnalyzeImageOptions { + @doc("The image needs to be analyzed.") + image: ImageData; + + @doc("The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned.") + categories?: ImageCategory[]; +} + +@doc("The content or blob url of image, could be base64 encoding bytes or blob url. If both are given, the request will be refused. The maximum size of image is 2048 pixels * 2048 pixels, no larger than 4MB at the same time. The minimum size of image is 50 pixels * 50 pixels.") +@projectedName("csharp", "ContentSafetyImageData") +model ImageData { + @doc("Base64 encoding of image.") + content?: bytes; + + @doc("The blob url of image.") + blobUrl?: url; +} + +@doc("The analysis response of the image.") +model AnalyzeImageResult { + @doc("Analysis result for Hate category.") + hateResult?: ImageAnalyzeSeverityResult; + + @doc("Analysis result for SelfHarm category.") + selfHarmResult?: ImageAnalyzeSeverityResult; + + @doc("Analysis result for Sexual category.") + sexualResult?: ImageAnalyzeSeverityResult; + + @doc("Analysis result for Violence category.") + violenceResult?: ImageAnalyzeSeverityResult; +} + +@doc("Image analysis result.") +model ImageAnalyzeSeverityResult { + @doc("The image category.") + category: ImageCategory; + + @doc("The higher the severity of input content, the larger this value, currently its value could be: 0,2,4,6.") + severity: int32; +} + +@doc("Text Blocklist.") +@resource("text/blocklists") +model TextBlocklist { + @doc("Text blocklist name.") + @pattern("^[0-9A-Za-z._~-]+$") + @key("blocklistName") + @visibility("read", "create", "query") + @maxLength(64) + blocklistName: string; + + @doc("Text blocklist description.") + @maxLength(1024) + description?: string; +} + +@doc("Item in TextBlocklist.") +@resource("blockItems") +@parentResource(TextBlocklist) +model TextBlockItem { + @doc("Block Item Id. It will be uuid.") + @key("blockItemId") + @visibility("read", "create", "query") + @maxLength(64) + blockItemId: string; + + @doc("Block item description.") + @maxLength(1024) + description?: string; + + @doc("Block item content.") + @maxLength(128) + text: string; +} + +@doc("Block item info in text blocklist.") +model TextBlockItemInfo { + @doc("Block item description.") + @maxLength(1024) + description?: string; + + @doc("Block item content.") + @maxLength(128) + text: string; +} + +@doc("The request of adding blockItems to text blocklist.") +model AddBlockItemsOptions { + @doc("Array of blockItemInfo to add.") + blockItems: TextBlockItemInfo[]; +} + +@doc("The response of adding blockItems to text blocklist.") +model AddBlockItemsResult { + @doc("Array of blockItems added.") + value?: TextBlockItem[]; +} + +@doc("The request of removing blockItems from text blocklist.") +model RemoveBlockItemsOptions { + @doc("Array of blockItemIds to remove.") + blockItemIds: string[]; +} diff --git a/specification/cognitiveservices/ContentSafety/0430/routes.tsp b/specification/cognitiveservices/ContentSafety/0430/routes.tsp new file mode 100644 index 000000000000..17ee1dbe0c96 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/routes.tsp @@ -0,0 +1,92 @@ +import "@azure-tools/typespec-azure-core"; +import "@typespec/http"; +import "@typespec/rest"; +import "./models.tsp"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.Core.Traits; + +namespace ContentSafety; + +interface TextOperations { + @summary("Analyze Text") + @doc("A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence.") + @route("/text:analyze") + @post + analyzeText is Azure.Core.RpcOperation< + { + @body + @doc("The request of text analysis.") + body: AnalyzeTextOptions; + }, + AnalyzeTextResult + >; +} + +interface ImageOperations { + @summary("Analyze Image") + @doc("A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence.") + @route("/image:analyze") + @post + analyzeImage is Azure.Core.RpcOperation< + { + @doc("The analysis request of the image.") + @body + body: AnalyzeImageOptions; + }, + AnalyzeImageResult + >; +} + +interface BlockOps + extends Azure.Core.ResourceOperations {} + +interface TextBlocklists { + @summary("Get Text Blocklist By blocklistName") + @doc("Returns text blocklist details.") + getTextBlocklist is BlockOps.ResourceRead; + + @summary("Create Or Update Text Blocklist") + @doc("Updates a text blocklist, if blocklistName does not exist, create a new blocklist.") + createOrUpdateTextBlocklist is BlockOps.ResourceCreateOrUpdate; + + @summary("Delete Text Blocklist By blocklistName") + @doc("Deletes a text blocklist.") + deleteTextBlocklist is BlockOps.ResourceDelete; + + @summary("Get All Text Blocklists") + @doc("Get all text blocklists details.") + listTextBlocklists is BlockOps.ResourceList; + + @summary("Add BlockItems To Text Blocklist") + @doc("Add blockItems to a text blocklist. You can add at most 100 BlockItems in one request.") + addBlockItems is BlockOps.ResourceAction< + TextBlocklist, + AddBlockItemsOptions, + AddBlockItemsResult + >; + + @summary("Remove BlockItems From Text Blocklist") + @doc("Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request.") + removeBlockItems is BlockOps.ResourceAction< + TextBlocklist, + RemoveBlockItemsOptions, + NoContentResponse + >; + + @summary("Get BlockItem By blocklistName And blockItemId") + @doc("Get blockItem By blockItemId from a text blocklist.") + getTextBlocklistItem is BlockOps.ResourceRead; + + @summary("Get All BlockItems By blocklistName") + @doc("Get all blockItems in a text blocklist") + listTextBlocklistItems is BlockOps.ResourceList< + TextBlockItem, + ListQueryParametersTrait + >; +} diff --git a/specification/cognitiveservices/ContentSafety/0430/tspconfig.yaml b/specification/cognitiveservices/ContentSafety/0430/tspconfig.yaml new file mode 100644 index 000000000000..6d8f2bfee5ef --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/0430/tspconfig.yaml @@ -0,0 +1,31 @@ +parameters: + service-dir: + default: "sdk/contentsafety" +emit: + - "@azure-tools/typespec-autorest" +options: + "@azure-tools/typespec-autorest": + emitter-output-dir: "{project-root}/../" + output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/contentsafety.json" + azure-resource-provider-folder: "data-plane" + examples-directory: examples + "@azure-tools/typespec-python": + package-dir: "azure-ai-contentsafety" + package-name: "{package-dir}" + package-mode: dataplane + "@azure-tools/typespec-csharp": + package-dir: "Azure.AI.ContentSafety" + namespace: "{package-dir}" + clear-output-folder: true + model-namespace: false + # "@azure-tools/typespec-ts": + # package-dir: "contentsafety-rest" + # generateMetadata: true + # generateTest: true + # azureSdkForJs: true + # packageDetails: + # name: "@azure-rest/contentsafety-rest" + # description: "ContentSafety Service" + # "@azure-tools/typespec-java": + # package-dir: "contentsafety" + # namespace: com.contentsafety diff --git a/specification/cognitiveservices/ContentSafety/main.tsp b/specification/cognitiveservices/ContentSafety/main.tsp index c9d893bf39bd..1a746db9fd1d 100644 --- a/specification/cognitiveservices/ContentSafety/main.tsp +++ b/specification/cognitiveservices/ContentSafety/main.tsp @@ -13,7 +13,16 @@ using Azure.Core; title: "ContentSafety Service", }) @versioned(ContentSafety.Versions) -@useAuth(ApiKeyAuth) +@useAuth( + ApiKeyAuth | 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", @@ -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", } diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index d02405ef8d2c..17bb82176127 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -3,11 +3,12 @@ import "@typespec/rest"; using TypeSpec.Http; using TypeSpec.Rest; +using TypeSpec.Versioning; namespace ContentSafety; #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" -@doc("Text analyze category") +@doc("Text analyze category.") enum TextCategory { Hate, SelfHarm, @@ -16,7 +17,7 @@ enum TextCategory { } #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" -@doc("Image analyze category") +@doc("Image analyze category.") enum ImageCategory { Hate, SelfHarm, @@ -24,111 +25,105 @@ enum ImageCategory { Violence, } -@doc("The analysis request of the text.") +@doc("The type of text analysis output.") +enum AnalyzeTextOutputType { + @doc("Output severities in four levels, the value could be 0,2,4,6.") + FourSeverityLevels, +} + +@doc("The type of image analysis output.") +enum AnalyzeImageOutputType { + @doc("Output severities in four levels, the value could be 0,2,4,6.") + FourSeverityLevels, +} + +@doc("The text analysis request.") model AnalyzeTextOptions { - @doc("The text needs to be scanned. We support at most 1000 characters (unicode code points) in text of one request.") - @maxLength(1000) + @doc("The text needs to be analyzed. We support a maximum of 10k Unicode characters (Unicode code points) in the text of one request.") + @maxLength(10000) text: string; - @doc("The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned.") + @doc("The categories will be analyzed. If they are not assigned, a default set of analysis results for the categories will be returned.") categories?: TextCategory[]; @doc("The names of blocklists.") blocklistNames?: string[]; @doc("When set to true, further analyses of harmful content will not be performed in cases where blocklists are hit. When set to false, all analyses of harmful content will be performed, whether or not blocklists are hit.") - breakByBlocklists?: boolean; + haltOnBlocklistHit?: boolean; + + @doc("This refers to the type of text analysis output. If no value is assigned, the default value will be \"FourSeverityLevels\".") + outputType?: AnalyzeTextOutputType = AnalyzeTextOutputType.FourSeverityLevels; } -@doc("The analysis response of the text") +@doc("The text analysis response.") model AnalyzeTextResult { - @doc("The details of blocklist match.") - blocklistsMatchResults?: TextBlocklistMatchResult[]; - - @doc("Analysis result for Hate category.") - hateResult?: TextAnalyzeSeverityResult; + @doc("The blocklist match details.") + blocklistsMatch?: TextBlocklistMatch[]; - @doc("Analysis result for SelfHarm category.") - selfHarmResult?: TextAnalyzeSeverityResult; - - @doc("Analysis result for Sexual category.") - sexualResult?: TextAnalyzeSeverityResult; - - @doc("Analysis result for Violence category.") - violenceResult?: TextAnalyzeSeverityResult; + @doc("Analysis result for categories.") + categoriesAnalysis: TextCategoriesAnalysis[]; } @doc("The result of blocklist match.") -model TextBlocklistMatchResult { - @doc("The name of matched blocklist.") +model TextBlocklistMatch { + @doc("The name of the matched blocklist.") @maxLength(64) blocklistName: string; - @doc("The id of matched item.") + @doc("The ID of the matched item.") @maxLength(64) - blockItemId: string; + blocklistItemId: string; - @doc("The content of matched item.") + @doc("The content of the matched item.") @maxLength(128) - blockItemText: string; - - @doc("The character offset of matched text in original input.") - offset: int32; - - @doc("The length of matched text in original input.") - length: int32; + blocklistItemText: string; } @doc("Text analysis result.") -model TextAnalyzeSeverityResult { - @doc("The text category.") +model TextCategoriesAnalysis { + @doc("The text analysis category.") category: TextCategory; - @doc("The higher the severity of input content, the larger this value is. The values could be: 0,2,4,6.") - severity: int32; + @doc("The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' is chosen, this field will be included in the output. The value can be 0, 2, 4, or 6, and it increases with the severity of the input content.") + severity?: int32; } -@doc("The analysis request of the image.") +@doc("The image analysis request.") model AnalyzeImageOptions { @doc("The image needs to be analyzed.") image: ImageData; - @doc("The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned.") + @doc("The categories will be analyzed. If they are not assigned, a default set of analysis results for the categories will be returned.") categories?: ImageCategory[]; + + @doc("This refers to the type of image analysis output. If no value is assigned, the default value will be \"FourSeverityLevels\".") + outputType?: AnalyzeImageOutputType = AnalyzeImageOutputType.FourSeverityLevels; } -@doc("The content or blob url of image, could be base64 encoding bytes or blob url. If both are given, the request will be refused. The maximum size of image is 2048 pixels * 2048 pixels, no larger than 4MB at the same time. The minimum size of image is 50 pixels * 50 pixels.") +@doc("The image can be either base64 encoded bytes or a blob URL. You can choose only one of these options. If both are provided, the request will be refused. The maximum image size is 2048 x 2048 pixels and should not exceed 4 MB, while the minimum image size is 50 x 50 pixels.") @projectedName("csharp", "ContentSafetyImageData") model ImageData { - @doc("Base64 encoding of image.") + @doc("The Base64 encoding of the image.") content?: bytes; - @doc("The blob url of image.") + @doc("The blob url of the image.") blobUrl?: url; } -@doc("The analysis response of the image.") +@doc("The image analysis response.") model AnalyzeImageResult { - @doc("Analysis result for Hate category.") - hateResult?: ImageAnalyzeSeverityResult; - - @doc("Analysis result for SelfHarm category.") - selfHarmResult?: ImageAnalyzeSeverityResult; - - @doc("Analysis result for Sexual category.") - sexualResult?: ImageAnalyzeSeverityResult; - - @doc("Analysis result for Violence category.") - violenceResult?: ImageAnalyzeSeverityResult; + @doc("Analysis result for categories.") + categoriesAnalysis: ImageCategoriesAnalysis[]; } @doc("Image analysis result.") -model ImageAnalyzeSeverityResult { - @doc("The image category.") +model ImageCategoriesAnalysis { + @doc("The image analysis category.") category: ImageCategory; - @doc("The higher the severity of input content, the larger this value, currently its value could be: 0,2,4,6.") - severity: int32; + @doc("The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' is chosen, this field will be included in the output. The value can be 0, 2, 4, or 6, and it increases with the severity of the input content.") + severity?: int32; } @doc("Text Blocklist.") @@ -146,50 +141,39 @@ model TextBlocklist { description?: string; } -@doc("Item in TextBlocklist.") -@resource("blockItems") +@doc("Item in a TextBlocklist.") +@resource("blocklistItems") @parentResource(TextBlocklist) -model TextBlockItem { - @doc("Block Item Id. It will be uuid.") - @key("blockItemId") - @visibility("read", "create", "query") +model TextBlocklistItem { + @doc("The service will generate a BlocklistItemId, which will be a UUID.") + @key("blocklistItemId") + @visibility("read") @maxLength(64) - blockItemId: string; - - @doc("Block item description.") - @maxLength(1024) - description?: string; - - @doc("Block item content.") - @maxLength(128) - text: string; -} + blocklistItemId: string; -@doc("Block item info in text blocklist.") -model TextBlockItemInfo { - @doc("Block item description.") + @doc("BlocklistItem description.") @maxLength(1024) description?: string; - @doc("Block item content.") + @doc("BlocklistItem content.") @maxLength(128) text: string; } -@doc("The request of adding blockItems to text blocklist.") -model AddBlockItemsOptions { - @doc("Array of blockItemInfo to add.") - blockItems: TextBlockItemInfo[]; +@doc("The request to add blocklistItems to a text blocklist.") +model AddOrUpdateTextBlocklistItemsOptions { + @doc("Array of blocklistItems to add.") + blocklistItems: TextBlocklistItem[]; } -@doc("The response of adding blockItems to text blocklist.") -model AddBlockItemsResult { - @doc("Array of blockItems added.") - value?: TextBlockItem[]; +@doc("The response of adding blocklistItems to the text blocklist.") +model AddOrUpdateTextBlocklistItemsResult { + @doc("Array of blocklistItems have been added.") + blocklistItems?: TextBlocklistItem[]; } -@doc("The request of removing blockItems from text blocklist.") -model RemoveBlockItemsOptions { - @doc("Array of blockItemIds to remove.") - blockItemIds: string[]; +@doc("The request to remove blocklistItems from a text blocklist.") +model RemoveTextBlocklistItemsOptions { + @doc("Array of blocklistItemIds to remove.") + blocklistItemIds: string[]; } diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 17ee1dbe0c96..175efbe5210a 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -13,13 +13,13 @@ namespace ContentSafety; interface TextOperations { @summary("Analyze Text") - @doc("A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence.") + @doc("A synchronous API for the analysis of potentially harmful text content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.") @route("/text:analyze") @post analyzeText is Azure.Core.RpcOperation< { @body - @doc("The request of text analysis.") + @doc("The text analysis request.") body: AnalyzeTextOptions; }, AnalyzeTextResult @@ -28,12 +28,12 @@ interface TextOperations { interface ImageOperations { @summary("Analyze Image") - @doc("A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence.") + @doc("A synchronous API for the analysis of potentially harmful image content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.") @route("/image:analyze") @post analyzeImage is Azure.Core.RpcOperation< { - @doc("The analysis request of the image.") + @doc("The image analysis request.") @body body: AnalyzeImageOptions; }, @@ -52,7 +52,7 @@ interface TextBlocklists { getTextBlocklist is BlockOps.ResourceRead; @summary("Create Or Update Text Blocklist") - @doc("Updates a text blocklist, if blocklistName does not exist, create a new blocklist.") + @doc("Updates a text blocklist. If the blocklistName does not exist, a new blocklist will be created.") createOrUpdateTextBlocklist is BlockOps.ResourceCreateOrUpdate; @summary("Delete Text Blocklist By blocklistName") @@ -63,30 +63,30 @@ interface TextBlocklists { @doc("Get all text blocklists details.") listTextBlocklists is BlockOps.ResourceList; - @summary("Add BlockItems To Text Blocklist") - @doc("Add blockItems to a text blocklist. You can add at most 100 BlockItems in one request.") - addBlockItems is BlockOps.ResourceAction< + @summary("Add or update BlocklistItems To Text Blocklist") + @doc("Add or update blocklistItems to a text blocklist. You can add or update at most 100 blocklistItems in one request.") + addOrUpdateBlocklistItems is BlockOps.ResourceAction< TextBlocklist, - AddBlockItemsOptions, - AddBlockItemsResult + AddOrUpdateTextBlocklistItemsOptions, + AddOrUpdateTextBlocklistItemsResult >; - @summary("Remove BlockItems From Text Blocklist") - @doc("Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request.") - removeBlockItems is BlockOps.ResourceAction< + @summary("Remove BlocklistItems From Text Blocklist") + @doc("Remove blocklistItems from a text blocklist. You can remove at most 100 BlocklistItems in one request.") + removeBlocklistItems is BlockOps.ResourceAction< TextBlocklist, - RemoveBlockItemsOptions, + RemoveTextBlocklistItemsOptions, NoContentResponse >; - @summary("Get BlockItem By blocklistName And blockItemId") - @doc("Get blockItem By blockItemId from a text blocklist.") - getTextBlocklistItem is BlockOps.ResourceRead; + @summary("Get BlocklistItem By blocklistName And blocklistItemId") + @doc("Get blocklistItem by blocklsitName and blocklistItemId from a text blocklist.") + getTextBlocklistItem is BlockOps.ResourceRead; - @summary("Get All BlockItems By blocklistName") - @doc("Get all blockItems in a text blocklist") + @summary("Get All BlocklistItems By blocklistName") + @doc("Get all blocklistItems in a text blocklist.") listTextBlocklistItems is BlockOps.ResourceList< - TextBlockItem, + TextBlocklistItem, ListQueryParametersTrait >; } diff --git a/specification/cognitiveservices/ContentSafety/tspconfig.yaml b/specification/cognitiveservices/ContentSafety/tspconfig.yaml index 6d8f2bfee5ef..c678d98928ff 100644 --- a/specification/cognitiveservices/ContentSafety/tspconfig.yaml +++ b/specification/cognitiveservices/ContentSafety/tspconfig.yaml @@ -8,9 +8,10 @@ options: emitter-output-dir: "{project-root}/../" output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/contentsafety.json" azure-resource-provider-folder: "data-plane" - examples-directory: examples + examples-directory: ./examples "@azure-tools/typespec-python": package-dir: "azure-ai-contentsafety" + package-version: "1.0.0" package-name: "{package-dir}" package-mode: dataplane "@azure-tools/typespec-csharp": @@ -18,14 +19,13 @@ options: namespace: "{package-dir}" clear-output-folder: true model-namespace: false - # "@azure-tools/typespec-ts": - # package-dir: "contentsafety-rest" - # generateMetadata: true - # generateTest: true - # azureSdkForJs: true - # packageDetails: - # name: "@azure-rest/contentsafety-rest" - # description: "ContentSafety Service" - # "@azure-tools/typespec-java": - # package-dir: "contentsafety" - # namespace: com.contentsafety + "@azure-tools/typespec-ts": + package-dir: "azure-ai-content-safety-rest" + packageDetails: + name: "@azure-rest/ai-content-safety" + version: "1.0.0" + description: "ContentSafety Service" + "@azure-tools/typespec-java": + package-dir: "azure-ai-contentsafety" + namespace: com.azure.ai.contentsafety + examples-directory: examples diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json new file mode 100644 index 000000000000..d9c376bf9cc3 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json @@ -0,0 +1,1028 @@ +{ + "swagger": "2.0", + "info": { + "title": "ContentSafety Service", + "version": "2023-10-01", + "description": "Analyze harmful content", + "x-typespec-generated": [ + { + "emitter": "@azure-tools/typespec-autorest" + } + ] + }, + "schemes": [ + "https" + ], + "x-ms-parameterized-host": { + "hostTemplate": "{endpoint}/contentsafety", + "useSchemePrefix": false, + "parameters": [ + { + "name": "endpoint", + "in": "path", + "required": true, + "description": "Supported Cognitive Services endpoints (protocol and hostname, for example:\nhttps://.cognitiveservices.azure.com).", + "type": "string" + } + ] + }, + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], + "security": [ + { + "ApiKeyAuth": [] + }, + { + "OAuth2Auth": [ + "https://cognitiveservices.azure.com/.default" + ] + } + ], + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "Ocp-Apim-Subscription-Key", + "in": "header" + }, + "OAuth2Auth": { + "type": "oauth2", + "flow": "application", + "scopes": { + "https://cognitiveservices.azure.com/.default": "" + }, + "tokenUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/token" + } + }, + "tags": [], + "paths": { + "/image:analyze": { + "post": { + "operationId": "ImageOperations_AnalyzeImage", + "summary": "Analyze Image", + "description": "A synchronous API for the analysis of potentially harmful image content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "body", + "in": "body", + "description": "The image analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/AnalyzeImageOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AnalyzeImageResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + } + } + } + } + }, + "/text/blocklists": { + "get": { + "operationId": "TextBlocklists_ListTextBlocklists", + "summary": "Get All Text Blocklists", + "description": "Get all text blocklists details.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/PagedTextBlocklist" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/text/blocklists/{blocklistName}": { + "get": { + "operationId": "TextBlocklists_GetTextBlocklist", + "summary": "Get Text Blocklist By blocklistName", + "description": "Returns text blocklist details.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "blocklistName", + "in": "path", + "description": "Text blocklist name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextBlocklist" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + } + } + } + }, + "patch": { + "operationId": "TextBlocklists_CreateOrUpdateTextBlocklist", + "summary": "Create Or Update Text Blocklist", + "description": "Updates a text blocklist. If the blocklistName does not exist, a new blocklist will be created.", + "consumes": [ + "application/merge-patch+json" + ], + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "blocklistName", + "in": "path", + "description": "Text blocklist name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "resource", + "in": "body", + "description": "The resource instance.", + "required": true, + "schema": { + "$ref": "#/definitions/TextBlocklistUpdate" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextBlocklist" + } + }, + "201": { + "description": "The request has succeeded and a new resource has been created as a result.", + "schema": { + "$ref": "#/definitions/TextBlocklist" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + } + } + } + }, + "delete": { + "operationId": "TextBlocklists_DeleteTextBlocklist", + "summary": "Delete Text Blocklist By blocklistName", + "description": "Deletes a text blocklist.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "blocklistName", + "in": "path", + "description": "Text blocklist name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + } + ], + "responses": { + "204": { + "description": "There is no content to send for this request, but the headers may be useful. " + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + } + } + } + } + }, + "/text/blocklists/{blocklistName}:addOrUpdateBlocklistItems": { + "post": { + "operationId": "TextBlocklists_AddOrUpdateBlocklistItems", + "summary": "Add or update BlocklistItems To Text Blocklist", + "description": "Add or update blocklistItems to a text blocklist. You can add or update at most 100 blocklistItems in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "blocklistName", + "in": "path", + "description": "Text blocklist name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddOrUpdateTextBlocklistItemsOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AddOrUpdateTextBlocklistItemsResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + } + } + } + } + }, + "/text/blocklists/{blocklistName}:removeBlocklistItems": { + "post": { + "operationId": "TextBlocklists_RemoveBlocklistItems", + "summary": "Remove BlocklistItems From Text Blocklist", + "description": "Remove blocklistItems from a text blocklist. You can remove at most 100 BlocklistItems in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "blocklistName", + "in": "path", + "description": "Text blocklist name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RemoveTextBlocklistItemsOptions" + } + } + ], + "responses": { + "204": { + "description": "There is no content to send for this request, but the headers may be useful. " + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + } + } + } + } + }, + "/text/blocklists/{blocklistName}/blocklistItems": { + "get": { + "operationId": "TextBlocklists_ListTextBlocklistItems", + "summary": "Get All BlocklistItems By blocklistName", + "description": "Get all blocklistItems in a text blocklist.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "blocklistName", + "in": "path", + "description": "Text blocklist name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "$ref": "#/parameters/Azure.Core.TopQueryParameter" + }, + { + "$ref": "#/parameters/Azure.Core.SkipQueryParameter" + }, + { + "$ref": "#/parameters/Azure.Core.MaxPageSizeQueryParameter" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/PagedTextBlocklistItem" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/text/blocklists/{blocklistName}/blocklistItems/{blocklistItemId}": { + "get": { + "operationId": "TextBlocklists_GetTextBlocklistItem", + "summary": "Get BlocklistItem By blocklistName And blocklistItemId", + "description": "Get blocklistItem by blocklsitName and blocklistItemId from a text blocklist.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "blocklistName", + "in": "path", + "description": "Text blocklist name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "blocklistItemId", + "in": "path", + "description": "The service will generate a BlocklistItemId, which will be a UUID.", + "required": true, + "type": "string", + "maxLength": 64 + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextBlocklistItem" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + } + } + } + } + }, + "/text:analyze": { + "post": { + "operationId": "TextOperations_AnalyzeText", + "summary": "Analyze Text", + "description": "A synchronous API for the analysis of potentially harmful text content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "body", + "in": "body", + "description": "The text analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/AnalyzeTextOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AnalyzeTextResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + } + } + } + } + } + }, + "definitions": { + "AddOrUpdateTextBlocklistItemsOptions": { + "type": "object", + "description": "The request to add blocklistItems to a text blocklist.", + "properties": { + "blocklistItems": { + "type": "array", + "description": "Array of blocklistItems to add.", + "items": { + "$ref": "#/definitions/TextBlocklistItem" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "blocklistItems" + ] + }, + "AddOrUpdateTextBlocklistItemsResult": { + "type": "object", + "description": "The response of adding blocklistItems to the text blocklist.", + "properties": { + "blocklistItems": { + "type": "array", + "description": "Array of blocklistItems have been added.", + "items": { + "$ref": "#/definitions/TextBlocklistItem" + }, + "x-ms-identifiers": [] + } + } + }, + "AnalyzeImageOptions": { + "type": "object", + "description": "The image analysis request.", + "properties": { + "image": { + "$ref": "#/definitions/ImageData", + "description": "The image needs to be analyzed." + }, + "categories": { + "type": "array", + "description": "The categories will be analyzed. If they are not assigned, a default set of analysis results for the categories will be returned.", + "items": { + "$ref": "#/definitions/ImageCategory" + } + }, + "outputType": { + "$ref": "#/definitions/AnalyzeImageOutputType", + "description": "This refers to the type of image analysis output. If no value is assigned, the default value will be \"FourSeverityLevels\".", + "default": "FourSeverityLevels" + } + }, + "required": [ + "image" + ] + }, + "AnalyzeImageOutputType": { + "type": "string", + "description": "The type of image analysis output.", + "enum": [ + "FourSeverityLevels" + ], + "x-ms-enum": { + "name": "AnalyzeImageOutputType", + "modelAsString": true, + "values": [ + { + "name": "FourSeverityLevels", + "value": "FourSeverityLevels", + "description": "Output severities in four levels, the value could be 0,2,4,6." + } + ] + } + }, + "AnalyzeImageResult": { + "type": "object", + "description": "The image analysis response.", + "properties": { + "categoriesAnalysis": { + "type": "array", + "description": "Analysis result for categories.", + "items": { + "$ref": "#/definitions/ImageCategoriesAnalysis" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "categoriesAnalysis" + ] + }, + "AnalyzeTextOptions": { + "type": "object", + "description": "The text analysis request.", + "properties": { + "text": { + "type": "string", + "description": "The text needs to be analyzed. We support a maximum of 10k Unicode characters (Unicode code points) in the text of one request.", + "maxLength": 10000 + }, + "categories": { + "type": "array", + "description": "The categories will be analyzed. If they are not assigned, a default set of analysis results for the categories will be returned.", + "items": { + "$ref": "#/definitions/TextCategory" + } + }, + "blocklistNames": { + "type": "array", + "description": "The names of blocklists.", + "items": { + "type": "string" + } + }, + "haltOnBlocklistHit": { + "type": "boolean", + "description": "When set to true, further analyses of harmful content will not be performed in cases where blocklists are hit. When set to false, all analyses of harmful content will be performed, whether or not blocklists are hit." + }, + "outputType": { + "$ref": "#/definitions/AnalyzeTextOutputType", + "description": "This refers to the type of text analysis output. If no value is assigned, the default value will be \"FourSeverityLevels\".", + "default": "FourSeverityLevels" + } + }, + "required": [ + "text" + ] + }, + "AnalyzeTextOutputType": { + "type": "string", + "description": "The type of text analysis output.", + "enum": [ + "FourSeverityLevels" + ], + "x-ms-enum": { + "name": "AnalyzeTextOutputType", + "modelAsString": true, + "values": [ + { + "name": "FourSeverityLevels", + "value": "FourSeverityLevels", + "description": "Output severities in four levels, the value could be 0,2,4,6." + } + ] + } + }, + "AnalyzeTextResult": { + "type": "object", + "description": "The text analysis response.", + "properties": { + "blocklistsMatch": { + "type": "array", + "description": "The blocklist match details.", + "items": { + "$ref": "#/definitions/TextBlocklistMatch" + }, + "x-ms-identifiers": [] + }, + "categoriesAnalysis": { + "type": "array", + "description": "Analysis result for categories.", + "items": { + "$ref": "#/definitions/TextCategoriesAnalysis" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "categoriesAnalysis" + ] + }, + "Azure.Core.Foundations.Error": { + "type": "object", + "description": "The error object.", + "properties": { + "code": { + "type": "string", + "description": "One of a server-defined set of error codes." + }, + "message": { + "type": "string", + "description": "A human-readable representation of the error." + }, + "target": { + "type": "string", + "description": "The target of the error." + }, + "details": { + "type": "array", + "description": "An array of details about specific errors that led to this reported error.", + "items": { + "$ref": "#/definitions/Azure.Core.Foundations.Error" + }, + "x-ms-identifiers": [] + }, + "innererror": { + "$ref": "#/definitions/Azure.Core.Foundations.InnerError", + "description": "An object containing more specific information than the current object about the error." + } + }, + "required": [ + "code", + "message" + ] + }, + "Azure.Core.Foundations.ErrorResponse": { + "type": "object", + "description": "A response containing error details.", + "properties": { + "error": { + "$ref": "#/definitions/Azure.Core.Foundations.Error", + "description": "The error object." + } + }, + "required": [ + "error" + ] + }, + "Azure.Core.Foundations.InnerError": { + "type": "object", + "description": "An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", + "properties": { + "code": { + "type": "string", + "description": "One of a server-defined set of error codes." + }, + "innererror": { + "$ref": "#/definitions/Azure.Core.Foundations.InnerError", + "description": "Inner error." + } + } + }, + "ImageCategoriesAnalysis": { + "type": "object", + "description": "Image analysis result.", + "properties": { + "category": { + "$ref": "#/definitions/ImageCategory", + "description": "The image analysis category." + }, + "severity": { + "type": "integer", + "format": "int32", + "description": "The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' is chosen, this field will be included in the output. The value can be 0, 2, 4, or 6, and it increases with the severity of the input content." + } + }, + "required": [ + "category" + ] + }, + "ImageCategory": { + "type": "string", + "description": "Image analyze category.", + "enum": [ + "Hate", + "SelfHarm", + "Sexual", + "Violence" + ], + "x-ms-enum": { + "name": "ImageCategory", + "modelAsString": true + } + }, + "ImageData": { + "type": "object", + "description": "The image can be either base64 encoded bytes or a blob URL. You can choose only one of these options. If both are provided, the request will be refused. The maximum image size is 2048 x 2048 pixels and should not exceed 4 MB, while the minimum image size is 50 x 50 pixels.", + "properties": { + "content": { + "type": "string", + "format": "byte", + "description": "The Base64 encoding of the image." + }, + "blobUrl": { + "type": "string", + "format": "uri", + "description": "The blob url of the image." + } + } + }, + "PagedTextBlocklist": { + "type": "object", + "description": "Paged collection of TextBlocklist items", + "properties": { + "value": { + "type": "array", + "description": "The TextBlocklist items on this page", + "items": { + "$ref": "#/definitions/TextBlocklist" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "PagedTextBlocklistItem": { + "type": "object", + "description": "Paged collection of TextBlocklistItem items", + "properties": { + "value": { + "type": "array", + "description": "The TextBlocklistItem items on this page", + "items": { + "$ref": "#/definitions/TextBlocklistItem" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "RemoveTextBlocklistItemsOptions": { + "type": "object", + "description": "The request to remove blocklistItems from a text blocklist.", + "properties": { + "blocklistItemIds": { + "type": "array", + "description": "Array of blocklistItemIds to remove.", + "items": { + "type": "string" + } + } + }, + "required": [ + "blocklistItemIds" + ] + }, + "TextBlocklist": { + "type": "object", + "description": "Text Blocklist.", + "properties": { + "blocklistName": { + "type": "string", + "description": "Text blocklist name.", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "description": { + "type": "string", + "description": "Text blocklist description.", + "maxLength": 1024 + } + }, + "required": [ + "blocklistName" + ] + }, + "TextBlocklistItem": { + "type": "object", + "description": "Item in a TextBlocklist.", + "properties": { + "blocklistItemId": { + "type": "string", + "description": "The service will generate a BlocklistItemId, which will be a UUID.", + "maxLength": 64, + "readOnly": true + }, + "description": { + "type": "string", + "description": "BlocklistItem description.", + "maxLength": 1024 + }, + "text": { + "type": "string", + "description": "BlocklistItem content.", + "maxLength": 128 + } + }, + "required": [ + "blocklistItemId", + "text" + ] + }, + "TextBlocklistMatch": { + "type": "object", + "description": "The result of blocklist match.", + "properties": { + "blocklistName": { + "type": "string", + "description": "The name of the matched blocklist.", + "maxLength": 64 + }, + "blocklistItemId": { + "type": "string", + "description": "The ID of the matched item.", + "maxLength": 64 + }, + "blocklistItemText": { + "type": "string", + "description": "The content of the matched item.", + "maxLength": 128 + } + }, + "required": [ + "blocklistName", + "blocklistItemId", + "blocklistItemText" + ] + }, + "TextBlocklistUpdate": { + "type": "object", + "description": "Text Blocklist.", + "properties": { + "description": { + "type": "string", + "description": "Text blocklist description.", + "maxLength": 1024 + } + } + }, + "TextCategoriesAnalysis": { + "type": "object", + "description": "Text analysis result.", + "properties": { + "category": { + "$ref": "#/definitions/TextCategory", + "description": "The text analysis category." + }, + "severity": { + "type": "integer", + "format": "int32", + "description": "The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' is chosen, this field will be included in the output. The value can be 0, 2, 4, or 6, and it increases with the severity of the input content." + } + }, + "required": [ + "category" + ] + }, + "TextCategory": { + "type": "string", + "description": "Text analyze category.", + "enum": [ + "Hate", + "SelfHarm", + "Sexual", + "Violence" + ], + "x-ms-enum": { + "name": "TextCategory", + "modelAsString": true + } + }, + "Versions": { + "type": "string", + "enum": [ + "2023-10-01" + ], + "x-ms-enum": { + "name": "Versions", + "modelAsString": true, + "values": [ + { + "name": "v2023_10_01", + "value": "2023-10-01" + } + ] + } + } + }, + "parameters": { + "Azure.Core.Foundations.ApiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API version to use for this operation.", + "required": true, + "type": "string", + "minLength": 1, + "x-ms-parameter-location": "method", + "x-ms-client-name": "apiVersion" + }, + "Azure.Core.MaxPageSizeQueryParameter": { + "name": "maxpagesize", + "in": "query", + "description": "The maximum number of result items per page.", + "required": false, + "type": "integer", + "format": "int32", + "x-ms-parameter-location": "method" + }, + "Azure.Core.SkipQueryParameter": { + "name": "skip", + "in": "query", + "description": "The number of result items to skip.", + "required": false, + "type": "integer", + "format": "int32", + "default": 0, + "x-ms-parameter-location": "method" + }, + "Azure.Core.TopQueryParameter": { + "name": "top", + "in": "query", + "description": "The number of result items to return.", + "required": false, + "type": "integer", + "format": "int32", + "x-ms-parameter-location": "method" + } + } +} From a1382711205bf14d02ce4671cd45afff14c53877 Mon Sep 17 00:00:00 2001 From: mengaims Date: Thu, 24 Aug 2023 14:54:40 +0800 Subject: [PATCH 02/15] Update examples for 2023-10-01 --- .../2023-04-30-preview/AnalyzeImage.json | 34 ---------------- .../2023-04-30-preview/AnalyzeText.json | 33 --------------- .../AddOrUpdateBlocklistItems.json} | 12 +++--- .../examples/2023-10-01/AnalyzeImage.json | 36 +++++++++++++++++ .../examples/2023-10-01/AnalyzeText.json | 35 ++++++++++++++++ .../CreateOrUpdateTextBlocklist.json | 2 +- .../DeleteTextBlocklist.json | 2 +- .../GetTextBlocklist.json | 2 +- .../GetTextBlocklistItem.json | 8 ++-- .../ListTextBlocklistItems.json | 4 +- .../ListTextBlocklists.json | 2 +- .../RemoveBlocklistItems.json} | 2 +- .../stable/2023-10-01/contentsafety.json | 40 +++++++++++++++++++ .../2023-10-01/examples/AnalyzeImage.json | 36 +++++++++++++++++ .../2023-10-01/examples/AnalyzeText.json | 35 ++++++++++++++++ .../examples/CreateOrUpdateTextBlocklist.json | 25 ++++++++++++ .../examples/DeleteTextBlocklist.json | 11 +++++ .../2023-10-01/examples/GetTextBlocklist.json | 16 ++++++++ .../examples/GetTextBlocklistItem.json | 18 +++++++++ .../examples/ListTextBlocklistItems.json | 21 ++++++++++ .../examples/ListTextBlocklists.json | 19 +++++++++ 21 files changed, 309 insertions(+), 84 deletions(-) delete mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/AnalyzeImage.json delete mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/AnalyzeText.json rename specification/cognitiveservices/ContentSafety/examples/{2023-04-30-preview/AddBlockItems.json => 2023-10-01/AddOrUpdateBlocklistItems.json} (56%) create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-01/AnalyzeImage.json create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-01/AnalyzeText.json rename specification/cognitiveservices/ContentSafety/examples/{2023-04-30-preview => 2023-10-01}/CreateOrUpdateTextBlocklist.json (92%) rename specification/cognitiveservices/ContentSafety/examples/{2023-04-30-preview => 2023-10-01}/DeleteTextBlocklist.json (83%) rename specification/cognitiveservices/ContentSafety/examples/{2023-04-30-preview => 2023-10-01}/GetTextBlocklist.json (88%) rename specification/cognitiveservices/ContentSafety/examples/{2023-04-30-preview => 2023-10-01}/GetTextBlocklistItem.json (51%) rename specification/cognitiveservices/ContentSafety/examples/{2023-04-30-preview => 2023-10-01}/ListTextBlocklistItems.json (76%) rename specification/cognitiveservices/ContentSafety/examples/{2023-04-30-preview => 2023-10-01}/ListTextBlocklists.json (89%) rename specification/cognitiveservices/ContentSafety/examples/{2023-04-30-preview/RemoveBlockItems.json => 2023-10-01/RemoveBlocklistItems.json} (88%) create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AnalyzeImage.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AnalyzeText.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/CreateOrUpdateTextBlocklist.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/DeleteTextBlocklist.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/GetTextBlocklist.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/GetTextBlocklistItem.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/ListTextBlocklistItems.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/ListTextBlocklists.json diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/AnalyzeImage.json b/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/AnalyzeImage.json deleted file mode 100644 index 7224de71454c..000000000000 --- a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/AnalyzeImage.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "title": "Analyze Image", - "operationId": "ImageOperations_AnalyzeImage", - "parameters": { - "api-version": "2023-04-30-preview", - "body": { - "image": { - "content": "Y29udGVudDE=" - } - } - }, - "responses": { - "200": { - "body": { - "hateResult": { - "category": "Hate", - "severity": 0 - }, - "selfHarmResult": { - "category": "Hate", - "severity": 0 - }, - "sexualResult": { - "category": "Hate", - "severity": 0 - }, - "violenceResult": { - "category": "Hate", - "severity": 2 - } - } - } - } -} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/AnalyzeText.json b/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/AnalyzeText.json deleted file mode 100644 index 5d5bf56e9fcf..000000000000 --- a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/AnalyzeText.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "title": "Analyze Text", - "operationId": "TextOperations_AnalyzeText", - "parameters": { - "api-version": "2023-04-30-preview", - "body": { - "text": "This is text example" - } - }, - "responses": { - "200": { - "body": { - "blocklistsMatchResults": [], - "hateResult": { - "category": "Hate", - "severity": 0 - }, - "selfHarmResult": { - "category": "SelfHarm", - "severity": 0 - }, - "sexualResult": { - "category": "Sexual", - "severity": 0 - }, - "violenceResult": { - "category": "Violence", - "severity": 0 - } - } - } - } -} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/AddBlockItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json similarity index 56% rename from specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/AddBlockItems.json rename to specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json index 3670641ca73b..cd965e6fac5e 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/AddBlockItems.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json @@ -1,11 +1,11 @@ { - "title": "Add BlockItems To Text Blocklist", - "operationId": "TextBlocklists_AddBlockItems", + "title": "Add BlocklistItems To Text Blocklist", + "operationId": "TextBlocklists_AddBlocklistItems", "parameters": { - "api-version": "2023-04-30-preview", + "api-version": "2023-10-01", "blocklistName": "TestBlocklist", "body": { - "blockItems": [ + "blocklistItems": [ { "description": "Hate word", "text": "hate" @@ -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" } diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AnalyzeImage.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AnalyzeImage.json new file mode 100644 index 000000000000..75f7ab051cc3 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AnalyzeImage.json @@ -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 + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AnalyzeText.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AnalyzeText.json new file mode 100644 index 000000000000..89b47828f6df --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AnalyzeText.json @@ -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 + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/CreateOrUpdateTextBlocklist.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/CreateOrUpdateTextBlocklist.json similarity index 92% rename from specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/CreateOrUpdateTextBlocklist.json rename to specification/cognitiveservices/ContentSafety/examples/2023-10-01/CreateOrUpdateTextBlocklist.json index c20bc792687d..4d616948efd2 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/CreateOrUpdateTextBlocklist.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/CreateOrUpdateTextBlocklist.json @@ -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" diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/DeleteTextBlocklist.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/DeleteTextBlocklist.json similarity index 83% rename from specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/DeleteTextBlocklist.json rename to specification/cognitiveservices/ContentSafety/examples/2023-10-01/DeleteTextBlocklist.json index c671893d679a..b49d67d1d198 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/DeleteTextBlocklist.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/DeleteTextBlocklist.json @@ -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": { diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/GetTextBlocklist.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/GetTextBlocklist.json similarity index 88% rename from specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/GetTextBlocklist.json rename to specification/cognitiveservices/ContentSafety/examples/2023-10-01/GetTextBlocklist.json index 4969426906de..60083cd40015 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/GetTextBlocklist.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/GetTextBlocklist.json @@ -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": { diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/GetTextBlocklistItem.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/GetTextBlocklistItem.json similarity index 51% rename from specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/GetTextBlocklistItem.json rename to specification/cognitiveservices/ContentSafety/examples/2023-10-01/GetTextBlocklistItem.json index 94da2bfbdaa9..3ad3e2d8efdd 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/GetTextBlocklistItem.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/GetTextBlocklistItem.json @@ -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" } diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/ListTextBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/ListTextBlocklistItems.json similarity index 76% rename from specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/ListTextBlocklistItems.json rename to specification/cognitiveservices/ContentSafety/examples/2023-10-01/ListTextBlocklistItems.json index 6c7955b98842..dd35a0f161b8 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/ListTextBlocklistItems.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/ListTextBlocklistItems.json @@ -2,7 +2,7 @@ "title": "Get All BlockItems By blocklistName", "operationId": "TextBlocklists_ListTextBlocklistItems", "parameters": { - "api-version": "2023-04-30-preview", + "api-version": "2023-10-01", "blocklistName": "TestBlocklist" }, "responses": { @@ -10,7 +10,7 @@ "body": { "value": [ { - "blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", + "blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", "description": "Hate word", "text": "hate" } diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/ListTextBlocklists.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/ListTextBlocklists.json similarity index 89% rename from specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/ListTextBlocklists.json rename to specification/cognitiveservices/ContentSafety/examples/2023-10-01/ListTextBlocklists.json index ea72669941d3..458ac585cc0f 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/ListTextBlocklists.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/ListTextBlocklists.json @@ -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": { diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/RemoveBlockItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json similarity index 88% rename from specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/RemoveBlockItems.json rename to specification/cognitiveservices/ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json index fc7ea3a3fea3..0a033af53edc 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-04-30-preview/RemoveBlockItems.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json @@ -2,7 +2,7 @@ "title": "Remove BlockItems From Text Blocklist", "operationId": "TextBlocklists_RemoveBlockItems", "parameters": { - "api-version": "2023-04-30-preview", + "api-version": "2023-10-01", "blocklistName": "TestBlocklist", "body": { "blockItemIds": [ diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json index d9c376bf9cc3..55bef393e974 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json @@ -97,6 +97,11 @@ } } } + }, + "x-ms-examples": { + "Analyze Image": { + "$ref": "./examples/AnalyzeImage.json" + } } } }, @@ -130,6 +135,11 @@ } } }, + "x-ms-examples": { + "Get All Text Blocklists": { + "$ref": "./examples/ListTextBlocklists.json" + } + }, "x-ms-pageable": { "nextLinkName": "nextLink" } @@ -173,6 +183,11 @@ } } } + }, + "x-ms-examples": { + "Get Text Blocklist By blocklistName": { + "$ref": "./examples/GetTextBlocklist.json" + } } }, "patch": { @@ -230,6 +245,11 @@ } } } + }, + "x-ms-examples": { + "Create Or Update Text Blocklist": { + "$ref": "./examples/CreateOrUpdateTextBlocklist.json" + } } }, "delete": { @@ -266,6 +286,11 @@ } } } + }, + "x-ms-examples": { + "Delete Text Blocklist By blocklistName": { + "$ref": "./examples/DeleteTextBlocklist.json" + } } } }, @@ -412,6 +437,11 @@ } } }, + "x-ms-examples": { + "Get All BlockItems By blocklistName": { + "$ref": "./examples/ListTextBlocklistItems.json" + } + }, "x-ms-pageable": { "nextLinkName": "nextLink" } @@ -463,6 +493,11 @@ } } } + }, + "x-ms-examples": { + "Get BlockItem By blocklistName And blocklistItemId": { + "$ref": "./examples/GetTextBlocklistItem.json" + } } } }, @@ -504,6 +539,11 @@ } } } + }, + "x-ms-examples": { + "Analyze Text": { + "$ref": "./examples/AnalyzeText.json" + } } } } diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AnalyzeImage.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AnalyzeImage.json new file mode 100644 index 000000000000..75f7ab051cc3 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AnalyzeImage.json @@ -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 + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AnalyzeText.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AnalyzeText.json new file mode 100644 index 000000000000..89b47828f6df --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AnalyzeText.json @@ -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 + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/CreateOrUpdateTextBlocklist.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/CreateOrUpdateTextBlocklist.json new file mode 100644 index 000000000000..4d616948efd2 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/CreateOrUpdateTextBlocklist.json @@ -0,0 +1,25 @@ +{ + "title": "Create Or Update Text Blocklist", + "operationId": "TextBlocklists_CreateOrUpdateTextBlocklist", + "parameters": { + "api-version": "2023-10-01", + "blocklistName": "TestBlocklist", + "resource": { + "description": "Test Blocklist" + } + }, + "responses": { + "200": { + "body": { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + }, + "201": { + "body": { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/DeleteTextBlocklist.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/DeleteTextBlocklist.json new file mode 100644 index 000000000000..b49d67d1d198 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/DeleteTextBlocklist.json @@ -0,0 +1,11 @@ +{ + "title": "Delete Text Blocklist By blocklistName", + "operationId": "TextBlocklists_DeleteTextBlocklist", + "parameters": { + "api-version": "2023-10-01", + "blocklistName": "TestBlocklist" + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/GetTextBlocklist.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/GetTextBlocklist.json new file mode 100644 index 000000000000..60083cd40015 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/GetTextBlocklist.json @@ -0,0 +1,16 @@ +{ + "title": "Get Text Blocklist By blocklistName", + "operationId": "TextBlocklists_GetTextBlocklist", + "parameters": { + "api-version": "2023-10-01", + "blocklistName": "TestBlocklist" + }, + "responses": { + "200": { + "body": { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/GetTextBlocklistItem.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/GetTextBlocklistItem.json new file mode 100644 index 000000000000..3ad3e2d8efdd --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/GetTextBlocklistItem.json @@ -0,0 +1,18 @@ +{ + "title": "Get BlockItem By blocklistName And blocklistItemId", + "operationId": "TextBlocklists_GetTextBlocklistItem", + "parameters": { + "api-version": "2023-10-01", + "blocklistName": "TestBlocklist", + "blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec" + }, + "responses": { + "200": { + "body": { + "blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", + "description": "Hate word", + "text": "hate" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/ListTextBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/ListTextBlocklistItems.json new file mode 100644 index 000000000000..dd35a0f161b8 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/ListTextBlocklistItems.json @@ -0,0 +1,21 @@ +{ + "title": "Get All BlockItems By blocklistName", + "operationId": "TextBlocklists_ListTextBlocklistItems", + "parameters": { + "api-version": "2023-10-01", + "blocklistName": "TestBlocklist" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", + "description": "Hate word", + "text": "hate" + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/ListTextBlocklists.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/ListTextBlocklists.json new file mode 100644 index 000000000000..458ac585cc0f --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/ListTextBlocklists.json @@ -0,0 +1,19 @@ +{ + "title": "Get All Text Blocklists", + "operationId": "TextBlocklists_ListTextBlocklists", + "parameters": { + "api-version": "2023-10-01" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + ] + } + } + } +} From f77463dfb5ed922b24968be2f72bfcabb6b80380 Mon Sep 17 00:00:00 2001 From: mengaims Date: Thu, 24 Aug 2023 15:25:35 +0800 Subject: [PATCH 03/15] Resolve ModelValidation SpellCheck and Avocado --- .../2023-10-01/AddOrUpdateBlocklistItems.json | 4 +-- .../2023-10-01/RemoveBlocklistItems.json | 2 +- .../data-plane/ContentSafety/readme.md | 16 ++++++++-- .../stable/2023-10-01/contentsafety.json | 10 +++++++ .../examples/AddOrUpdateBlocklistItems.json | 29 +++++++++++++++++++ .../examples/RemoveBlocklistItems.json | 16 ++++++++++ 6 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/RemoveBlocklistItems.json diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json index cd965e6fac5e..26c10fdbea21 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json @@ -1,6 +1,6 @@ { - "title": "Add BlocklistItems To Text Blocklist", - "operationId": "TextBlocklists_AddBlocklistItems", + "title": "Add or Update BlocklistItems To Text Blocklist", + "operationId": "TextBlocklists_AddOrUpdateBlocklistItems", "parameters": { "api-version": "2023-10-01", "blocklistName": "TestBlocklist", diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json index 0a033af53edc..fce25f982d17 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json @@ -1,6 +1,6 @@ { "title": "Remove BlockItems From Text Blocklist", - "operationId": "TextBlocklists_RemoveBlockItems", + "operationId": "TextBlocklists_RemoveBlocklistItems", "parameters": { "api-version": "2023-10-01", "blocklistName": "TestBlocklist", diff --git a/specification/cognitiveservices/data-plane/ContentSafety/readme.md b/specification/cognitiveservices/data-plane/ContentSafety/readme.md index 73b2584538b3..ffaf58b50998 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/readme.md +++ b/specification/cognitiveservices/data-plane/ContentSafety/readme.md @@ -1,6 +1,6 @@ # Content Safety -> see https://aka.ms/autorest +> see This is the AutoRest configuration file for Content Safety. @@ -26,7 +26,7 @@ These are the global settings for the Content Safety. ```yaml openapi-type: data-plane -tag: package-2023-04-30-preview +tag: package-2023-10-01 ``` ### Tag: package-2023-04-30-preview @@ -38,6 +38,15 @@ input-file: - preview/2023-04-30-preview/contentsafety.json ``` +### Tag: package-2023-10-01 + +These settings apply only when `--tag=package-2023-10-01` is specified on the command line. + +```yaml $(tag) == 'package-2023-10-01' +input-file: + - preview/2023-10-01/contentsafety.json +``` + --- # Code Generation @@ -57,6 +66,7 @@ swagger-to-sdk: - repo: azure-cli-extensions - repo: azure-powershell ``` + ## Az See configuration in [readme.az.md](./readme.az.md) @@ -75,4 +85,4 @@ See configuration in [readme.typescript.md](./readme.typescript.md) ## CSharp -See configuration in [readme.csharp.md](./readme.csharp.md) \ No newline at end of file +See configuration in [readme.csharp.md](./readme.csharp.md) diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json index 55bef393e974..24e067af1c8b 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json @@ -340,6 +340,11 @@ } } } + }, + "x-ms-examples": { + "Add or Update BlocklistItems To Text Blocklist": { + "$ref": "./examples/AddOrUpdateBlocklistItems.json" + } } } }, @@ -386,6 +391,11 @@ } } } + }, + "x-ms-examples": { + "Remove BlockItems From Text Blocklist": { + "$ref": "./examples/RemoveBlocklistItems.json" + } } } }, diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json new file mode 100644 index 000000000000..26c10fdbea21 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json @@ -0,0 +1,29 @@ +{ + "title": "Add or Update BlocklistItems To Text Blocklist", + "operationId": "TextBlocklists_AddOrUpdateBlocklistItems", + "parameters": { + "api-version": "2023-10-01", + "blocklistName": "TestBlocklist", + "body": { + "blocklistItems": [ + { + "description": "Hate word", + "text": "hate" + } + ] + } + }, + "responses": { + "200": { + "body": { + "blocklistItems": [ + { + "blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", + "description": "Hate word", + "text": "hate" + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/RemoveBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/RemoveBlocklistItems.json new file mode 100644 index 000000000000..fce25f982d17 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/RemoveBlocklistItems.json @@ -0,0 +1,16 @@ +{ + "title": "Remove BlockItems From Text Blocklist", + "operationId": "TextBlocklists_RemoveBlocklistItems", + "parameters": { + "api-version": "2023-10-01", + "blocklistName": "TestBlocklist", + "body": { + "blockItemIds": [ + "9511969e-f1e3-4604-9127-05ee16c509ec" + ] + } + }, + "responses": { + "204": {} + } +} From 17547eea915670c303105c26b5a62b15bf344b79 Mon Sep 17 00:00:00 2001 From: mengaims Date: Thu, 24 Aug 2023 15:32:35 +0800 Subject: [PATCH 04/15] Fix typo --- specification/cognitiveservices/ContentSafety/routes.tsp | 2 +- .../ContentSafety/stable/2023-10-01/contentsafety.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 175efbe5210a..1e3893cf987f 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -80,7 +80,7 @@ interface TextBlocklists { >; @summary("Get BlocklistItem By blocklistName And blocklistItemId") - @doc("Get blocklistItem by blocklsitName and blocklistItemId from a text blocklist.") + @doc("Get blocklistItem by blocklistName and blocklistItemId from a text blocklist.") getTextBlocklistItem is BlockOps.ResourceRead; @summary("Get All BlocklistItems By blocklistName") diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json index 24e067af1c8b..2a6a0159d346 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json @@ -461,7 +461,7 @@ "get": { "operationId": "TextBlocklists_GetTextBlocklistItem", "summary": "Get BlocklistItem By blocklistName And blocklistItemId", - "description": "Get blocklistItem by blocklsitName and blocklistItemId from a text blocklist.", + "description": "Get blocklistItem by blocklistName and blocklistItemId from a text blocklist.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" From 1656956e8b3b8a5bd622b021b77ba25a6b446b6a Mon Sep 17 00:00:00 2001 From: mengaims Date: Thu, 24 Aug 2023 15:47:35 +0800 Subject: [PATCH 05/15] Fix minor errors in example and readme --- .../examples/2023-10-01/AddOrUpdateBlocklistItems.json | 1 + .../ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json | 2 +- .../cognitiveservices/data-plane/ContentSafety/readme.md | 2 +- .../stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json | 1 + .../stable/2023-10-01/examples/RemoveBlocklistItems.json | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json index 26c10fdbea21..edec68ce8ef3 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json @@ -7,6 +7,7 @@ "body": { "blocklistItems": [ { + "blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", "description": "Hate word", "text": "hate" } diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json index fce25f982d17..ea8d6edd6156 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/RemoveBlocklistItems.json @@ -5,7 +5,7 @@ "api-version": "2023-10-01", "blocklistName": "TestBlocklist", "body": { - "blockItemIds": [ + "blocklistItemIds": [ "9511969e-f1e3-4604-9127-05ee16c509ec" ] } diff --git a/specification/cognitiveservices/data-plane/ContentSafety/readme.md b/specification/cognitiveservices/data-plane/ContentSafety/readme.md index ffaf58b50998..07a9627597c3 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/readme.md +++ b/specification/cognitiveservices/data-plane/ContentSafety/readme.md @@ -44,7 +44,7 @@ These settings apply only when `--tag=package-2023-10-01` is specified on the co ```yaml $(tag) == 'package-2023-10-01' input-file: - - preview/2023-10-01/contentsafety.json + - stable/2023-10-01/contentsafety.json ``` --- diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json index 26c10fdbea21..edec68ce8ef3 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json @@ -7,6 +7,7 @@ "body": { "blocklistItems": [ { + "blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", "description": "Hate word", "text": "hate" } diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/RemoveBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/RemoveBlocklistItems.json index fce25f982d17..ea8d6edd6156 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/RemoveBlocklistItems.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/RemoveBlocklistItems.json @@ -5,7 +5,7 @@ "api-version": "2023-10-01", "blocklistName": "TestBlocklist", "body": { - "blockItemIds": [ + "blocklistItemIds": [ "9511969e-f1e3-4604-9127-05ee16c509ec" ] } From da9d2ea50c39cb0461aaf55ca58548cf5d7977c7 Mon Sep 17 00:00:00 2001 From: mengaims Date: Thu, 24 Aug 2023 16:11:31 +0800 Subject: [PATCH 06/15] Fix example --- .../examples/2023-10-01/AddOrUpdateBlocklistItems.json | 1 - .../stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json | 1 - 2 files changed, 2 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json index edec68ce8ef3..26c10fdbea21 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json @@ -7,7 +7,6 @@ "body": { "blocklistItems": [ { - "blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", "description": "Hate word", "text": "hate" } diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json index edec68ce8ef3..26c10fdbea21 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json @@ -7,7 +7,6 @@ "body": { "blocklistItems": [ { - "blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", "description": "Hate word", "text": "hate" } From b58f20ccbced5315ebef7a7dba93694c87f48105 Mon Sep 17 00:00:00 2001 From: mengaims Date: Thu, 24 Aug 2023 16:37:54 +0800 Subject: [PATCH 07/15] remove the 0430 content --- .../2023-04-30-preview/AddBlockItems.json | 29 --- .../2023-04-30-preview/AnalyzeImage.json | 34 --- .../2023-04-30-preview/AnalyzeText.json | 33 --- .../CreateOrUpdateTextBlocklist.json | 25 --- .../DeleteTextBlocklist.json | 11 - .../2023-04-30-preview/GetTextBlocklist.json | 16 -- .../GetTextBlocklistItem.json | 18 -- .../ListTextBlocklistItems.json | 21 -- .../ListTextBlocklists.json | 19 -- .../2023-04-30-preview/RemoveBlockItems.json | 16 -- .../ContentSafety/0430/main.tsp | 35 ---- .../ContentSafety/0430/models.tsp | 195 ------------------ .../ContentSafety/0430/routes.tsp | 92 --------- .../ContentSafety/0430/tspconfig.yaml | 31 --- 14 files changed, 575 deletions(-) delete mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AddBlockItems.json delete mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeImage.json delete mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeText.json delete mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/CreateOrUpdateTextBlocklist.json delete mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/DeleteTextBlocklist.json delete mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklist.json delete mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklistItem.json delete mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklistItems.json delete mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklists.json delete mode 100644 specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/RemoveBlockItems.json delete mode 100644 specification/cognitiveservices/ContentSafety/0430/main.tsp delete mode 100644 specification/cognitiveservices/ContentSafety/0430/models.tsp delete mode 100644 specification/cognitiveservices/ContentSafety/0430/routes.tsp delete mode 100644 specification/cognitiveservices/ContentSafety/0430/tspconfig.yaml diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AddBlockItems.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AddBlockItems.json deleted file mode 100644 index 3670641ca73b..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AddBlockItems.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "title": "Add BlockItems To Text Blocklist", - "operationId": "TextBlocklists_AddBlockItems", - "parameters": { - "api-version": "2023-04-30-preview", - "blocklistName": "TestBlocklist", - "body": { - "blockItems": [ - { - "description": "Hate word", - "text": "hate" - } - ] - } - }, - "responses": { - "200": { - "body": { - "value": [ - { - "blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", - "description": "Hate word", - "text": "hate" - } - ] - } - } - } -} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeImage.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeImage.json deleted file mode 100644 index 7224de71454c..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeImage.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "title": "Analyze Image", - "operationId": "ImageOperations_AnalyzeImage", - "parameters": { - "api-version": "2023-04-30-preview", - "body": { - "image": { - "content": "Y29udGVudDE=" - } - } - }, - "responses": { - "200": { - "body": { - "hateResult": { - "category": "Hate", - "severity": 0 - }, - "selfHarmResult": { - "category": "Hate", - "severity": 0 - }, - "sexualResult": { - "category": "Hate", - "severity": 0 - }, - "violenceResult": { - "category": "Hate", - "severity": 2 - } - } - } - } -} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeText.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeText.json deleted file mode 100644 index 5d5bf56e9fcf..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/AnalyzeText.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "title": "Analyze Text", - "operationId": "TextOperations_AnalyzeText", - "parameters": { - "api-version": "2023-04-30-preview", - "body": { - "text": "This is text example" - } - }, - "responses": { - "200": { - "body": { - "blocklistsMatchResults": [], - "hateResult": { - "category": "Hate", - "severity": 0 - }, - "selfHarmResult": { - "category": "SelfHarm", - "severity": 0 - }, - "sexualResult": { - "category": "Sexual", - "severity": 0 - }, - "violenceResult": { - "category": "Violence", - "severity": 0 - } - } - } - } -} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/CreateOrUpdateTextBlocklist.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/CreateOrUpdateTextBlocklist.json deleted file mode 100644 index c20bc792687d..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/CreateOrUpdateTextBlocklist.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "title": "Create Or Update Text Blocklist", - "operationId": "TextBlocklists_CreateOrUpdateTextBlocklist", - "parameters": { - "api-version": "2023-04-30-preview", - "blocklistName": "TestBlocklist", - "resource": { - "description": "Test Blocklist" - } - }, - "responses": { - "200": { - "body": { - "blocklistName": "TestBlocklist", - "description": "Test Blocklist" - } - }, - "201": { - "body": { - "blocklistName": "TestBlocklist", - "description": "Test Blocklist" - } - } - } -} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/DeleteTextBlocklist.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/DeleteTextBlocklist.json deleted file mode 100644 index c671893d679a..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/DeleteTextBlocklist.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "title": "Delete Text Blocklist By blocklistName", - "operationId": "TextBlocklists_DeleteTextBlocklist", - "parameters": { - "api-version": "2023-04-30-preview", - "blocklistName": "TestBlocklist" - }, - "responses": { - "204": {} - } -} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklist.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklist.json deleted file mode 100644 index 4969426906de..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklist.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "title": "Get Text Blocklist By blocklistName", - "operationId": "TextBlocklists_GetTextBlocklist", - "parameters": { - "api-version": "2023-04-30-preview", - "blocklistName": "TestBlocklist" - }, - "responses": { - "200": { - "body": { - "blocklistName": "TestBlocklist", - "description": "Test Blocklist" - } - } - } -} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklistItem.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklistItem.json deleted file mode 100644 index 94da2bfbdaa9..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/GetTextBlocklistItem.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "title": "Get BlockItem By blocklistName And blockItemId", - "operationId": "TextBlocklists_GetTextBlocklistItem", - "parameters": { - "api-version": "2023-04-30-preview", - "blocklistName": "TestBlocklist", - "blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec" - }, - "responses": { - "200": { - "body": { - "blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", - "description": "Hate word", - "text": "hate" - } - } - } -} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklistItems.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklistItems.json deleted file mode 100644 index 6c7955b98842..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklistItems.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "title": "Get All BlockItems By blocklistName", - "operationId": "TextBlocklists_ListTextBlocklistItems", - "parameters": { - "api-version": "2023-04-30-preview", - "blocklistName": "TestBlocklist" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "blockItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", - "description": "Hate word", - "text": "hate" - } - ] - } - } - } -} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklists.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklists.json deleted file mode 100644 index ea72669941d3..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/ListTextBlocklists.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "title": "Get All Text Blocklists", - "operationId": "TextBlocklists_ListTextBlocklists", - "parameters": { - "api-version": "2023-04-30-preview" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "blocklistName": "TestBlocklist", - "description": "Test Blocklist" - } - ] - } - } - } -} diff --git a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/RemoveBlockItems.json b/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/RemoveBlockItems.json deleted file mode 100644 index fc7ea3a3fea3..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/examples/2023-04-30-preview/RemoveBlockItems.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "title": "Remove BlockItems From Text Blocklist", - "operationId": "TextBlocklists_RemoveBlockItems", - "parameters": { - "api-version": "2023-04-30-preview", - "blocklistName": "TestBlocklist", - "body": { - "blockItemIds": [ - "9511969e-f1e3-4604-9127-05ee16c509ec" - ] - } - }, - "responses": { - "204": {} - } -} diff --git a/specification/cognitiveservices/ContentSafety/0430/main.tsp b/specification/cognitiveservices/ContentSafety/0430/main.tsp deleted file mode 100644 index c9d893bf39bd..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/main.tsp +++ /dev/null @@ -1,35 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "./routes.tsp"; - -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.Core; - -@service({ - title: "ContentSafety Service", -}) -@versioned(ContentSafety.Versions) -@useAuth(ApiKeyAuth) -@server( - "{endpoint}/contentsafety", - "Analyze harmful content", - { - @doc(""" -Supported Cognitive Services endpoints (protocol and hostname, for example: -https://.cognitiveservices.azure.com). -""") - endpoint: string, - } -) -@doc("Analyze harmful content") -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", -} diff --git a/specification/cognitiveservices/ContentSafety/0430/models.tsp b/specification/cognitiveservices/ContentSafety/0430/models.tsp deleted file mode 100644 index d02405ef8d2c..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/models.tsp +++ /dev/null @@ -1,195 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; - -using TypeSpec.Http; -using TypeSpec.Rest; - -namespace ContentSafety; - -#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" -@doc("Text analyze category") -enum TextCategory { - Hate, - SelfHarm, - Sexual, - Violence, -} - -#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" -@doc("Image analyze category") -enum ImageCategory { - Hate, - SelfHarm, - Sexual, - Violence, -} - -@doc("The analysis request of the text.") -model AnalyzeTextOptions { - @doc("The text needs to be scanned. We support at most 1000 characters (unicode code points) in text of one request.") - @maxLength(1000) - text: string; - - @doc("The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned.") - categories?: TextCategory[]; - - @doc("The names of blocklists.") - blocklistNames?: string[]; - - @doc("When set to true, further analyses of harmful content will not be performed in cases where blocklists are hit. When set to false, all analyses of harmful content will be performed, whether or not blocklists are hit.") - breakByBlocklists?: boolean; -} - -@doc("The analysis response of the text") -model AnalyzeTextResult { - @doc("The details of blocklist match.") - blocklistsMatchResults?: TextBlocklistMatchResult[]; - - @doc("Analysis result for Hate category.") - hateResult?: TextAnalyzeSeverityResult; - - @doc("Analysis result for SelfHarm category.") - selfHarmResult?: TextAnalyzeSeverityResult; - - @doc("Analysis result for Sexual category.") - sexualResult?: TextAnalyzeSeverityResult; - - @doc("Analysis result for Violence category.") - violenceResult?: TextAnalyzeSeverityResult; -} - -@doc("The result of blocklist match.") -model TextBlocklistMatchResult { - @doc("The name of matched blocklist.") - @maxLength(64) - blocklistName: string; - - @doc("The id of matched item.") - @maxLength(64) - blockItemId: string; - - @doc("The content of matched item.") - @maxLength(128) - blockItemText: string; - - @doc("The character offset of matched text in original input.") - offset: int32; - - @doc("The length of matched text in original input.") - length: int32; -} - -@doc("Text analysis result.") -model TextAnalyzeSeverityResult { - @doc("The text category.") - category: TextCategory; - - @doc("The higher the severity of input content, the larger this value is. The values could be: 0,2,4,6.") - severity: int32; -} - -@doc("The analysis request of the image.") -model AnalyzeImageOptions { - @doc("The image needs to be analyzed.") - image: ImageData; - - @doc("The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned.") - categories?: ImageCategory[]; -} - -@doc("The content or blob url of image, could be base64 encoding bytes or blob url. If both are given, the request will be refused. The maximum size of image is 2048 pixels * 2048 pixels, no larger than 4MB at the same time. The minimum size of image is 50 pixels * 50 pixels.") -@projectedName("csharp", "ContentSafetyImageData") -model ImageData { - @doc("Base64 encoding of image.") - content?: bytes; - - @doc("The blob url of image.") - blobUrl?: url; -} - -@doc("The analysis response of the image.") -model AnalyzeImageResult { - @doc("Analysis result for Hate category.") - hateResult?: ImageAnalyzeSeverityResult; - - @doc("Analysis result for SelfHarm category.") - selfHarmResult?: ImageAnalyzeSeverityResult; - - @doc("Analysis result for Sexual category.") - sexualResult?: ImageAnalyzeSeverityResult; - - @doc("Analysis result for Violence category.") - violenceResult?: ImageAnalyzeSeverityResult; -} - -@doc("Image analysis result.") -model ImageAnalyzeSeverityResult { - @doc("The image category.") - category: ImageCategory; - - @doc("The higher the severity of input content, the larger this value, currently its value could be: 0,2,4,6.") - severity: int32; -} - -@doc("Text Blocklist.") -@resource("text/blocklists") -model TextBlocklist { - @doc("Text blocklist name.") - @pattern("^[0-9A-Za-z._~-]+$") - @key("blocklistName") - @visibility("read", "create", "query") - @maxLength(64) - blocklistName: string; - - @doc("Text blocklist description.") - @maxLength(1024) - description?: string; -} - -@doc("Item in TextBlocklist.") -@resource("blockItems") -@parentResource(TextBlocklist) -model TextBlockItem { - @doc("Block Item Id. It will be uuid.") - @key("blockItemId") - @visibility("read", "create", "query") - @maxLength(64) - blockItemId: string; - - @doc("Block item description.") - @maxLength(1024) - description?: string; - - @doc("Block item content.") - @maxLength(128) - text: string; -} - -@doc("Block item info in text blocklist.") -model TextBlockItemInfo { - @doc("Block item description.") - @maxLength(1024) - description?: string; - - @doc("Block item content.") - @maxLength(128) - text: string; -} - -@doc("The request of adding blockItems to text blocklist.") -model AddBlockItemsOptions { - @doc("Array of blockItemInfo to add.") - blockItems: TextBlockItemInfo[]; -} - -@doc("The response of adding blockItems to text blocklist.") -model AddBlockItemsResult { - @doc("Array of blockItems added.") - value?: TextBlockItem[]; -} - -@doc("The request of removing blockItems from text blocklist.") -model RemoveBlockItemsOptions { - @doc("Array of blockItemIds to remove.") - blockItemIds: string[]; -} diff --git a/specification/cognitiveservices/ContentSafety/0430/routes.tsp b/specification/cognitiveservices/ContentSafety/0430/routes.tsp deleted file mode 100644 index 17ee1dbe0c96..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/routes.tsp +++ /dev/null @@ -1,92 +0,0 @@ -import "@azure-tools/typespec-azure-core"; -import "@typespec/http"; -import "@typespec/rest"; -import "./models.tsp"; - -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.Core; -using Azure.Core.Traits; - -namespace ContentSafety; - -interface TextOperations { - @summary("Analyze Text") - @doc("A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence.") - @route("/text:analyze") - @post - analyzeText is Azure.Core.RpcOperation< - { - @body - @doc("The request of text analysis.") - body: AnalyzeTextOptions; - }, - AnalyzeTextResult - >; -} - -interface ImageOperations { - @summary("Analyze Image") - @doc("A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence.") - @route("/image:analyze") - @post - analyzeImage is Azure.Core.RpcOperation< - { - @doc("The analysis request of the image.") - @body - body: AnalyzeImageOptions; - }, - AnalyzeImageResult - >; -} - -interface BlockOps - extends Azure.Core.ResourceOperations {} - -interface TextBlocklists { - @summary("Get Text Blocklist By blocklistName") - @doc("Returns text blocklist details.") - getTextBlocklist is BlockOps.ResourceRead; - - @summary("Create Or Update Text Blocklist") - @doc("Updates a text blocklist, if blocklistName does not exist, create a new blocklist.") - createOrUpdateTextBlocklist is BlockOps.ResourceCreateOrUpdate; - - @summary("Delete Text Blocklist By blocklistName") - @doc("Deletes a text blocklist.") - deleteTextBlocklist is BlockOps.ResourceDelete; - - @summary("Get All Text Blocklists") - @doc("Get all text blocklists details.") - listTextBlocklists is BlockOps.ResourceList; - - @summary("Add BlockItems To Text Blocklist") - @doc("Add blockItems to a text blocklist. You can add at most 100 BlockItems in one request.") - addBlockItems is BlockOps.ResourceAction< - TextBlocklist, - AddBlockItemsOptions, - AddBlockItemsResult - >; - - @summary("Remove BlockItems From Text Blocklist") - @doc("Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request.") - removeBlockItems is BlockOps.ResourceAction< - TextBlocklist, - RemoveBlockItemsOptions, - NoContentResponse - >; - - @summary("Get BlockItem By blocklistName And blockItemId") - @doc("Get blockItem By blockItemId from a text blocklist.") - getTextBlocklistItem is BlockOps.ResourceRead; - - @summary("Get All BlockItems By blocklistName") - @doc("Get all blockItems in a text blocklist") - listTextBlocklistItems is BlockOps.ResourceList< - TextBlockItem, - ListQueryParametersTrait - >; -} diff --git a/specification/cognitiveservices/ContentSafety/0430/tspconfig.yaml b/specification/cognitiveservices/ContentSafety/0430/tspconfig.yaml deleted file mode 100644 index 6d8f2bfee5ef..000000000000 --- a/specification/cognitiveservices/ContentSafety/0430/tspconfig.yaml +++ /dev/null @@ -1,31 +0,0 @@ -parameters: - service-dir: - default: "sdk/contentsafety" -emit: - - "@azure-tools/typespec-autorest" -options: - "@azure-tools/typespec-autorest": - emitter-output-dir: "{project-root}/../" - output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/contentsafety.json" - azure-resource-provider-folder: "data-plane" - examples-directory: examples - "@azure-tools/typespec-python": - package-dir: "azure-ai-contentsafety" - package-name: "{package-dir}" - package-mode: dataplane - "@azure-tools/typespec-csharp": - package-dir: "Azure.AI.ContentSafety" - namespace: "{package-dir}" - clear-output-folder: true - model-namespace: false - # "@azure-tools/typespec-ts": - # package-dir: "contentsafety-rest" - # generateMetadata: true - # generateTest: true - # azureSdkForJs: true - # packageDetails: - # name: "@azure-rest/contentsafety-rest" - # description: "ContentSafety Service" - # "@azure-tools/typespec-java": - # package-dir: "contentsafety" - # namespace: com.contentsafety From edd94d24bf8fbf225024f349a0dbab759137688c Mon Sep 17 00:00:00 2001 From: mengaims Date: Thu, 24 Aug 2023 20:57:32 +0800 Subject: [PATCH 08/15] update readme --- .../cognitiveservices/data-plane/ContentSafety/readme.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/specification/cognitiveservices/data-plane/ContentSafety/readme.md b/specification/cognitiveservices/data-plane/ContentSafety/readme.md index 07a9627597c3..bd48fb3b76a0 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/readme.md +++ b/specification/cognitiveservices/data-plane/ContentSafety/readme.md @@ -29,15 +29,6 @@ openapi-type: data-plane tag: package-2023-10-01 ``` -### Tag: package-2023-04-30-preview - -These settings apply only when `--tag=package-2023-04-30-preview` is specified on the command line. - -```yaml $(tag) == 'package-2023-04-30-preview' -input-file: - - preview/2023-04-30-preview/contentsafety.json -``` - ### Tag: package-2023-10-01 These settings apply only when `--tag=package-2023-10-01` is specified on the command line. From 7010408268054f0871c2046e2500ec6139f3b680 Mon Sep 17 00:00:00 2001 From: mengaims Date: Thu, 24 Aug 2023 21:11:46 +0800 Subject: [PATCH 09/15] re-format markdowm --- .../data-plane/ContentSafety/readme.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/specification/cognitiveservices/data-plane/ContentSafety/readme.md b/specification/cognitiveservices/data-plane/ContentSafety/readme.md index bd48fb3b76a0..7dc3dd1cf5eb 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/readme.md +++ b/specification/cognitiveservices/data-plane/ContentSafety/readme.md @@ -1,6 +1,6 @@ # Content Safety -> see +> see https://aka.ms/autorest This is the AutoRest configuration file for Content Safety. @@ -26,7 +26,16 @@ These are the global settings for the Content Safety. ```yaml openapi-type: data-plane -tag: package-2023-10-01 +tag: package-2023-04-30-preview +``` + +### Tag: package-2023-04-30-preview + +These settings apply only when `--tag=package-2023-04-30-preview` is specified on the command line. + +```yaml $(tag) == 'package-2023-04-30-preview' +input-file: + - preview/2023-04-30-preview/contentsafety.json ``` ### Tag: package-2023-10-01 @@ -57,7 +66,6 @@ swagger-to-sdk: - repo: azure-cli-extensions - repo: azure-powershell ``` - ## Az See configuration in [readme.az.md](./readme.az.md) @@ -76,4 +84,4 @@ See configuration in [readme.typescript.md](./readme.typescript.md) ## CSharp -See configuration in [readme.csharp.md](./readme.csharp.md) +See configuration in [readme.csharp.md](./readme.csharp.md) \ No newline at end of file From e05571954d523668feb74279d1c2b489c7ba6d9e Mon Sep 17 00:00:00 2001 From: mengaims Date: Thu, 24 Aug 2023 21:33:57 +0800 Subject: [PATCH 10/15] Fix example --- .../examples/2023-10-01/AddOrUpdateBlocklistItems.json | 1 + .../stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json | 1 + 2 files changed, 2 insertions(+) diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json index 26c10fdbea21..cf0fd7066382 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json @@ -7,6 +7,7 @@ "body": { "blocklistItems": [ { + "blocklistItemId": null, "description": "Hate word", "text": "hate" } diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json index 26c10fdbea21..cf0fd7066382 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json @@ -7,6 +7,7 @@ "body": { "blocklistItems": [ { + "blocklistItemId": null, "description": "Hate word", "text": "hate" } From 8816750e68eda030ac3f72af42ae892021d0d93d Mon Sep 17 00:00:00 2001 From: mengaims Date: Wed, 30 Aug 2023 17:55:49 +0800 Subject: [PATCH 11/15] update blocklist example --- .../examples/2023-10-01/AddOrUpdateBlocklistItems.json | 1 - .../stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json | 1 - 2 files changed, 2 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json index cf0fd7066382..26c10fdbea21 100644 --- a/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-01/AddOrUpdateBlocklistItems.json @@ -7,7 +7,6 @@ "body": { "blocklistItems": [ { - "blocklistItemId": null, "description": "Hate word", "text": "hate" } diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json index cf0fd7066382..26c10fdbea21 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/examples/AddOrUpdateBlocklistItems.json @@ -7,7 +7,6 @@ "body": { "blocklistItems": [ { - "blocklistItemId": null, "description": "Hate word", "text": "hate" } From abb9d09392eb89c4e9a4d46e2b3b18af1bbcf23a Mon Sep 17 00:00:00 2001 From: mengaims Date: Mon, 16 Oct 2023 15:56:20 +0800 Subject: [PATCH 12/15] Add eight severity levels --- .../ContentSafety/models.tsp | 10 ++++++++-- .../stable/2023-10-01/contentsafety.json | 20 +++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index 17bb82176127..4171f2e3a647 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -29,12 +29,18 @@ enum ImageCategory { enum AnalyzeTextOutputType { @doc("Output severities in four levels, the value could be 0,2,4,6.") FourSeverityLevels, + + @doc("Output severities in eight levels, the value could be 0,1,2,3,4,5,6,7.") + EightSeverityLevels, } @doc("The type of image analysis output.") enum AnalyzeImageOutputType { @doc("Output severities in four levels, the value could be 0,2,4,6.") FourSeverityLevels, + + @doc("Output severities in eight levels, the value could be 0,1,2,3,4,5,6,7.") + EightSeverityLevels, } @doc("The text analysis request.") @@ -85,7 +91,7 @@ model TextCategoriesAnalysis { @doc("The text analysis category.") category: TextCategory; - @doc("The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' is chosen, this field will be included in the output. The value can be 0, 2, 4, or 6, and it increases with the severity of the input content.") + @doc("The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' or 'EightSeverityLevels' is chosen, this field will be included in the output. The value increases with the severity of the input content.") severity?: int32; } @@ -122,7 +128,7 @@ model ImageCategoriesAnalysis { @doc("The image analysis category.") category: ImageCategory; - @doc("The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' is chosen, this field will be included in the output. The value can be 0, 2, 4, or 6, and it increases with the severity of the input content.") + @doc("The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' or 'EightSeverityLevels' is chosen, this field will be included in the output. The value increases with the severity of the input content.") severity?: int32; } diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json index 2a6a0159d346..af43af176877 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json @@ -619,7 +619,8 @@ "type": "string", "description": "The type of image analysis output.", "enum": [ - "FourSeverityLevels" + "FourSeverityLevels", + "EightSeverityLevels" ], "x-ms-enum": { "name": "AnalyzeImageOutputType", @@ -629,6 +630,11 @@ "name": "FourSeverityLevels", "value": "FourSeverityLevels", "description": "Output severities in four levels, the value could be 0,2,4,6." + }, + { + "name": "EightSeverityLevels", + "value": "EightSeverityLevels", + "description": "Output severities in eight levels, the value could be 0,1,2,3,4,5,6,7." } ] } @@ -691,7 +697,8 @@ "type": "string", "description": "The type of text analysis output.", "enum": [ - "FourSeverityLevels" + "FourSeverityLevels", + "EightSeverityLevels" ], "x-ms-enum": { "name": "AnalyzeTextOutputType", @@ -701,6 +708,11 @@ "name": "FourSeverityLevels", "value": "FourSeverityLevels", "description": "Output severities in four levels, the value could be 0,2,4,6." + }, + { + "name": "EightSeverityLevels", + "value": "EightSeverityLevels", + "description": "Output severities in eight levels, the value could be 0,1,2,3,4,5,6,7." } ] } @@ -802,7 +814,7 @@ "severity": { "type": "integer", "format": "int32", - "description": "The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' is chosen, this field will be included in the output. The value can be 0, 2, 4, or 6, and it increases with the severity of the input content." + "description": "The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' or 'EightSeverityLevels' is chosen, this field will be included in the output. The value increases with the severity of the input content." } }, "required": [ @@ -997,7 +1009,7 @@ "severity": { "type": "integer", "format": "int32", - "description": "The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' is chosen, this field will be included in the output. The value can be 0, 2, 4, or 6, and it increases with the severity of the input content." + "description": "The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' or 'EightSeverityLevels' is chosen, this field will be included in the output. The value increases with the severity of the input content." } }, "required": [ From 8120cc63ecb0090f22184e7bc1fb3bc6fe6d50fa Mon Sep 17 00:00:00 2001 From: mengaims Date: Mon, 16 Oct 2023 17:36:52 +0800 Subject: [PATCH 13/15] Fix tsp version issue --- .../stable/2023-10-01/contentsafety.json | 76 +++++++++++-------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json index af43af176877..138ee14e7c33 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json @@ -20,8 +20,8 @@ { "name": "endpoint", "in": "path", - "required": true, "description": "Supported Cognitive Services endpoints (protocol and hostname, for example:\nhttps://.cognitiveservices.azure.com).", + "required": true, "type": "string" } ] @@ -92,8 +92,8 @@ }, "headers": { "x-ms-error-code": { - "description": "String error code indicating what went wrong.", - "type": "string" + "type": "string", + "description": "String error code indicating what went wrong." } } } @@ -129,8 +129,8 @@ }, "headers": { "x-ms-error-code": { - "description": "String error code indicating what went wrong.", - "type": "string" + "type": "string", + "description": "String error code indicating what went wrong." } } } @@ -178,8 +178,8 @@ }, "headers": { "x-ms-error-code": { - "description": "String error code indicating what went wrong.", - "type": "string" + "type": "string", + "description": "String error code indicating what went wrong." } } } @@ -216,7 +216,7 @@ "description": "The resource instance.", "required": true, "schema": { - "$ref": "#/definitions/TextBlocklistUpdate" + "$ref": "#/definitions/TextBlocklistCreateOrUpdate" } } ], @@ -240,8 +240,8 @@ }, "headers": { "x-ms-error-code": { - "description": "String error code indicating what went wrong.", - "type": "string" + "type": "string", + "description": "String error code indicating what went wrong." } } } @@ -281,8 +281,8 @@ }, "headers": { "x-ms-error-code": { - "description": "String error code indicating what went wrong.", - "type": "string" + "type": "string", + "description": "String error code indicating what went wrong." } } } @@ -335,8 +335,8 @@ }, "headers": { "x-ms-error-code": { - "description": "String error code indicating what went wrong.", - "type": "string" + "type": "string", + "description": "String error code indicating what went wrong." } } } @@ -386,8 +386,8 @@ }, "headers": { "x-ms-error-code": { - "description": "String error code indicating what went wrong.", - "type": "string" + "type": "string", + "description": "String error code indicating what went wrong." } } } @@ -441,8 +441,8 @@ }, "headers": { "x-ms-error-code": { - "description": "String error code indicating what went wrong.", - "type": "string" + "type": "string", + "description": "String error code indicating what went wrong." } } } @@ -498,8 +498,8 @@ }, "headers": { "x-ms-error-code": { - "description": "String error code indicating what went wrong.", - "type": "string" + "type": "string", + "description": "String error code indicating what went wrong." } } } @@ -544,8 +544,8 @@ }, "headers": { "x-ms-error-code": { - "description": "String error code indicating what went wrong.", - "type": "string" + "type": "string", + "description": "String error code indicating what went wrong." } } } @@ -935,6 +935,27 @@ "blocklistName" ] }, + "TextBlocklistCreateOrUpdate": { + "type": "object", + "description": "Text Blocklist.", + "properties": { + "blocklistName": { + "type": "string", + "description": "Text blocklist name.", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "description": { + "type": "string", + "description": "Text blocklist description.", + "maxLength": 1024 + } + } + }, "TextBlocklistItem": { "type": "object", "description": "Item in a TextBlocklist.", @@ -987,17 +1008,6 @@ "blocklistItemText" ] }, - "TextBlocklistUpdate": { - "type": "object", - "description": "Text Blocklist.", - "properties": { - "description": { - "type": "string", - "description": "Text blocklist description.", - "maxLength": 1024 - } - } - }, "TextCategoriesAnalysis": { "type": "object", "description": "Text analysis result.", From bff75c85e9365ef2d843b84193d4d20e6478cb20 Mon Sep 17 00:00:00 2001 From: mengaims Date: Mon, 16 Oct 2023 17:42:57 +0800 Subject: [PATCH 14/15] Update description --- specification/cognitiveservices/ContentSafety/models.tsp | 2 +- .../ContentSafety/stable/2023-10-01/contentsafety.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index 4171f2e3a647..78b50ce46efe 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -128,7 +128,7 @@ model ImageCategoriesAnalysis { @doc("The image analysis category.") category: ImageCategory; - @doc("The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' or 'EightSeverityLevels' is chosen, this field will be included in the output. The value increases with the severity of the input content.") + @doc("The value of this field is determined by the output type specified in the request. The output type could be ‘FourSeverityLevels’ or ‘EightSeverity Levels’, and the output value can be 0, 2, 4, 6 or 0, 1, 2, 3, 4, 5, 6, or 7. The value increases with the severity of the input content.") severity?: int32; } diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json index 138ee14e7c33..6403a0a82912 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json @@ -814,7 +814,7 @@ "severity": { "type": "integer", "format": "int32", - "description": "The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' or 'EightSeverityLevels' is chosen, this field will be included in the output. The value increases with the severity of the input content." + "description": "The value of this field is determined by the output type specified in the request. The output type could be ‘FourSeverityLevels’ or ‘EightSeverity Levels’, and the output value can be 0, 2, 4, 6 or 0, 1, 2, 3, 4, 5, 6, or 7. The value increases with the severity of the input content." } }, "required": [ From 7994379c91eac3fc84e2165a10134a2c874ee242 Mon Sep 17 00:00:00 2001 From: mengaims Date: Mon, 16 Oct 2023 22:22:51 +0800 Subject: [PATCH 15/15] Address comments --- specification/cognitiveservices/ContentSafety/models.tsp | 6 +++--- .../ContentSafety/stable/2023-10-01/contentsafety.json | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index 78b50ce46efe..9eaf4a1ec889 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -91,7 +91,7 @@ model TextCategoriesAnalysis { @doc("The text analysis category.") category: TextCategory; - @doc("The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' or 'EightSeverityLevels' is chosen, this field will be included in the output. The value increases with the severity of the input content.") + @doc("The value increases with the severity of the input content. The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' or 'EightSeverityLevels' is chosen, this field will be included in the output.") severity?: int32; } @@ -128,7 +128,7 @@ model ImageCategoriesAnalysis { @doc("The image analysis category.") category: ImageCategory; - @doc("The value of this field is determined by the output type specified in the request. The output type could be ‘FourSeverityLevels’ or ‘EightSeverity Levels’, and the output value can be 0, 2, 4, 6 or 0, 1, 2, 3, 4, 5, 6, or 7. The value increases with the severity of the input content.") + @doc("The value increases with the severity of the input content. The value of this field is determined by the output type specified in the request. The output type could be ‘FourSeverityLevels’ or ‘EightSeverity Levels’, and the output value can be 0, 2, 4, 6 or 0, 1, 2, 3, 4, 5, 6, or 7.") severity?: int32; } @@ -175,7 +175,7 @@ model AddOrUpdateTextBlocklistItemsOptions { @doc("The response of adding blocklistItems to the text blocklist.") model AddOrUpdateTextBlocklistItemsResult { @doc("Array of blocklistItems have been added.") - blocklistItems?: TextBlocklistItem[]; + blocklistItems: TextBlocklistItem[]; } @doc("The request to remove blocklistItems from a text blocklist.") diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json index 6403a0a82912..22f541525168 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json @@ -588,7 +588,10 @@ }, "x-ms-identifiers": [] } - } + }, + "required": [ + "blocklistItems" + ] }, "AnalyzeImageOptions": { "type": "object", @@ -814,7 +817,7 @@ "severity": { "type": "integer", "format": "int32", - "description": "The value of this field is determined by the output type specified in the request. The output type could be ‘FourSeverityLevels’ or ‘EightSeverity Levels’, and the output value can be 0, 2, 4, 6 or 0, 1, 2, 3, 4, 5, 6, or 7. The value increases with the severity of the input content." + "description": "The value increases with the severity of the input content. The value of this field is determined by the output type specified in the request. The output type could be ‘FourSeverityLevels’ or ‘EightSeverity Levels’, and the output value can be 0, 2, 4, 6 or 0, 1, 2, 3, 4, 5, 6, or 7." } }, "required": [ @@ -1019,7 +1022,7 @@ "severity": { "type": "integer", "format": "int32", - "description": "The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' or 'EightSeverityLevels' is chosen, this field will be included in the output. The value increases with the severity of the input content." + "description": "The value increases with the severity of the input content. The value of this field is determined by the outputType specified in the request. If 'FourSeverityLevels' or 'EightSeverityLevels' is chosen, this field will be included in the output." } }, "required": [