diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/AddOrUpdateBlocklistItems.json new file mode 100644 index 000000000000..2c801032dd9d --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/AddOrUpdateBlocklistItems.json @@ -0,0 +1,30 @@ +{ + "title": "Add or Update BlocklistItems To Text Blocklist", + "operationId": "TextBlocklists_AddOrUpdateBlocklistItems", + "parameters": { + "api-version": "2023-10-15-preview", + "blocklistName": "TestBlocklist", + "body": { + "blocklistItems": [ + { + "blocklistItemId": null, + "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/ContentSafety/examples/2023-10-15-preview/AnalyzeImage.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/AnalyzeImage.json new file mode 100644 index 000000000000..8132fdf88268 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/AnalyzeImage.json @@ -0,0 +1,36 @@ +{ + "title": "Analyze Image", + "operationId": "ImageOperations_AnalyzeImage", + "parameters": { + "api-version": "2023-10-15-preview", + "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-15-preview/AnalyzeText.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/AnalyzeText.json new file mode 100644 index 000000000000..102d8379a8f7 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/AnalyzeText.json @@ -0,0 +1,35 @@ +{ + "title": "Analyze Text", + "operationId": "TextOperations_AnalyzeText", + "parameters": { + "api-version": "2023-10-15-preview", + "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-10-15-preview/CreateOrUpdateTextBlocklist.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/CreateOrUpdateTextBlocklist.json new file mode 100644 index 000000000000..b90272079691 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/CreateOrUpdateTextBlocklist.json @@ -0,0 +1,25 @@ +{ + "title": "Create Or Update Text Blocklist", + "operationId": "TextBlocklists_CreateOrUpdateTextBlocklist", + "parameters": { + "api-version": "2023-10-15-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/examples/2023-10-15-preview/DeleteTextBlocklist.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/DeleteTextBlocklist.json new file mode 100644 index 000000000000..fe05110389ce --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/DeleteTextBlocklist.json @@ -0,0 +1,11 @@ +{ + "title": "Delete Text Blocklist By blocklistName", + "operationId": "TextBlocklists_DeleteTextBlocklist", + "parameters": { + "api-version": "2023-10-15-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/GetTextBlocklist.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/GetTextBlocklist.json new file mode 100644 index 000000000000..c8598dfaaae5 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/GetTextBlocklist.json @@ -0,0 +1,16 @@ +{ + "title": "Get Text Blocklist By blocklistName", + "operationId": "TextBlocklists_GetTextBlocklist", + "parameters": { + "api-version": "2023-10-15-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "200": { + "body": { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/GetTextBlocklistItem.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/GetTextBlocklistItem.json new file mode 100644 index 000000000000..4f5130659b81 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/GetTextBlocklistItem.json @@ -0,0 +1,18 @@ +{ + "title": "Get BlockItem By blocklistName And blocklistItemId", + "operationId": "TextBlocklists_GetTextBlocklistItem", + "parameters": { + "api-version": "2023-10-15-preview", + "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/ContentSafety/examples/2023-10-15-preview/ListTextBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/ListTextBlocklistItems.json new file mode 100644 index 000000000000..78f9cc864dc6 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/ListTextBlocklistItems.json @@ -0,0 +1,21 @@ +{ + "title": "Get All BlockItems By blocklistName", + "operationId": "TextBlocklists_ListTextBlocklistItems", + "parameters": { + "api-version": "2023-10-15-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "blocklistItemId": "9511969e-f1e3-4604-9127-05ee16c509ec", + "description": "Hate word", + "text": "hate" + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/ListTextBlocklists.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/ListTextBlocklists.json new file mode 100644 index 000000000000..00ec349b7fb5 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/ListTextBlocklists.json @@ -0,0 +1,19 @@ +{ + "title": "Get All Text Blocklists", + "operationId": "TextBlocklists_ListTextBlocklists", + "parameters": { + "api-version": "2023-10-15-preview" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/RemoveBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/RemoveBlocklistItems.json new file mode 100644 index 000000000000..03730b4af821 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-15-preview/RemoveBlocklistItems.json @@ -0,0 +1,16 @@ +{ + "title": "Remove BlockItems From Text Blocklist", + "operationId": "TextBlocklists_RemoveBlocklistItems", + "parameters": { + "api-version": "2023-10-15-preview", + "blocklistName": "TestBlocklist", + "body": { + "blocklistItemIds": [ + "9511969e-f1e3-4604-9127-05ee16c509ec" + ] + } + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/ContentSafety/main.tsp b/specification/cognitiveservices/ContentSafety/main.tsp index a84687b1738c..e50e8d924e4f 100644 --- a/specification/cognitiveservices/ContentSafety/main.tsp +++ b/specification/cognitiveservices/ContentSafety/main.tsp @@ -42,6 +42,9 @@ enum Versions { @useDependency(Azure.Core.Versions.v1_0_Preview_2) v2023_10_01: "2023-10-01", + @useDependency(Azure.Core.Versions.v1_0_Preview_2) + v2023_10_15_Preview: "2023-10-15-preview", + @useDependency(Azure.Core.Versions.v1_0_Preview_2) v2023_10_30_Preview: "2023-10-30-preview", } diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index b5709cb1288f..a78af8a79dbb 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -110,6 +110,50 @@ model TextCategoriesAnalysis { severity?: int32; } +@added(ContentSafety.Versions.v2023_10_15_Preview) +@doc("The protected material analysis request.") +model AnalyzeTextProtectedMaterialOptions { + @doc("The text needs to be analyzed. We support a maximum of 1k Unicode characters (Unicode code points) in the text of one request.") + @maxLength(1000) + text: string; +} + +@added(ContentSafety.Versions.v2023_10_15_Preview) +@doc("The protected material analysis response.") +model AnalyzeTextProtectedMaterialResult { + @doc("Analysis result for protected material.") + protectedMaterialAnalysis: ProtectedMaterialAnalysisResult; +} + +@added(ContentSafety.Versions.v2023_10_15_Preview) +@doc("The text protected material analysis response.") +model ProtectedMaterialAnalysisResult { + @doc("Analysis result for protected material..") + detected: boolean; +} + +@added(ContentSafety.Versions.v2023_10_15_Preview) +@doc("The text jailbreak analysis request.") +model AnalyzeTextJailbreakOptions { + @doc("The text needs to be analyzed if it attempt to jailbreak. We support a maximum of 1k Unicode characters (Unicode code points) in the text of one request.") + @maxLength(1000) + text: string; +} + +@added(ContentSafety.Versions.v2023_10_15_Preview) +@doc("The text jailbreak analysis request.") +model AnalyzeTextJailbreakResult { + @doc("Analysis result for jailbreak.") + jailbreakAnalysis: JailbreakAnalysisResult; +} + +@added(ContentSafety.Versions.v2023_10_15_Preview) +@doc("The text jailbreak analysis response.") +model JailbreakAnalysisResult { + @doc("Analysis result for jailbreak.") + detected: boolean; +} + @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The result of text incident match.") model IncidentMatch { @@ -233,6 +277,7 @@ model TextIncident { @doc("Incident created time.") @visibility("read", "query") created: utcDateTime; + @doc("Incident updated time.") @visibility("read", "query") lastUpdated: utcDateTime; @@ -293,6 +338,7 @@ model ImageIncident { @doc("Incident created time.") @visibility("read", "query") created: utcDateTime; + @doc("Incident updated time.") @visibility("read", "query") lastUpdated: utcDateTime; diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index c31c07eef827..045b4e3d25bd 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -24,6 +24,34 @@ interface TextOperations { }, AnalyzeTextResult >; + + @added(ContentSafety.Versions.v2023_10_15_Preview) + @summary("Analyze Text Jailbreak") + @doc("A synchronous API for the analysis of text jailbreak.") + @route("/text:detectJailbreak") + @post + detectTextJailbreak is Azure.Core.RpcOperation< + { + @body + @doc("The text jailbreak analysis request.") + body: AnalyzeTextJailbreakOptions; + }, + AnalyzeTextJailbreakResult + >; + + @added(ContentSafety.Versions.v2023_10_15_Preview) + @summary("Analyze Protected Material") + @doc("A synchronous API for the analysis of protected material.") + @route("/text:detectProtectedMaterial") + @post + detectTextProtectedMaterial is Azure.Core.RpcOperation< + { + @body + @doc("The text analysis request.") + body: AnalyzeTextProtectedMaterialOptions; + }, + AnalyzeTextProtectedMaterialResult + >; } interface ImageOperations { diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/contentsafety.json new file mode 100644 index 000000000000..0d253eba8334 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/contentsafety.json @@ -0,0 +1,1269 @@ +{ + "swagger": "2.0", + "info": { + "title": "ContentSafety Service", + "version": "2023-10-15-preview", + "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", + "description": "Supported Cognitive Services endpoints (protocol and hostname, for example:\nhttps://.cognitiveservices.azure.com).", + "required": true, + "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": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + }, + "x-ms-examples": { + "Analyze Image": { + "$ref": "./examples/AnalyzeImage.json" + } + } + } + }, + "/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": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + }, + "x-ms-examples": { + "Get All Text Blocklists": { + "$ref": "./examples/ListTextBlocklists.json" + } + }, + "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": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + }, + "x-ms-examples": { + "Get Text Blocklist By blocklistName": { + "$ref": "./examples/GetTextBlocklist.json" + } + } + }, + "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/TextBlocklistCreateOrUpdate" + } + } + ], + "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": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + }, + "x-ms-examples": { + "Create Or Update Text Blocklist": { + "$ref": "./examples/CreateOrUpdateTextBlocklist.json" + } + } + }, + "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": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + }, + "x-ms-examples": { + "Delete Text Blocklist By blocklistName": { + "$ref": "./examples/DeleteTextBlocklist.json" + } + } + } + }, + "/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": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + }, + "x-ms-examples": { + "Add or Update BlocklistItems To Text Blocklist": { + "$ref": "./examples/AddOrUpdateBlocklistItems.json" + } + } + } + }, + "/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": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + }, + "x-ms-examples": { + "Remove BlockItems From Text Blocklist": { + "$ref": "./examples/RemoveBlocklistItems.json" + } + } + } + }, + "/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": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + }, + "x-ms-examples": { + "Get All BlockItems By blocklistName": { + "$ref": "./examples/ListTextBlocklistItems.json" + } + }, + "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 blocklistName 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": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + }, + "x-ms-examples": { + "Get BlockItem By blocklistName And blocklistItemId": { + "$ref": "./examples/GetTextBlocklistItem.json" + } + } + } + }, + "/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": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + }, + "x-ms-examples": { + "Analyze Text": { + "$ref": "./examples/AnalyzeText.json" + } + } + } + }, + "/text:detectJailbreak": { + "post": { + "operationId": "TextOperations_DetectTextJailbreak", + "summary": "Analyze Text Jailbreak", + "description": "A synchronous API for the analysis of text jailbreak.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "body", + "in": "body", + "description": "The text jailbreak analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/AnalyzeTextJailbreakOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AnalyzeTextJailbreakResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + } + } + }, + "/text:detectProtectedMaterial": { + "post": { + "operationId": "TextOperations_DetectTextProtectedMaterial", + "summary": "Analyze Protected Material", + "description": "A synchronous API for the analysis of protected material.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "body", + "in": "body", + "description": "The text analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/AnalyzeTextProtectedMaterialOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AnalyzeTextProtectedMaterialResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + } + } + } + }, + "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": [] + } + }, + "required": [ + "blocklistItems" + ] + }, + "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" + ] + }, + "AnalyzeTextJailbreakOptions": { + "type": "object", + "description": "The text jailbreak analysis request.", + "properties": { + "text": { + "type": "string", + "description": "The text needs to be analyzed if it attempt to jailbreak. We support a maximum of 1k Unicode characters (Unicode code points) in the text of one request.", + "maxLength": 1000 + } + }, + "required": [ + "text" + ] + }, + "AnalyzeTextJailbreakResult": { + "type": "object", + "description": "The text jailbreak analysis request.", + "properties": { + "jailbreakAnalysis": { + "$ref": "#/definitions/JailbreakAnalysisResult", + "description": "Analysis result for jailbreak." + } + }, + "required": [ + "jailbreakAnalysis" + ] + }, + "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", + "EightSeverityLevels" + ], + "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." + }, + { + "name": "EightSeverityLevels", + "value": "EightSeverityLevels", + "description": "Output severities in eight levels, the value could be 0,1,2,3,4,5,6,7." + } + ] + } + }, + "AnalyzeTextProtectedMaterialOptions": { + "type": "object", + "description": "The protected material analysis request.", + "properties": { + "text": { + "type": "string", + "description": "The text needs to be analyzed. We support a maximum of 1k Unicode characters (Unicode code points) in the text of one request.", + "maxLength": 1000 + } + }, + "required": [ + "text" + ] + }, + "AnalyzeTextProtectedMaterialResult": { + "type": "object", + "description": "The protected material analysis response.", + "properties": { + "protectedMaterialAnalysis": { + "$ref": "#/definitions/ProtectedMaterialAnalysisResult", + "description": "Analysis result for protected material." + } + }, + "required": [ + "protectedMaterialAnalysis" + ] + }, + "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 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’, and the output value can be 0, 2, 4, 6." + } + }, + "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." + } + } + }, + "JailbreakAnalysisResult": { + "type": "object", + "description": "The text jailbreak analysis response.", + "properties": { + "detected": { + "type": "boolean", + "description": "Analysis result for jailbreak." + } + }, + "required": [ + "detected" + ] + }, + "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" + ] + }, + "ProtectedMaterialAnalysisResult": { + "type": "object", + "description": "The text protected material analysis response.", + "properties": { + "detected": { + "type": "boolean", + "description": "Analysis result for protected material.." + } + }, + "required": [ + "detected" + ] + }, + "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" + ] + }, + "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.", + "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" + ] + }, + "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 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": [ + "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", + "2023-10-15-preview", + "2023-10-30-preview" + ], + "x-ms-enum": { + "name": "Versions", + "modelAsString": true, + "values": [ + { + "name": "v2023_10_01", + "value": "2023-10-01" + }, + { + "name": "v2023_10_15_Preview", + "value": "2023-10-15-preview" + }, + { + "name": "v2023_10_30_Preview", + "value": "2023-10-30-preview" + } + ] + } + } + }, + "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" + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/AddOrUpdateBlocklistItems.json new file mode 100644 index 000000000000..2c801032dd9d --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/AddOrUpdateBlocklistItems.json @@ -0,0 +1,30 @@ +{ + "title": "Add or Update BlocklistItems To Text Blocklist", + "operationId": "TextBlocklists_AddOrUpdateBlocklistItems", + "parameters": { + "api-version": "2023-10-15-preview", + "blocklistName": "TestBlocklist", + "body": { + "blocklistItems": [ + { + "blocklistItemId": null, + "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/preview/2023-10-15-preview/examples/AnalyzeImage.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/AnalyzeImage.json new file mode 100644 index 000000000000..8132fdf88268 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/AnalyzeImage.json @@ -0,0 +1,36 @@ +{ + "title": "Analyze Image", + "operationId": "ImageOperations_AnalyzeImage", + "parameters": { + "api-version": "2023-10-15-preview", + "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/preview/2023-10-15-preview/examples/AnalyzeText.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/AnalyzeText.json new file mode 100644 index 000000000000..102d8379a8f7 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/AnalyzeText.json @@ -0,0 +1,35 @@ +{ + "title": "Analyze Text", + "operationId": "TextOperations_AnalyzeText", + "parameters": { + "api-version": "2023-10-15-preview", + "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/preview/2023-10-15-preview/examples/CreateOrUpdateTextBlocklist.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/CreateOrUpdateTextBlocklist.json new file mode 100644 index 000000000000..b90272079691 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/CreateOrUpdateTextBlocklist.json @@ -0,0 +1,25 @@ +{ + "title": "Create Or Update Text Blocklist", + "operationId": "TextBlocklists_CreateOrUpdateTextBlocklist", + "parameters": { + "api-version": "2023-10-15-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/data-plane/ContentSafety/preview/2023-10-15-preview/examples/DeleteTextBlocklist.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/DeleteTextBlocklist.json new file mode 100644 index 000000000000..fe05110389ce --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/DeleteTextBlocklist.json @@ -0,0 +1,11 @@ +{ + "title": "Delete Text Blocklist By blocklistName", + "operationId": "TextBlocklists_DeleteTextBlocklist", + "parameters": { + "api-version": "2023-10-15-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/GetTextBlocklist.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/GetTextBlocklist.json new file mode 100644 index 000000000000..c8598dfaaae5 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/GetTextBlocklist.json @@ -0,0 +1,16 @@ +{ + "title": "Get Text Blocklist By blocklistName", + "operationId": "TextBlocklists_GetTextBlocklist", + "parameters": { + "api-version": "2023-10-15-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "200": { + "body": { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/GetTextBlocklistItem.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/GetTextBlocklistItem.json new file mode 100644 index 000000000000..4f5130659b81 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/GetTextBlocklistItem.json @@ -0,0 +1,18 @@ +{ + "title": "Get BlockItem By blocklistName And blocklistItemId", + "operationId": "TextBlocklists_GetTextBlocklistItem", + "parameters": { + "api-version": "2023-10-15-preview", + "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/preview/2023-10-15-preview/examples/ListTextBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/ListTextBlocklistItems.json new file mode 100644 index 000000000000..78f9cc864dc6 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/ListTextBlocklistItems.json @@ -0,0 +1,21 @@ +{ + "title": "Get All BlockItems By blocklistName", + "operationId": "TextBlocklists_ListTextBlocklistItems", + "parameters": { + "api-version": "2023-10-15-preview", + "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/preview/2023-10-15-preview/examples/ListTextBlocklists.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/ListTextBlocklists.json new file mode 100644 index 000000000000..00ec349b7fb5 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/ListTextBlocklists.json @@ -0,0 +1,19 @@ +{ + "title": "Get All Text Blocklists", + "operationId": "TextBlocklists_ListTextBlocklists", + "parameters": { + "api-version": "2023-10-15-preview" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/RemoveBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/RemoveBlocklistItems.json new file mode 100644 index 000000000000..03730b4af821 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-15-preview/examples/RemoveBlocklistItems.json @@ -0,0 +1,16 @@ +{ + "title": "Remove BlockItems From Text Blocklist", + "operationId": "TextBlocklists_RemoveBlocklistItems", + "parameters": { + "api-version": "2023-10-15-preview", + "blocklistName": "TestBlocklist", + "body": { + "blocklistItemIds": [ + "9511969e-f1e3-4604-9127-05ee16c509ec" + ] + } + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/contentsafety.json index 0c70d56768a4..f534308aeadd 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/contentsafety.json @@ -1448,6 +1448,88 @@ } } } + }, + "/text:detectJailbreak": { + "post": { + "operationId": "TextOperations_DetectTextJailbreak", + "summary": "Analyze Text Jailbreak", + "description": "A synchronous API for the analysis of text jailbreak.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "body", + "in": "body", + "description": "The text jailbreak analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/AnalyzeTextJailbreakOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AnalyzeTextJailbreakResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + } + } + }, + "/text:detectProtectedMaterial": { + "post": { + "operationId": "TextOperations_DetectTextProtectedMaterial", + "summary": "Analyze Protected Material", + "description": "A synchronous API for the analysis of protected material.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "body", + "in": "body", + "description": "The text analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/AnalyzeTextProtectedMaterialOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AnalyzeTextProtectedMaterialResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + } + } } }, "definitions": { @@ -1672,6 +1754,33 @@ "categoriesAnalysis" ] }, + "AnalyzeTextJailbreakOptions": { + "type": "object", + "description": "The text jailbreak analysis request.", + "properties": { + "text": { + "type": "string", + "description": "The text needs to be analyzed if it attempt to jailbreak. We support a maximum of 1k Unicode characters (Unicode code points) in the text of one request.", + "maxLength": 1000 + } + }, + "required": [ + "text" + ] + }, + "AnalyzeTextJailbreakResult": { + "type": "object", + "description": "The text jailbreak analysis request.", + "properties": { + "jailbreakAnalysis": { + "$ref": "#/definitions/JailbreakAnalysisResult", + "description": "Analysis result for jailbreak." + } + }, + "required": [ + "jailbreakAnalysis" + ] + }, "AnalyzeTextOptions": { "type": "object", "description": "The text analysis request.", @@ -1737,6 +1846,33 @@ ] } }, + "AnalyzeTextProtectedMaterialOptions": { + "type": "object", + "description": "The protected material analysis request.", + "properties": { + "text": { + "type": "string", + "description": "The text needs to be analyzed. We support a maximum of 1k Unicode characters (Unicode code points) in the text of one request.", + "maxLength": 1000 + } + }, + "required": [ + "text" + ] + }, + "AnalyzeTextProtectedMaterialResult": { + "type": "object", + "description": "The protected material analysis response.", + "properties": { + "protectedMaterialAnalysis": { + "$ref": "#/definitions/ProtectedMaterialAnalysisResult", + "description": "Analysis result for protected material." + } + }, + "required": [ + "protectedMaterialAnalysis" + ] + }, "AnalyzeTextResult": { "type": "object", "description": "The text analysis response.", @@ -2091,6 +2227,19 @@ } } }, + "JailbreakAnalysisResult": { + "type": "object", + "description": "The text jailbreak analysis response.", + "properties": { + "detected": { + "type": "boolean", + "description": "Analysis result for jailbreak." + } + }, + "required": [ + "detected" + ] + }, "LabelDefinition": { "type": "object", "description": "Label definition.", @@ -2274,6 +2423,19 @@ "description" ] }, + "ProtectedMaterialAnalysisResult": { + "type": "object", + "description": "The text protected material analysis response.", + "properties": { + "detected": { + "type": "boolean", + "description": "Analysis result for protected material.." + } + }, + "required": [ + "detected" + ] + }, "RemoveImageIncidentSamplesOptions": { "type": "object", "description": "The request to remove incidentSamples from a incident.", @@ -2582,6 +2744,7 @@ "type": "string", "enum": [ "2023-10-01", + "2023-10-15-preview", "2023-10-30-preview" ], "x-ms-enum": { @@ -2592,6 +2755,10 @@ "name": "v2023_10_01", "value": "2023-10-01" }, + { + "name": "v2023_10_15_Preview", + "value": "2023-10-15-preview" + }, { "name": "v2023_10_30_Preview", "value": "2023-10-30-preview" diff --git a/specification/cognitiveservices/data-plane/ContentSafety/readme.md b/specification/cognitiveservices/data-plane/ContentSafety/readme.md index 7dc3dd1cf5eb..b831713e2813 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-15-preview ``` ### Tag: package-2023-04-30-preview @@ -47,7 +47,14 @@ input-file: - stable/2023-10-01/contentsafety.json ``` ---- +### Tag: package-2023-10-15-preview + +These settings apply only when `--tag=package-2023-10-15-preview` is specified on the command line. + +```yaml $(tag) == 'package-2023-10-15-preview' +input-file: + - preview/2023-10-15-preview/contentsafety.json +``` # Code Generation @@ -66,6 +73,7 @@ swagger-to-sdk: - repo: azure-cli-extensions - repo: azure-powershell ``` + ## Az See configuration in [readme.az.md](./readme.az.md) @@ -84,4 +92,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 87b3d95b9097..d2f7937301e8 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 @@ -1041,6 +1041,7 @@ "type": "string", "enum": [ "2023-10-01", + "2023-10-15-preview", "2023-10-30-preview" ], "x-ms-enum": { @@ -1051,6 +1052,10 @@ "name": "v2023_10_01", "value": "2023-10-01" }, + { + "name": "v2023_10_15_Preview", + "value": "2023-10-15-preview" + }, { "name": "v2023_10_30_Preview", "value": "2023-10-30-preview"