From 8775b51e07d68b16c555f9251ca87e141d58fd65 Mon Sep 17 00:00:00 2001 From: mengaims <50131889+mengaims@users.noreply.github.com> Date: Thu, 11 Jan 2024 15:49:53 +0800 Subject: [PATCH 01/13] Add private preview versions to feature branch (#43) * Add ga contract for Content Safety * Update examples for 2023-10-01 * Resolve ModelValidation SpellCheck and Avocado * Fix typo * Fix minor errors in example and readme * Fix example * remove the 0430 content * update readme * re-format markdowm * Fix example * init content safety 2023-10-15-preview * init content safety 2023-10-15-previwe * update * format example * update read me file * update * update * update contract * update * update * update threshold * update new contract by add judgement kind enum * update description * u * update * updat length * update * update * update description for accept severity threshodl * update * merge with acs-ga * Add snippy contract * remove 8 sev levels for image * update contentsafety.json * Update snippy path * add type spec for jailbreak * Add incident response API in 2023-10-30-preview * compiled * Adaptive annotation service contract * Remove operations * update * update * refine * update * make 0,1,2,3,4,5,6,7 to 0, 1, 2, 3, ... and add comman in last enum value * update path * Update NL Snippy path * Resolve conflict * add * add * remove labelName * Fix route and minor errors * Change typo * update * Update protected material API * update project sample * Change path name * Update protect material contract * update jailbreak * Update incident contract * Update contract * Update * scenarios to enumerations (#19) * Remove project related contract (#20) * Remove project related things * Remove accepted * Remove examples * Merge 1015 (#22) * Add ga contract for Content Safety * Update examples for 2023-10-01 * Resolve ModelValidation SpellCheck and Avocado * Fix typo * Fix minor errors in example and readme * Fix example * remove the 0430 content * update readme * re-format markdowm * Fix example * init content safety 2023-10-15-preview * init content safety 2023-10-15-previwe * update * format example * update read me file * update * update * update contract * update * update * update threshold * update new contract by add judgement kind enum * update description * u * update * updat length * update * update * update description for accept severity threshodl * update * merge with acs-ga * Add snippy contract * remove 8 sev levels for image * update contentsafety.json * Update snippy path * add type spec for jailbreak * compiled * update * update * refine * update * make 0,1,2,3,4,5,6,7 to 0, 1, 2, 3, ... and add comman in last enum value * update path * Update NL Snippy path * Resolve conflict * Update protected material API * update project sample * Change path name * Update protect material contract * update jailbreak * Remove project related contract (#20) * Remove project related things * Remove accepted * Remove examples --------- Co-authored-by: FAREAST\suxi Co-authored-by: Lixiang Liu Co-authored-by: Lixiang Liu Co-authored-by: zhaiyutong * Add list API for Annotation Service (#23) * Add ga contract for Content Safety * Update examples for 2023-10-01 * Resolve ModelValidation SpellCheck and Avocado * Fix typo * Fix minor errors in example and readme * Fix example * remove the 0430 content * update readme * re-format markdowm * Fix example * init content safety 2023-10-15-preview * init content safety 2023-10-15-previwe * update * format example * update read me file * update * update * update contract * update * update * update threshold * update new contract by add judgement kind enum * update description * u * update * updat length * update * update * update description for accept severity threshodl * update * merge with acs-ga * Add snippy contract * remove 8 sev levels for image * update contentsafety.json * Update snippy path * add type spec for jailbreak * compiled * update * update * refine * update * make 0,1,2,3,4,5,6,7 to 0, 1, 2, 3, ... and add comman in last enum value * update path * Update NL Snippy path * Resolve conflict * Update protected material API * update project sample * Change path name * Update protect material contract * update jailbreak * Remove project related contract (#20) * Remove project related things * Remove accepted * Remove examples * Add list category APIs --------- Co-authored-by: FAREAST\suxi Co-authored-by: Lixiang Liu Co-authored-by: Lixiang Liu Co-authored-by: zhaiyutong * Update contract for incident response (#24) Co-authored-by: Lixiang Liu * scenarios to enumerations (#25) * [Cognitive Services - Azure AI Content Safety] - 2023-11-30-preview Private Preview * update doc * resolve comments. * Merge main and recompile swagger * add explanation for 2023-11-30-preview * format * generate swagger * Optimize contract (#36) * add 12-30-preview, add explanation spec * update * renamed reason -> harmful chunks * update. * remove new version enum from GA version * Remove examples from 1015 * restore examples * Add examples for jailbreak and protected material * run prettier for example * commit add enum to stable * Add omit-unreachable-types: true to typespec * compile preview * Fix readme * renamed to citation * UPDATE: add reasoning column and update some docs. * update doc. * update api version. * Fix some typo issues. (#40) * Update data plane. * Remove unused versions --------- Co-authored-by: FAREAST\suxi Co-authored-by: Lixiang Liu Co-authored-by: Lixiang Liu Co-authored-by: zhaiyutong Co-authored-by: YUTONG_ZHAI <32332316+zhaiyutong@users.noreply.github.com> Co-authored-by: Jie Zhou Co-authored-by: Yuxiao Wang Co-authored-by: Yuxiao Wang <58904990+Sayaka-4987@users.noreply.github.com> Co-authored-by: jiezhou_microsoft <94604058+JieZhou000@users.noreply.github.com> --- .../AddOrUpdateBlocklistItems.json | 30 + .../2023-10-30-preview/AnalyzeImage.json | 36 + .../2023-10-30-preview/AnalyzeText.json | 38 + .../CreateOrUpdateTextBlocklist.json | 25 + .../DeleteTextBlocklist.json | 11 + .../2023-10-30-preview/GetTextBlocklist.json | 16 + .../GetTextBlocklistItem.json | 18 + .../ListTextBlocklistItems.json | 21 + .../ListTextBlocklists.json | 19 + .../RemoveBlocklistItems.json | 16 + .../cognitiveservices/ContentSafety/main.tsp | 6 + .../ContentSafety/models.tsp | 389 +++ .../ContentSafety/routes.tsp | 174 + .../2023-10-30-preview/contentsafety.json | 3102 +++++++++++++++++ .../examples/AddOrUpdateBlocklistItems.json | 30 + .../examples/AnalyzeImage.json | 36 + .../examples/AnalyzeText.json | 38 + .../examples/CreateOrUpdateTextBlocklist.json | 25 + .../examples/DeleteTextBlocklist.json | 11 + .../examples/GetTextBlocklist.json | 16 + .../examples/GetTextBlocklistItem.json | 18 + .../examples/ListTextBlocklistItems.json | 21 + .../examples/ListTextBlocklists.json | 19 + .../examples/RemoveBlocklistItems.json | 16 + .../2024-01-30-preview/contentsafety.json | 3059 ++++++++++++++++ .../data-plane/ContentSafety/readme.md | 2 +- 26 files changed, 7191 insertions(+), 1 deletion(-) create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/AddOrUpdateBlocklistItems.json create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/AnalyzeImage.json create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/AnalyzeText.json create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/CreateOrUpdateTextBlocklist.json create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/DeleteTextBlocklist.json create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/GetTextBlocklist.json create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/GetTextBlocklistItem.json create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/ListTextBlocklistItems.json create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/ListTextBlocklists.json create mode 100644 specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/RemoveBlocklistItems.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/contentsafety.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/AddOrUpdateBlocklistItems.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/AnalyzeImage.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/AnalyzeText.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/CreateOrUpdateTextBlocklist.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/DeleteTextBlocklist.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/GetTextBlocklist.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/GetTextBlocklistItem.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/ListTextBlocklistItems.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/ListTextBlocklists.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/RemoveBlocklistItems.json create mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/AddOrUpdateBlocklistItems.json new file mode 100644 index 000000000000..c7353595d2ef --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/AddOrUpdateBlocklistItems.json @@ -0,0 +1,30 @@ +{ + "title": "Add or Update BlocklistItems To Text Blocklist", + "operationId": "TextBlocklists_AddOrUpdateBlocklistItems", + "parameters": { + "api-version": "2023-12-30-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-30-preview/AnalyzeImage.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/AnalyzeImage.json new file mode 100644 index 000000000000..0d447cf2bab2 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/AnalyzeImage.json @@ -0,0 +1,36 @@ +{ + "title": "Analyze Image", + "operationId": "ImageOperations_AnalyzeImage", + "parameters": { + "api-version": "2023-12-30-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-30-preview/AnalyzeText.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/AnalyzeText.json new file mode 100644 index 000000000000..c15ad6ccad29 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/AnalyzeText.json @@ -0,0 +1,38 @@ +{ + "title": "Analyze Text", + "operationId": "TextOperations_AnalyzeText", + "parameters": { + "api-version": "2023-12-30-preview", + "body": { + "text": "This is text example. A hate speech sentence. A sentence with a violent description." + } + }, + "responses": { + "200": { + "body": { + "blocklistsMatch": [], + "categoriesAnalysis": [{ + "category": "Hate", + "severity": 0 + }, + { + "category": "SelfHarm", + "severity": 0 + }, + { + "category": "Sexual", + "severity": 0 + }, + { + "category": "Violence", + "severity": 0 + } + ], + "citation": [ + "A hate speech sentence", + "A sentence with a violent description" + ] + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/CreateOrUpdateTextBlocklist.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/CreateOrUpdateTextBlocklist.json new file mode 100644 index 000000000000..c8950fe923b6 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/CreateOrUpdateTextBlocklist.json @@ -0,0 +1,25 @@ +{ + "title": "Create Or Update Text Blocklist", + "operationId": "TextBlocklists_CreateOrUpdateTextBlocklist", + "parameters": { + "api-version": "2023-12-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/examples/2023-10-30-preview/DeleteTextBlocklist.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/DeleteTextBlocklist.json new file mode 100644 index 000000000000..30af65c0662d --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/DeleteTextBlocklist.json @@ -0,0 +1,11 @@ +{ + "title": "Delete Text Blocklist By blocklistName", + "operationId": "TextBlocklists_DeleteTextBlocklist", + "parameters": { + "api-version": "2023-12-30-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/GetTextBlocklist.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/GetTextBlocklist.json new file mode 100644 index 000000000000..73786c7a4c36 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/GetTextBlocklist.json @@ -0,0 +1,16 @@ +{ + "title": "Get Text Blocklist By blocklistName", + "operationId": "TextBlocklists_GetTextBlocklist", + "parameters": { + "api-version": "2023-12-30-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "200": { + "body": { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/GetTextBlocklistItem.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/GetTextBlocklistItem.json new file mode 100644 index 000000000000..c5e7eaf86b46 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/GetTextBlocklistItem.json @@ -0,0 +1,18 @@ +{ + "title": "Get BlockItem By blocklistName And blocklistItemId", + "operationId": "TextBlocklists_GetTextBlocklistItem", + "parameters": { + "api-version": "2023-12-30-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-30-preview/ListTextBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/ListTextBlocklistItems.json new file mode 100644 index 000000000000..13352ef1692c --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/ListTextBlocklistItems.json @@ -0,0 +1,21 @@ +{ + "title": "Get All BlockItems By blocklistName", + "operationId": "TextBlocklists_ListTextBlocklistItems", + "parameters": { + "api-version": "2023-12-30-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-30-preview/ListTextBlocklists.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/ListTextBlocklists.json new file mode 100644 index 000000000000..65dc19eec7b3 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/ListTextBlocklists.json @@ -0,0 +1,19 @@ +{ + "title": "Get All Text Blocklists", + "operationId": "TextBlocklists_ListTextBlocklists", + "parameters": { + "api-version": "2023-12-30-preview" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/RemoveBlocklistItems.json b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/RemoveBlocklistItems.json new file mode 100644 index 000000000000..a9a603bc3d80 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/examples/2023-10-30-preview/RemoveBlocklistItems.json @@ -0,0 +1,16 @@ +{ + "title": "Remove BlockItems From Text Blocklist", + "operationId": "TextBlocklists_RemoveBlocklistItems", + "parameters": { + "api-version": "2023-12-30-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 dd5ca93f7cdb..f98389174c9b 100644 --- a/specification/cognitiveservices/ContentSafety/main.tsp +++ b/specification/cognitiveservices/ContentSafety/main.tsp @@ -44,4 +44,10 @@ enum Versions { @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", + + @useDependency(Azure.Core.Versions.v1_0_Preview_2) + v2024_01_30_Preview: "2024-01-30-preview", } diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index 933b73365870..6459f69d9e01 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -57,6 +57,20 @@ model AnalyzeTextOptions { @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; + + @added(ContentSafety.Versions.v2023_10_30_Preview) + @doc("The incidents to detect.") + incidents?: IncidentOptions; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The text analysis request.") +model IncidentOptions { + @doc("The accept decision made by service.") + incidentNames?: string[]; + + @doc("When set to true, further analyses of harmful content will not be performed in cases where incidents are hit. When set to false, all analyses of harmful content will be performed, whether or not incidents are hit.") + haltOnIncidentHit?: boolean; } @doc("The text analysis response.") @@ -66,6 +80,14 @@ model AnalyzeTextResult { @doc("Analysis result for categories.") categoriesAnalysis: TextCategoriesAnalysis[]; + + @added(ContentSafety.Versions.v2023_10_30_Preview) + @doc("The incident match details.") + incidentMatches?: IncidentMatch[]; + + @added(ContentSafety.Versions.v2024_01_30_Preview) + @doc("Chunks in the original text detected as harmful content. Analysis result and scores are caused by these.") + citation?: string[]; } @doc("The result of blocklist match.") @@ -92,6 +114,14 @@ model TextCategoriesAnalysis { severity?: int32; } +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The result of text incident match.") +model IncidentMatch { + @doc("The name of the matched incident.") + @maxLength(64) + incidentName: string; +} + @doc("The image analysis request.") model AnalyzeImageOptions { @doc("The image needs to be analyzed.") @@ -102,6 +132,10 @@ model AnalyzeImageOptions { @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; + + @added(ContentSafety.Versions.v2023_10_30_Preview) + @doc("The incidents to detect.") + incidents?: IncidentOptions; } @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.") @@ -120,6 +154,10 @@ model ImageData { model AnalyzeImageResult { @doc("Analysis result for categories.") categoriesAnalysis: ImageCategoriesAnalysis[]; + + @added(ContentSafety.Versions.v2023_10_30_Preview) + @doc("The incident match details.") + incidentMatches?: IncidentMatch[]; } @doc("Image analysis result.") @@ -228,3 +266,354 @@ model JailbreakAnalysisResult { @doc("Analysis result for jailbreak.") detected: boolean; } + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("Text Incident.") +@resource("text/incidents") +model TextIncident { + @doc("incident name.") + @pattern("^[0-9A-Za-z._~-]+$") + @key("incidentName") + @visibility("read", "create", "query") + @maxLength(64) + incidentName: string; + + @doc("Incident description.") + @maxLength(1024) + description?: string; + + @doc("Incident created time.") + @visibility("read", "query") + created: utcDateTime; + + @doc("Incident updated time.") + @visibility("read", "query") + lastUpdated: utcDateTime; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("Sample in a Text Incident.") +@resource("incidentSamples") +@parentResource(TextIncident) +model TextIncidentSample { + @doc("incident name.") + @key("incidentSampleId") + @visibility("read") + @maxLength(64) + incidentSampleId: string; + + @doc("IncidentSample text content.") + @maxLength(1024) + text?: string; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The request to add incidentSamples to a incident.") +model AddTextIncidentSamplesOptions { + @doc("Array of incidentSamples to add.") + incidentSamples: TextIncidentSample[]; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The response of adding incidentSamples to the incident.") +model AddTextIncidentSamplesResult { + @doc("Array of incidentSamples have been added.") + incidentSamples: TextIncidentSample[]; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The request to remove incidentSamples from a incident.") +model RemoveTextIncidentSamplesOptions { + @doc("Array of incidentSamples to remove.") + incidentSampleIds: string[]; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("Image Incident.") +@resource("image/incidents") +model ImageIncident { + @doc("incident name.") + @pattern("^[0-9A-Za-z._~-]+$") + @key("incidentName") + @visibility("read", "create", "query") + @maxLength(64) + incidentName: string; + + @doc("Incident description.") + @maxLength(1024) + description?: string; + + @doc("Incident created time.") + @visibility("read", "query") + created: utcDateTime; + + @doc("Incident updated time.") + @visibility("read", "query") + lastUpdated: utcDateTime; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("Sample in an Image Incident.") +@resource("incidentSamples") +@parentResource(ImageIncident) +model ImageIncidentSample { + @doc("incident name.") + @key("incidentSampleId") + @visibility("read") + @maxLength(64) + incidentSampleId: string; + + @doc("IncidentSample image content.") + image?: ImageData; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The image result is base64 encoded bytes") +@projectedName("csharp", "ContentSafetyImageDataResult") +model ImageDataResult { + @doc("The Base64 encoding of the image.") + content?: bytes; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("Sample Result in an Image Incident.") +@resource("incidentSamples") +@parentResource(ImageIncident) +model ImageIncidentSampleResult { + @doc("incident name.") + @key("incidentSampleId") + @visibility("read") + @maxLength(64) + incidentSampleId: string; + + @doc("IncidentSample image content.") + image?: ImageDataResult; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The request to add incidentSamples to a incident.") +model AddImageIncidentSamplesOptions { + @doc("Array of incidentSamples to add.") + incidentSamples: ImageIncidentSample[]; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The request to remove incidentSamples from a incident.") +model RemoveImageIncidentSamplesOptions { + @doc("Array of incidentSamples to remove.") + incidentSampleIds: string[]; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("Sample in a Image Incident.") +@resource("incidentSamples") +@parentResource(ImageIncident) +model ListImageIncidentSampleResult { + @doc("incident name.") + @key("incidentSampleId") + @visibility("read") + @maxLength(64) + incidentSampleId: string; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The response of adding incidentSamples to the incident.") +model AddImageIncidentSamplesResult { + @doc("Array of incidentSamples have been added.") + incidentSamples: ListImageIncidentSampleResult[]; +} + +@doc("Annotate text options") +@added(Versions.v2023_10_30_Preview) +model AnnotateTextOptions { + @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 category will be analyzed, you can set your customized category or one of built-in categories in 'Hate','Selfharm', 'Sexual' and 'Violence'.") + category: string; +} + +@doc("The text annotation response.") +@added(Versions.v2023_10_30_Preview) +model AnnotateTextResult { + @doc("The id of annotated subcategory.") + id: int32; + + @doc("The name of annotated subcategory.") + name: string; + + @doc("The reasoning.") + reasoning?: string; +} + +@added(Versions.v2023_10_30_Preview) +@doc("Pre-defined concept.") +model PreDefinedConcept { + concept: string; + description: string; +} + +@added(Versions.v2023_10_30_Preview) +@doc("Label definition.") +model SubCategory { + id: int32; + name: string; + statements: string[]; +} + +@added(Versions.v2023_10_30_Preview) +@doc("Text Customized categories.") +@resource("text/categories") +model TextCustomizedCategory { + @doc("Text customizedCategories name.") + @pattern("^Customized_[0-9A-Za-z._~-]+$") + @key("categoryName") + @visibility("read", "create", "query") + @maxLength(64) + categoryName: string; + + preDefinedConcepts?: PreDefinedConcept[]; + subCategories: SubCategory[]; + emphases?: string[]; + exampleBlobUrl?: url; +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("ImageWithText analyze category.") +enum ImageWithTextCategory { + Hate, + SelfHarm, + Sexual, + Violence, +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The analysis request of the image with text.") +model AnalyzeImageWithTextOptions { + @doc("The image needs to be analyzed.") + image: ImageData; + + @doc("The text attached to the image. We support at most 1k characters (unicode code points) in one text request.") + @maxLength(1000) + text?: string; + + @doc("The categories will be analyzed. If they are not assigned, a default set of analysis results for the categories will be returned.") + categories?: ImageWithTextCategory[]; + + @doc("When set to true, our service will perform OCR and concatenate the recognized text with input text before analyzing. We will recognize at most 256 characters (unicode code points) from input image. The others will be truncated.") + enableOcr: boolean; +} + +@added(Versions.v2023_10_30_Preview) +@doc("ImageWithText analysis result.") +model ImageWithTextCategoriesAnalysis { + @doc("The imageWithtext analysis category.") + category: ImageWithTextCategory; + + @doc("The higher the severity of input content, the larger this value is. The values could be: 0,2,4,6.") + severity?: int32; +} + +@added(Versions.v2023_10_30_Preview) +@doc("The analysis response of the image with text.") +model AnalyzeImageWithTextResult { + @doc("Analysis result for categories.") + categoriesAnalysis: ImageWithTextCategoriesAnalysis[]; +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("Domain.") +enum Domain { + Generic, + Medical, +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("Task type.") +enum Task { + Summarization, + QnA, +} + +@added(Versions.v2023_10_30_Preview) +@doc("Connection details for the GPT resource.") +model GptResource { + @doc("Endpoint for Azure OpenAI resource.") + azureOpenAIEndpoint: string; + + @doc("Deployment model name.") + deploymentName: string; +} + +@added(Versions.v2023_10_30_Preview) +@doc("The request of ungroundedness detection.") +model DetectUngroundednessOptions { + @doc(""" + The domain of the text for analysis. + This field is optional, with a default value of Generic. + """) + domain?: Domain; + + @doc(""" + The task type for the text analysis. + This field is optional, with a default value of Summarization. + """) + task?: Task; + + @doc(""" + The user's question input in a QnA scenario. + This field is optional, but if the task type is set to QnA, it becomes required. + """) + query?: string; + + @doc("The text requiring analysis.") + text: string; + + @doc("The source information used as a grounding reference.") + groundingSources: string[]; + + @doc(""" + A value indicating if the output includes an explanation for the identified ungroundedness. + This field is optional, with a default value of false. + """) + reasoning?: boolean; + + @doc(""" + Connection details for the GPT resource. + This field will be used only when the 'reasoning' field is set to true; otherwise, it will be ignored. + """) + gptResource?: GptResource; +} + +@added(Versions.v2023_10_30_Preview) +@doc("The detailed information about a text identified as ungrounded.") +model UngroundedDetails { + @doc("The ungrounded text.") + text: string; + + @doc(""" + The explanation for identifying the text as ungrounded. + Only when the 'reasoning' field in the input is set to true 'reason' field will be returned. + """) + reason?: string; +} + +@added(Versions.v2023_10_30_Preview) +@doc("The response of ungroundedness detection.") +model DetectUngroundednessResult { + @doc("Detection result for ungrounded text.") + ungrounded: boolean; + + @doc("Confidence score of the model in the analysis results.") + confidenceScore: float32; + + @doc("Percentage of ungrounded Text.") + ungroundedPercentage: float32; + + @doc("The detailed information about a text identified as ungrounded.") + ungroundedDetails: UngroundedDetails[]; +} diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 44166e23feff..6e0b436297b0 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -149,3 +149,177 @@ interface TextBlocklists { ListQueryParametersTrait >; } + +interface TextIncidentOps + extends Azure.Core.ResourceOperations {} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +interface TextIncidents { + @summary("Get Text Incident By incidentName") + @doc("Returns text incident details.") + getIncidents is TextIncidentOps.ResourceRead; + + @summary("Create Or Update Text Incident") + @doc("Updates a text incident. If the text incident does not exist, a new text incident will be created.") + createOrUpdateIncident is TextIncidentOps.ResourceCreateOrUpdate; + + @summary("Delete Text Incident By incidentName") + @doc("Deletes a text incident.") + deleteIncident is TextIncidentOps.ResourceDelete; + + @summary("Get All Text Incidents") + @doc("Get all incidents details.") + listIncidents is TextIncidentOps.ResourceList< + TextIncident, + ListQueryParametersTrait + >; + + @summary("Add TextIncidentSamples To Incident") + @doc("Add textIncidentSamples to an incident. You can add at most 100 textIncidentSamples in one request.") + addIncidentSamples is TextIncidentOps.ResourceAction< + TextIncident, + AddTextIncidentSamplesOptions, + AddTextIncidentSamplesResult + >; + + @summary("Remove TextIncidentSamples From Incident") + @doc("Remove textIncidentSamples from an incident. You can remove at most 100 Text Incident in one request.") + removeIncidentSamples is TextIncidentOps.ResourceAction< + TextIncident, + RemoveTextIncidentSamplesOptions, + NoContentResponse + >; + + @summary("Get TextIncidentSample By textIncidentName And textIncidentSampleId") + @doc("Get textIncidentSample by textIncidentName and textIncidentSampleId from a text incident.") + getIncidentSample is TextIncidentOps.ResourceRead; + + @summary("Get All TextIncidentSamples By textIncidentName") + @doc("Get all TextIncidentSamples in a text incident.") + listIncidentSamples is TextIncidentOps.ResourceList< + TextIncidentSample, + ListQueryParametersTrait + >; +} + +interface ImageIncidentOps + extends Azure.Core.ResourceOperations {} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +interface ImageIncidents { + @summary("Get Image Incident By incidentName") + @doc("Returns image incident details.") + getIncidents is ImageIncidentOps.ResourceRead; + + @summary("Create Or Update Image Incident") + @doc("Updates a image incident. If the image incident does not exist, a new image incident will be created.") + createOrUpdateIncident is ImageIncidentOps.ResourceCreateOrUpdate; + + @summary("Delete Image Incident By incidentName") + @doc("Deletes a image incident.") + deleteIncident is ImageIncidentOps.ResourceDelete; + + @summary("Get All Image Incidents") + @doc("Get all incidents details.") + listIncidents is ImageIncidentOps.ResourceList< + ImageIncident, + ListQueryParametersTrait + >; + + @summary("Add ImageIncidentSamples To Incident") + @doc("Add imageIncidentSamples to an incident. You can add at most 100 imageIncidentSamples in one request.") + addIncidentSamples is ImageIncidentOps.ResourceAction< + ImageIncident, + AddImageIncidentSamplesOptions, + AddImageIncidentSamplesResult + >; + + @summary("Remove ImageIncidentSamples From Incident") + @doc("Remove imageIncidentSamples from an incident. You can remove at most 100 Image Incident in one request.") + removeIncidentSamples is ImageIncidentOps.ResourceAction< + ImageIncident, + RemoveImageIncidentSamplesOptions, + NoContentResponse + >; + + @summary("Get ImageIncidentSample By imageIncidentName And imageIncidentSampleId") + @doc("Get imageIncidentSample by imageIncidentName and imageIncidentSampleId from a image incident.") + getIncidentSample is ImageIncidentOps.ResourceRead; + + @summary("Get All ImageIncidentSamples By imageIncidentName") + @doc("Get all ImageIncidentSamples in a image incident.") + listIncidentSamples is ImageIncidentOps.ResourceList< + ListImageIncidentSampleResult, + ListQueryParametersTrait + >; +} + +@added(Versions.v2023_10_30_Preview) +interface PromptTextOperations { + @summary("Annotate Text by Prompt") + @route("/text:adaptiveAnnotate") + @post + annotateText is Azure.Core.RpcOperation< + { + @body + @doc("The text analysis request.") + body: AnnotateTextOptions; + }, + AnnotateTextResult + >; +} + +interface CategoryOps + extends Azure.Core.ResourceOperations {} + +@added(Versions.v2023_10_30_Preview) +interface TextCategoryCustomization { + createOrReplaceTextCustomizedCategory is CategoryOps.ResourceCreateOrReplace; + + getTextCustomizedCategory is CategoryOps.ResourceRead; + + deleteTextCustomizedCategory is CategoryOps.ResourceDelete; + + listTextCustomizedCategory is CategoryOps.ResourceList< + TextCustomizedCategory, + ListQueryParametersTrait + >; +} + +@added(Versions.v2023_10_30_Preview) +interface ImageWithTextOperations { + @summary("Analyze Image With Text") + @doc("A synchronous API for the analysis of potentially harmful image with text content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.") + @route("/imageWithText:analyze") + @post + analyzeImageWithText is Azure.Core.RpcOperation< + { + @doc("The image with text analysis request.") + @body + body: AnalyzeImageWithTextOptions; + }, + AnalyzeImageWithTextResult + >; +} + +@added(Versions.v2023_10_30_Preview) +interface TextUngroundednessDetectionOperations { + @summary("Detect Ungrounded Information") + @doc("A synchronous API for the analysis of language model outputs to determine alignment with user-provided information or identify fictional content.") + @route("/text:detectUngroundedness") + @post + detectUngroundedness is Azure.Core.RpcOperation< + { + @body + @doc("The ungroundedness detection request.") + body: DetectUngroundednessOptions; + }, + DetectUngroundednessResult + >; +} 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 new file mode 100644 index 000000000000..f4f32e3af776 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/contentsafety.json @@ -0,0 +1,3102 @@ +{ + "swagger": "2.0", + "info": { + "title": "ContentSafety Service", + "version": "2023-10-30-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/incidents": { + "get": { + "operationId": "ImageIncidents_ListIncidents", + "summary": "Get All Image Incidents", + "description": "Get all incidents details.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "$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/PagedImageIncident" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/image/incidents/{incidentName}": { + "get": { + "operationId": "ImageIncidents_GetIncidents", + "summary": "Get Image Incident By incidentName", + "description": "Returns image incident details.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/ImageIncident" + } + }, + "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." + } + } + } + } + }, + "patch": { + "operationId": "ImageIncidents_CreateOrUpdateIncident", + "summary": "Create Or Update Image Incident", + "description": "Updates a image incident. If the image incident does not exist, a new image incident will be created.", + "consumes": [ + "application/merge-patch+json" + ], + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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/ImageIncidentCreateOrUpdate" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/ImageIncident" + } + }, + "201": { + "description": "The request has succeeded and a new resource has been created as a result.", + "schema": { + "$ref": "#/definitions/ImageIncident" + } + }, + "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." + } + } + } + } + }, + "delete": { + "operationId": "ImageIncidents_DeleteIncident", + "summary": "Delete Image Incident By incidentName", + "description": "Deletes a image incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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." + } + } + } + } + } + }, + "/image/incidents/{incidentName}:addIncidentSamples": { + "post": { + "operationId": "ImageIncidents_AddIncidentSamples", + "summary": "Add ImageIncidentSamples To Incident", + "description": "Add imageIncidentSamples to an incident. You can add at most 100 imageIncidentSamples in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddImageIncidentSamplesOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AddImageIncidentSamplesResult" + } + }, + "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." + } + } + } + } + } + }, + "/image/incidents/{incidentName}:removeIncidentSamples": { + "post": { + "operationId": "ImageIncidents_RemoveIncidentSamples", + "summary": "Remove ImageIncidentSamples From Incident", + "description": "Remove imageIncidentSamples from an incident. You can remove at most 100 Image Incident in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RemoveImageIncidentSamplesOptions" + } + } + ], + "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." + } + } + } + } + } + }, + "/image/incidents/{incidentName}/incidentSamples": { + "get": { + "operationId": "ImageIncidents_ListIncidentSamples", + "summary": "Get All ImageIncidentSamples By imageIncidentName", + "description": "Get all ImageIncidentSamples in a image incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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/PagedListImageIncidentSampleResult" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/image/incidents/{incidentName}/incidentSamples/{incidentSampleId}": { + "get": { + "operationId": "ImageIncidents_GetIncidentSample", + "summary": "Get ImageIncidentSample By imageIncidentName And imageIncidentSampleId", + "description": "Get imageIncidentSample by imageIncidentName and imageIncidentSampleId from a image incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "incidentSampleId", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64 + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/ImageIncidentSampleResult" + } + }, + "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." + } + } + } + } + } + }, + "/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" + } + } + } + }, + "/imageWithText:analyze": { + "post": { + "operationId": "ImageWithTextOperations_AnalyzeImageWithText", + "summary": "Analyze Image With Text", + "description": "A synchronous API for the analysis of potentially harmful image with 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 image with text analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/AnalyzeImageWithTextOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AnalyzeImageWithTextResult" + } + }, + "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/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", + "description": "Options for adding or updating blocklist items.", + "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", + "description": "Options for removing blocklist items.", + "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/categories": { + "get": { + "operationId": "TextCategoryCustomization_ListTextCustomizedCategory", + "description": "Resource list operation template.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "$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/PagedTextCustomizedCategory" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/text/categories/{categoryName}": { + "get": { + "operationId": "TextCategoryCustomization_GetTextCustomizedCategory", + "description": "Resource read operation template.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "categoryName", + "in": "path", + "description": "Text customizedCategories name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^Customized_[0-9A-Za-z._~-]+$" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextCustomizedCategory" + } + }, + "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." + } + } + } + } + }, + "put": { + "operationId": "TextCategoryCustomization_CreateOrReplaceTextCustomizedCategory", + "description": "Create or replace operation template.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "categoryName", + "in": "path", + "description": "Text customizedCategories name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^Customized_[0-9A-Za-z._~-]+$" + }, + { + "name": "resource", + "in": "body", + "description": "The resource instance.", + "required": true, + "schema": { + "$ref": "#/definitions/TextCustomizedCategory" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextCustomizedCategory" + } + }, + "201": { + "description": "The request has succeeded and a new resource has been created as a result.", + "schema": { + "$ref": "#/definitions/TextCustomizedCategory" + } + }, + "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." + } + } + } + } + }, + "delete": { + "operationId": "TextCategoryCustomization_DeleteTextCustomizedCategory", + "description": "Resource delete operation template.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "categoryName", + "in": "path", + "description": "Text customizedCategories name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^Customized_[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." + } + } + } + } + } + }, + "/text/incidents": { + "get": { + "operationId": "TextIncidents_ListIncidents", + "summary": "Get All Text Incidents", + "description": "Get all incidents details.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "$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/PagedTextIncident" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/text/incidents/{incidentName}": { + "get": { + "operationId": "TextIncidents_GetIncidents", + "summary": "Get Text Incident By incidentName", + "description": "Returns text incident details.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextIncident" + } + }, + "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." + } + } + } + } + }, + "patch": { + "operationId": "TextIncidents_CreateOrUpdateIncident", + "summary": "Create Or Update Text Incident", + "description": "Updates a text incident. If the text incident does not exist, a new text incident will be created.", + "consumes": [ + "application/merge-patch+json" + ], + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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/TextIncidentCreateOrUpdate" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextIncident" + } + }, + "201": { + "description": "The request has succeeded and a new resource has been created as a result.", + "schema": { + "$ref": "#/definitions/TextIncident" + } + }, + "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." + } + } + } + } + }, + "delete": { + "operationId": "TextIncidents_DeleteIncident", + "summary": "Delete Text Incident By incidentName", + "description": "Deletes a text incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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." + } + } + } + } + } + }, + "/text/incidents/{incidentName}:addIncidentSamples": { + "post": { + "operationId": "TextIncidents_AddIncidentSamples", + "summary": "Add TextIncidentSamples To Incident", + "description": "Add textIncidentSamples to an incident. You can add at most 100 textIncidentSamples in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddTextIncidentSamplesOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AddTextIncidentSamplesResult" + } + }, + "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/incidents/{incidentName}:removeIncidentSamples": { + "post": { + "operationId": "TextIncidents_RemoveIncidentSamples", + "summary": "Remove TextIncidentSamples From Incident", + "description": "Remove textIncidentSamples from an incident. You can remove at most 100 Text Incident in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RemoveTextIncidentSamplesOptions" + } + } + ], + "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." + } + } + } + } + } + }, + "/text/incidents/{incidentName}/incidentSamples": { + "get": { + "operationId": "TextIncidents_ListIncidentSamples", + "summary": "Get All TextIncidentSamples By textIncidentName", + "description": "Get all TextIncidentSamples in a text incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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/PagedTextIncidentSample" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/text/incidents/{incidentName}/incidentSamples/{incidentSampleId}": { + "get": { + "operationId": "TextIncidents_GetIncidentSample", + "summary": "Get TextIncidentSample By textIncidentName And textIncidentSampleId", + "description": "Get textIncidentSample by textIncidentName and textIncidentSampleId from a text incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "incidentSampleId", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64 + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextIncidentSample" + } + }, + "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:adaptiveAnnotate": { + "post": { + "operationId": "PromptTextOperations_AnnotateText", + "summary": "Annotate Text by Prompt", + "description": "A remote procedure call (RPC) operation.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "body", + "in": "body", + "description": "The text analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/AnnotateTextOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AnnotateTextResult" + } + }, + "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: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 protected material 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." + } + } + } + } + } + }, + "/text:detectUngroundedness": { + "post": { + "operationId": "TextUngroundednessDetectionOperations_DetectUngroundedness", + "summary": "Detect Ungrounded Information", + "description": "A synchronous API for the analysis of language model outputs to determine alignment with user-provided information or identify fictional content.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "body", + "in": "body", + "description": "The ungroundedness detection request.", + "required": true, + "schema": { + "$ref": "#/definitions/DetectUngroundednessOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/DetectUngroundednessResult" + } + }, + "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": { + "AddImageIncidentSamplesOptions": { + "type": "object", + "description": "The request to add incidentSamples to a incident.", + "properties": { + "incidentSamples": { + "type": "array", + "description": "Array of incidentSamples to add.", + "items": { + "$ref": "#/definitions/ImageIncidentSample" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "incidentSamples" + ] + }, + "AddImageIncidentSamplesResult": { + "type": "object", + "description": "The response of adding incidentSamples to the incident.", + "properties": { + "incidentSamples": { + "type": "array", + "description": "Array of incidentSamples have been added.", + "items": { + "$ref": "#/definitions/ListImageIncidentSampleResult" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "incidentSamples" + ] + }, + "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" + ] + }, + "AddTextIncidentSamplesOptions": { + "type": "object", + "description": "The request to add incidentSamples to a incident.", + "properties": { + "incidentSamples": { + "type": "array", + "description": "Array of incidentSamples to add.", + "items": { + "$ref": "#/definitions/TextIncidentSample" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "incidentSamples" + ] + }, + "AddTextIncidentSamplesResult": { + "type": "object", + "description": "The response of adding incidentSamples to the incident.", + "properties": { + "incidentSamples": { + "type": "array", + "description": "Array of incidentSamples have been added.", + "items": { + "$ref": "#/definitions/TextIncidentSample" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "incidentSamples" + ] + }, + "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" + }, + "incidents": { + "$ref": "#/definitions/IncidentOptions", + "description": "The incidents to detect." + } + }, + "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": [] + }, + "incidentMatches": { + "type": "array", + "description": "The incident match details.", + "items": { + "$ref": "#/definitions/IncidentMatch" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "categoriesAnalysis" + ] + }, + "AnalyzeImageWithTextOptions": { + "type": "object", + "description": "The analysis request of the image with text.", + "properties": { + "image": { + "$ref": "#/definitions/ImageData", + "description": "The image needs to be analyzed." + }, + "text": { + "type": "string", + "description": "The text attached to the image. We support at most 1k characters (unicode code points) in one text request.", + "maxLength": 1000 + }, + "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/ImageWithTextCategory" + } + }, + "enableOcr": { + "type": "boolean", + "description": "When set to true, our service will perform OCR and concatenate the recognized text with input text before analyzing. We will recognize at most 256 characters (unicode code points) from input image. The others will be truncated." + } + }, + "required": [ + "image", + "enableOcr" + ] + }, + "AnalyzeImageWithTextResult": { + "type": "object", + "description": "The analysis response of the image with text.", + "properties": { + "categoriesAnalysis": { + "type": "array", + "description": "Analysis result for categories.", + "items": { + "$ref": "#/definitions/ImageWithTextCategoriesAnalysis" + }, + "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" + }, + "incidents": { + "$ref": "#/definitions/IncidentOptions", + "description": "The incidents to detect." + } + }, + "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": [] + }, + "incidentMatches": { + "type": "array", + "description": "The incident match details.", + "items": { + "$ref": "#/definitions/IncidentMatch" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "categoriesAnalysis" + ] + }, + "AnnotateTextOptions": { + "type": "object", + "description": "Annotate text options", + "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 + }, + "category": { + "type": "string", + "description": "The category will be analyzed, you can set your customized category or one of built-in categories in 'Hate','Selfharm', 'Sexual' and 'Violence'." + } + }, + "required": [ + "text", + "category" + ] + }, + "AnnotateTextResult": { + "type": "object", + "description": "The text annotation response.", + "properties": { + "id": { + "type": "integer", + "format": "int32", + "description": "The id of annotated subcategory." + }, + "name": { + "type": "string", + "description": "The name of annotated subcategory." + }, + "reasoning": { + "type": "string", + "description": "The reasoning." + } + }, + "required": [ + "id", + "name" + ] + }, + "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." + } + } + }, + "DetectUngroundednessOptions": { + "type": "object", + "description": "The request of ungroundedness detection.", + "properties": { + "domain": { + "$ref": "#/definitions/Domain", + "description": "The domain of the text for analysis.\nThis field is optional, with a default value of Generic." + }, + "task": { + "$ref": "#/definitions/Task", + "description": "The task type for the text analysis.\nThis field is optional, with a default value of Summarization." + }, + "query": { + "type": "string", + "description": "The user's question input in a QnA scenario.\nThis field is optional, but if the task type is set to QnA, it becomes required." + }, + "text": { + "type": "string", + "description": "The text requiring analysis." + }, + "groundingSources": { + "type": "array", + "description": "The source information used as a grounding reference.", + "items": { + "type": "string" + } + }, + "reasoning": { + "type": "boolean", + "description": "A value indicating if the output includes an explanation for the identified ungroundedness.\nThis field is optional, with a default value of false." + }, + "gptResource": { + "$ref": "#/definitions/GptResource", + "description": "Connection details for the GPT resource. \nThis field will be used only when the 'reasoning' field is set to true; otherwise, it will be ignored." + } + }, + "required": [ + "text", + "groundingSources" + ] + }, + "DetectUngroundednessResult": { + "type": "object", + "description": "The response of ungroundedness detection.", + "properties": { + "ungrounded": { + "type": "boolean", + "description": "Detection result for ungrounded text." + }, + "confidenceScore": { + "type": "number", + "format": "float", + "description": "Confidence score of the model in the analysis results." + }, + "ungroundedPercentage": { + "type": "number", + "format": "float", + "description": "Percentage of ungrounded Text." + }, + "ungroundedDetails": { + "type": "array", + "description": "The detailed information about a text identified as ungrounded.", + "items": { + "$ref": "#/definitions/UngroundedDetails" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "ungrounded", + "confidenceScore", + "ungroundedPercentage", + "ungroundedDetails" + ] + }, + "Domain": { + "type": "string", + "description": "Domain.", + "enum": [ + "Generic", + "Medical" + ], + "x-ms-enum": { + "name": "Domain", + "modelAsString": true + } + }, + "GptResource": { + "type": "object", + "description": "Connection details for the GPT resource.", + "properties": { + "azureOpenAIEndpoint": { + "type": "string", + "description": "Endpoint for Azure OpenAI resource." + }, + "deploymentName": { + "type": "string", + "description": "Deployment model name." + } + }, + "required": [ + "azureOpenAIEndpoint", + "deploymentName" + ] + }, + "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." + } + } + }, + "ImageDataResult": { + "type": "object", + "description": "The image result is base64 encoded bytes", + "properties": { + "content": { + "type": "string", + "format": "byte", + "description": "The Base64 encoding of the image." + } + } + }, + "ImageIncident": { + "type": "object", + "description": "Image Incident.", + "properties": { + "incidentName": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "description": { + "type": "string", + "description": "Incident description.", + "maxLength": 1024 + }, + "created": { + "type": "string", + "format": "date-time", + "description": "Incident created time.", + "x-ms-mutability": [ + "read" + ] + }, + "lastUpdated": { + "type": "string", + "format": "date-time", + "description": "Incident updated time.", + "x-ms-mutability": [ + "read" + ] + } + }, + "required": [ + "incidentName", + "created", + "lastUpdated" + ] + }, + "ImageIncidentCreateOrUpdate": { + "type": "object", + "description": "Image Incident.", + "properties": { + "incidentName": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "description": { + "type": "string", + "description": "Incident description.", + "maxLength": 1024 + } + } + }, + "ImageIncidentSample": { + "type": "object", + "description": "Sample in an Image Incident.", + "properties": { + "incidentSampleId": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "readOnly": true + }, + "image": { + "$ref": "#/definitions/ImageData", + "description": "IncidentSample image content." + } + }, + "required": [ + "incidentSampleId" + ] + }, + "ImageIncidentSampleResult": { + "type": "object", + "description": "Sample Result in an Image Incident.", + "properties": { + "incidentSampleId": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "readOnly": true + }, + "image": { + "$ref": "#/definitions/ImageDataResult", + "description": "IncidentSample image content." + } + }, + "required": [ + "incidentSampleId" + ] + }, + "ImageWithTextCategoriesAnalysis": { + "type": "object", + "description": "ImageWithText analysis result.", + "properties": { + "category": { + "$ref": "#/definitions/ImageWithTextCategory", + "description": "The imageWithtext analysis category." + }, + "severity": { + "type": "integer", + "format": "int32", + "description": "The higher the severity of input content, the larger this value is. The values could be: 0,2,4,6." + } + }, + "required": [ + "category" + ] + }, + "ImageWithTextCategory": { + "type": "string", + "description": "ImageWithText analyze category.", + "enum": [ + "Hate", + "SelfHarm", + "Sexual", + "Violence" + ], + "x-ms-enum": { + "name": "ImageWithTextCategory", + "modelAsString": true + } + }, + "IncidentMatch": { + "type": "object", + "description": "The result of text incident match.", + "properties": { + "incidentName": { + "type": "string", + "description": "The name of the matched incident.", + "maxLength": 64 + } + }, + "required": [ + "incidentName" + ] + }, + "IncidentOptions": { + "type": "object", + "description": "The text analysis request.", + "properties": { + "incidentNames": { + "type": "array", + "description": "The accept decision made by service.", + "items": { + "type": "string" + } + }, + "haltOnIncidentHit": { + "type": "boolean", + "description": "When set to true, further analyses of harmful content will not be performed in cases where incidents are hit. When set to false, all analyses of harmful content will be performed, whether or not incidents are hit." + } + } + }, + "JailbreakAnalysisResult": { + "type": "object", + "description": "The text jailbreak analysis response.", + "properties": { + "detected": { + "type": "boolean", + "description": "Analysis result for jailbreak." + } + }, + "required": [ + "detected" + ] + }, + "ListImageIncidentSampleResult": { + "type": "object", + "description": "Sample in a Image Incident.", + "properties": { + "incidentSampleId": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "readOnly": true + } + }, + "required": [ + "incidentSampleId" + ] + }, + "PagedImageIncident": { + "type": "object", + "description": "Paged collection of ImageIncident items", + "properties": { + "value": { + "type": "array", + "description": "The ImageIncident items on this page", + "items": { + "$ref": "#/definitions/ImageIncident" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "PagedListImageIncidentSampleResult": { + "type": "object", + "description": "Paged collection of ListImageIncidentSampleResult items", + "properties": { + "value": { + "type": "array", + "description": "The ListImageIncidentSampleResult items on this page", + "items": { + "$ref": "#/definitions/ListImageIncidentSampleResult" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "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" + ] + }, + "PagedTextCustomizedCategory": { + "type": "object", + "description": "Paged collection of TextCustomizedCategory items", + "properties": { + "value": { + "type": "array", + "description": "The TextCustomizedCategory items on this page", + "items": { + "$ref": "#/definitions/TextCustomizedCategory" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "PagedTextIncident": { + "type": "object", + "description": "Paged collection of TextIncident items", + "properties": { + "value": { + "type": "array", + "description": "The TextIncident items on this page", + "items": { + "$ref": "#/definitions/TextIncident" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "PagedTextIncidentSample": { + "type": "object", + "description": "Paged collection of TextIncidentSample items", + "properties": { + "value": { + "type": "array", + "description": "The TextIncidentSample items on this page", + "items": { + "$ref": "#/definitions/TextIncidentSample" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "PreDefinedConcept": { + "type": "object", + "description": "Pre-defined concept.", + "properties": { + "concept": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "concept", + "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.", + "properties": { + "incidentSampleIds": { + "type": "array", + "description": "Array of incidentSamples to remove.", + "items": { + "type": "string" + } + } + }, + "required": [ + "incidentSampleIds" + ] + }, + "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" + ] + }, + "RemoveTextIncidentSamplesOptions": { + "type": "object", + "description": "The request to remove incidentSamples from a incident.", + "properties": { + "incidentSampleIds": { + "type": "array", + "description": "Array of incidentSamples to remove.", + "items": { + "type": "string" + } + } + }, + "required": [ + "incidentSampleIds" + ] + }, + "SubCategory": { + "type": "object", + "description": "Label definition.", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "statements": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "id", + "name", + "statements" + ] + }, + "Task": { + "type": "string", + "description": "Task type.", + "enum": [ + "Summarization", + "QnA" + ], + "x-ms-enum": { + "name": "Task", + "modelAsString": true + } + }, + "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 + } + }, + "TextCustomizedCategory": { + "type": "object", + "description": "Text Customized categories.", + "properties": { + "categoryName": { + "type": "string", + "description": "Text customizedCategories name.", + "maxLength": 64, + "pattern": "^Customized_[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "preDefinedConcepts": { + "type": "array", + "items": { + "$ref": "#/definitions/PreDefinedConcept" + }, + "x-ms-identifiers": [] + }, + "subCategories": { + "type": "array", + "items": { + "$ref": "#/definitions/SubCategory" + } + }, + "emphases": { + "type": "array", + "items": { + "type": "string" + } + }, + "exampleBlobUrl": { + "type": "string", + "format": "uri" + } + }, + "required": [ + "categoryName", + "subCategories" + ] + }, + "TextIncident": { + "type": "object", + "description": "Text Incident.", + "properties": { + "incidentName": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "description": { + "type": "string", + "description": "Incident description.", + "maxLength": 1024 + }, + "created": { + "type": "string", + "format": "date-time", + "description": "Incident created time.", + "x-ms-mutability": [ + "read" + ] + }, + "lastUpdated": { + "type": "string", + "format": "date-time", + "description": "Incident updated time.", + "x-ms-mutability": [ + "read" + ] + } + }, + "required": [ + "incidentName", + "created", + "lastUpdated" + ] + }, + "TextIncidentCreateOrUpdate": { + "type": "object", + "description": "Text Incident.", + "properties": { + "incidentName": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "description": { + "type": "string", + "description": "Incident description.", + "maxLength": 1024 + } + } + }, + "TextIncidentSample": { + "type": "object", + "description": "Sample in a Text Incident.", + "properties": { + "incidentSampleId": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "readOnly": true + }, + "text": { + "type": "string", + "description": "IncidentSample text content.", + "maxLength": 1024 + } + }, + "required": [ + "incidentSampleId" + ] + }, + "UngroundedDetails": { + "type": "object", + "description": "The detailed information about a text identified as ungrounded.", + "properties": { + "text": { + "type": "string", + "description": "The ungrounded text." + }, + "reason": { + "type": "string", + "description": "The explanation for identifying the text as ungrounded. \nOnly when the 'reasoning' field in the input is set to true 'reason' field will be returned." + } + }, + "required": [ + "text" + ] + } + }, + "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-30-preview/examples/AddOrUpdateBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/AddOrUpdateBlocklistItems.json new file mode 100644 index 000000000000..c7353595d2ef --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/AddOrUpdateBlocklistItems.json @@ -0,0 +1,30 @@ +{ + "title": "Add or Update BlocklistItems To Text Blocklist", + "operationId": "TextBlocklists_AddOrUpdateBlocklistItems", + "parameters": { + "api-version": "2023-12-30-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-30-preview/examples/AnalyzeImage.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/AnalyzeImage.json new file mode 100644 index 000000000000..0d447cf2bab2 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/AnalyzeImage.json @@ -0,0 +1,36 @@ +{ + "title": "Analyze Image", + "operationId": "ImageOperations_AnalyzeImage", + "parameters": { + "api-version": "2023-12-30-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-30-preview/examples/AnalyzeText.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/AnalyzeText.json new file mode 100644 index 000000000000..c15ad6ccad29 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/AnalyzeText.json @@ -0,0 +1,38 @@ +{ + "title": "Analyze Text", + "operationId": "TextOperations_AnalyzeText", + "parameters": { + "api-version": "2023-12-30-preview", + "body": { + "text": "This is text example. A hate speech sentence. A sentence with a violent description." + } + }, + "responses": { + "200": { + "body": { + "blocklistsMatch": [], + "categoriesAnalysis": [{ + "category": "Hate", + "severity": 0 + }, + { + "category": "SelfHarm", + "severity": 0 + }, + { + "category": "Sexual", + "severity": 0 + }, + { + "category": "Violence", + "severity": 0 + } + ], + "citation": [ + "A hate speech sentence", + "A sentence with a violent description" + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/CreateOrUpdateTextBlocklist.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/CreateOrUpdateTextBlocklist.json new file mode 100644 index 000000000000..c8950fe923b6 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/CreateOrUpdateTextBlocklist.json @@ -0,0 +1,25 @@ +{ + "title": "Create Or Update Text Blocklist", + "operationId": "TextBlocklists_CreateOrUpdateTextBlocklist", + "parameters": { + "api-version": "2023-12-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/data-plane/ContentSafety/preview/2023-10-30-preview/examples/DeleteTextBlocklist.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/DeleteTextBlocklist.json new file mode 100644 index 000000000000..30af65c0662d --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/DeleteTextBlocklist.json @@ -0,0 +1,11 @@ +{ + "title": "Delete Text Blocklist By blocklistName", + "operationId": "TextBlocklists_DeleteTextBlocklist", + "parameters": { + "api-version": "2023-12-30-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/GetTextBlocklist.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/GetTextBlocklist.json new file mode 100644 index 000000000000..73786c7a4c36 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/GetTextBlocklist.json @@ -0,0 +1,16 @@ +{ + "title": "Get Text Blocklist By blocklistName", + "operationId": "TextBlocklists_GetTextBlocklist", + "parameters": { + "api-version": "2023-12-30-preview", + "blocklistName": "TestBlocklist" + }, + "responses": { + "200": { + "body": { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/GetTextBlocklistItem.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/GetTextBlocklistItem.json new file mode 100644 index 000000000000..c5e7eaf86b46 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/GetTextBlocklistItem.json @@ -0,0 +1,18 @@ +{ + "title": "Get BlockItem By blocklistName And blocklistItemId", + "operationId": "TextBlocklists_GetTextBlocklistItem", + "parameters": { + "api-version": "2023-12-30-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-30-preview/examples/ListTextBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/ListTextBlocklistItems.json new file mode 100644 index 000000000000..13352ef1692c --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/ListTextBlocklistItems.json @@ -0,0 +1,21 @@ +{ + "title": "Get All BlockItems By blocklistName", + "operationId": "TextBlocklists_ListTextBlocklistItems", + "parameters": { + "api-version": "2023-12-30-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-30-preview/examples/ListTextBlocklists.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/ListTextBlocklists.json new file mode 100644 index 000000000000..65dc19eec7b3 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/ListTextBlocklists.json @@ -0,0 +1,19 @@ +{ + "title": "Get All Text Blocklists", + "operationId": "TextBlocklists_ListTextBlocklists", + "parameters": { + "api-version": "2023-12-30-preview" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "blocklistName": "TestBlocklist", + "description": "Test Blocklist" + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/RemoveBlocklistItems.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/RemoveBlocklistItems.json new file mode 100644 index 000000000000..a9a603bc3d80 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-10-30-preview/examples/RemoveBlocklistItems.json @@ -0,0 +1,16 @@ +{ + "title": "Remove BlockItems From Text Blocklist", + "operationId": "TextBlocklists_RemoveBlocklistItems", + "parameters": { + "api-version": "2023-12-30-preview", + "blocklistName": "TestBlocklist", + "body": { + "blocklistItemIds": [ + "9511969e-f1e3-4604-9127-05ee16c509ec" + ] + } + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json new file mode 100644 index 000000000000..208f36065325 --- /dev/null +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json @@ -0,0 +1,3059 @@ +{ + "swagger": "2.0", + "info": { + "title": "ContentSafety Service", + "version": "2024-01-30-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/incidents": { + "get": { + "operationId": "ImageIncidents_ListIncidents", + "summary": "Get All Image Incidents", + "description": "Get all incidents details.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "$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/PagedImageIncident" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/image/incidents/{incidentName}": { + "get": { + "operationId": "ImageIncidents_GetIncidents", + "summary": "Get Image Incident By incidentName", + "description": "Returns image incident details.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/ImageIncident" + } + }, + "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." + } + } + } + } + }, + "patch": { + "operationId": "ImageIncidents_CreateOrUpdateIncident", + "summary": "Create Or Update Image Incident", + "description": "Updates a image incident. If the image incident does not exist, a new image incident will be created.", + "consumes": [ + "application/merge-patch+json" + ], + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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/ImageIncidentCreateOrUpdate" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/ImageIncident" + } + }, + "201": { + "description": "The request has succeeded and a new resource has been created as a result.", + "schema": { + "$ref": "#/definitions/ImageIncident" + } + }, + "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." + } + } + } + } + }, + "delete": { + "operationId": "ImageIncidents_DeleteIncident", + "summary": "Delete Image Incident By incidentName", + "description": "Deletes a image incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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." + } + } + } + } + } + }, + "/image/incidents/{incidentName}:addIncidentSamples": { + "post": { + "operationId": "ImageIncidents_AddIncidentSamples", + "summary": "Add ImageIncidentSamples To Incident", + "description": "Add imageIncidentSamples to an incident. You can add at most 100 imageIncidentSamples in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddImageIncidentSamplesOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AddImageIncidentSamplesResult" + } + }, + "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." + } + } + } + } + } + }, + "/image/incidents/{incidentName}:removeIncidentSamples": { + "post": { + "operationId": "ImageIncidents_RemoveIncidentSamples", + "summary": "Remove ImageIncidentSamples From Incident", + "description": "Remove imageIncidentSamples from an incident. You can remove at most 100 Image Incident in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RemoveImageIncidentSamplesOptions" + } + } + ], + "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." + } + } + } + } + } + }, + "/image/incidents/{incidentName}/incidentSamples": { + "get": { + "operationId": "ImageIncidents_ListIncidentSamples", + "summary": "Get All ImageIncidentSamples By imageIncidentName", + "description": "Get all ImageIncidentSamples in a image incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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/PagedListImageIncidentSampleResult" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/image/incidents/{incidentName}/incidentSamples/{incidentSampleId}": { + "get": { + "operationId": "ImageIncidents_GetIncidentSample", + "summary": "Get ImageIncidentSample By imageIncidentName And imageIncidentSampleId", + "description": "Get imageIncidentSample by imageIncidentName and imageIncidentSampleId from a image incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "incidentSampleId", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64 + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/ImageIncidentSampleResult" + } + }, + "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." + } + } + } + } + } + }, + "/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." + } + } + } + } + } + }, + "/imageWithText:analyze": { + "post": { + "operationId": "ImageWithTextOperations_AnalyzeImageWithText", + "summary": "Analyze Image With Text", + "description": "A synchronous API for the analysis of potentially harmful image with 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 image with text analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/AnalyzeImageWithTextOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AnalyzeImageWithTextResult" + } + }, + "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/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-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." + } + } + } + } + }, + "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." + } + } + } + } + }, + "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." + } + } + } + } + } + }, + "/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", + "description": "Options for adding or updating blocklist items.", + "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." + } + } + } + } + } + }, + "/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", + "description": "Options for removing blocklist items.", + "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." + } + } + } + } + } + }, + "/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-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." + } + } + } + } + } + }, + "/text/categories": { + "get": { + "operationId": "TextCategoryCustomization_ListTextCustomizedCategory", + "description": "Resource list operation template.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "$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/PagedTextCustomizedCategory" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/text/categories/{categoryName}": { + "get": { + "operationId": "TextCategoryCustomization_GetTextCustomizedCategory", + "description": "Resource read operation template.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "categoryName", + "in": "path", + "description": "Text customizedCategories name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^Customized_[0-9A-Za-z._~-]+$" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextCustomizedCategory" + } + }, + "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." + } + } + } + } + }, + "put": { + "operationId": "TextCategoryCustomization_CreateOrReplaceTextCustomizedCategory", + "description": "Create or replace operation template.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "categoryName", + "in": "path", + "description": "Text customizedCategories name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^Customized_[0-9A-Za-z._~-]+$" + }, + { + "name": "resource", + "in": "body", + "description": "The resource instance.", + "required": true, + "schema": { + "$ref": "#/definitions/TextCustomizedCategory" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextCustomizedCategory" + } + }, + "201": { + "description": "The request has succeeded and a new resource has been created as a result.", + "schema": { + "$ref": "#/definitions/TextCustomizedCategory" + } + }, + "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." + } + } + } + } + }, + "delete": { + "operationId": "TextCategoryCustomization_DeleteTextCustomizedCategory", + "description": "Resource delete operation template.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "categoryName", + "in": "path", + "description": "Text customizedCategories name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^Customized_[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." + } + } + } + } + } + }, + "/text/incidents": { + "get": { + "operationId": "TextIncidents_ListIncidents", + "summary": "Get All Text Incidents", + "description": "Get all incidents details.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "$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/PagedTextIncident" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/text/incidents/{incidentName}": { + "get": { + "operationId": "TextIncidents_GetIncidents", + "summary": "Get Text Incident By incidentName", + "description": "Returns text incident details.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextIncident" + } + }, + "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." + } + } + } + } + }, + "patch": { + "operationId": "TextIncidents_CreateOrUpdateIncident", + "summary": "Create Or Update Text Incident", + "description": "Updates a text incident. If the text incident does not exist, a new text incident will be created.", + "consumes": [ + "application/merge-patch+json" + ], + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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/TextIncidentCreateOrUpdate" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextIncident" + } + }, + "201": { + "description": "The request has succeeded and a new resource has been created as a result.", + "schema": { + "$ref": "#/definitions/TextIncident" + } + }, + "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." + } + } + } + } + }, + "delete": { + "operationId": "TextIncidents_DeleteIncident", + "summary": "Delete Text Incident By incidentName", + "description": "Deletes a text incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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." + } + } + } + } + } + }, + "/text/incidents/{incidentName}:addIncidentSamples": { + "post": { + "operationId": "TextIncidents_AddIncidentSamples", + "summary": "Add TextIncidentSamples To Incident", + "description": "Add textIncidentSamples to an incident. You can add at most 100 textIncidentSamples in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddTextIncidentSamplesOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AddTextIncidentSamplesResult" + } + }, + "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/incidents/{incidentName}:removeIncidentSamples": { + "post": { + "operationId": "TextIncidents_RemoveIncidentSamples", + "summary": "Remove TextIncidentSamples From Incident", + "description": "Remove textIncidentSamples from an incident. You can remove at most 100 Text Incident in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RemoveTextIncidentSamplesOptions" + } + } + ], + "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." + } + } + } + } + } + }, + "/text/incidents/{incidentName}/incidentSamples": { + "get": { + "operationId": "TextIncidents_ListIncidentSamples", + "summary": "Get All TextIncidentSamples By textIncidentName", + "description": "Get all TextIncidentSamples in a text incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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/PagedTextIncidentSample" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/text/incidents/{incidentName}/incidentSamples/{incidentSampleId}": { + "get": { + "operationId": "TextIncidents_GetIncidentSample", + "summary": "Get TextIncidentSample By textIncidentName And textIncidentSampleId", + "description": "Get textIncidentSample by textIncidentName and textIncidentSampleId from a text incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "incidentSampleId", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64 + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextIncidentSample" + } + }, + "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:adaptiveAnnotate": { + "post": { + "operationId": "PromptTextOperations_AnnotateText", + "summary": "Annotate Text by Prompt", + "description": "A remote procedure call (RPC) operation.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "body", + "in": "body", + "description": "The text analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/AnnotateTextOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AnnotateTextResult" + } + }, + "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: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." + } + } + } + } + } + }, + "/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 protected material 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." + } + } + } + } + } + }, + "/text:detectUngroundedness": { + "post": { + "operationId": "TextUngroundednessDetectionOperations_DetectUngroundedness", + "summary": "Detect Ungrounded Information", + "description": "A synchronous API for the analysis of language model outputs to determine alignment with user-provided information or identify fictional content.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "body", + "in": "body", + "description": "The ungroundedness detection request.", + "required": true, + "schema": { + "$ref": "#/definitions/DetectUngroundednessOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/DetectUngroundednessResult" + } + }, + "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": { + "AddImageIncidentSamplesOptions": { + "type": "object", + "description": "The request to add incidentSamples to a incident.", + "properties": { + "incidentSamples": { + "type": "array", + "description": "Array of incidentSamples to add.", + "items": { + "$ref": "#/definitions/ImageIncidentSample" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "incidentSamples" + ] + }, + "AddImageIncidentSamplesResult": { + "type": "object", + "description": "The response of adding incidentSamples to the incident.", + "properties": { + "incidentSamples": { + "type": "array", + "description": "Array of incidentSamples have been added.", + "items": { + "$ref": "#/definitions/ListImageIncidentSampleResult" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "incidentSamples" + ] + }, + "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" + ] + }, + "AddTextIncidentSamplesOptions": { + "type": "object", + "description": "The request to add incidentSamples to a incident.", + "properties": { + "incidentSamples": { + "type": "array", + "description": "Array of incidentSamples to add.", + "items": { + "$ref": "#/definitions/TextIncidentSample" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "incidentSamples" + ] + }, + "AddTextIncidentSamplesResult": { + "type": "object", + "description": "The response of adding incidentSamples to the incident.", + "properties": { + "incidentSamples": { + "type": "array", + "description": "Array of incidentSamples have been added.", + "items": { + "$ref": "#/definitions/TextIncidentSample" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "incidentSamples" + ] + }, + "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" + }, + "incidents": { + "$ref": "#/definitions/IncidentOptions", + "description": "The incidents to detect." + } + }, + "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": [] + }, + "incidentMatches": { + "type": "array", + "description": "The incident match details.", + "items": { + "$ref": "#/definitions/IncidentMatch" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "categoriesAnalysis" + ] + }, + "AnalyzeImageWithTextOptions": { + "type": "object", + "description": "The analysis request of the image with text.", + "properties": { + "image": { + "$ref": "#/definitions/ImageData", + "description": "The image needs to be analyzed." + }, + "text": { + "type": "string", + "description": "The text attached to the image. We support at most 1k characters (unicode code points) in one text request.", + "maxLength": 1000 + }, + "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/ImageWithTextCategory" + } + }, + "enableOcr": { + "type": "boolean", + "description": "When set to true, our service will perform OCR and concatenate the recognized text with input text before analyzing. We will recognize at most 256 characters (unicode code points) from input image. The others will be truncated." + } + }, + "required": [ + "image", + "enableOcr" + ] + }, + "AnalyzeImageWithTextResult": { + "type": "object", + "description": "The analysis response of the image with text.", + "properties": { + "categoriesAnalysis": { + "type": "array", + "description": "Analysis result for categories.", + "items": { + "$ref": "#/definitions/ImageWithTextCategoriesAnalysis" + }, + "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" + }, + "incidents": { + "$ref": "#/definitions/IncidentOptions", + "description": "The incidents to detect." + } + }, + "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": [] + }, + "incidentMatches": { + "type": "array", + "description": "The incident match details.", + "items": { + "$ref": "#/definitions/IncidentMatch" + }, + "x-ms-identifiers": [] + }, + "citation": { + "type": "array", + "description": "Chunks in the original text detected as harmful content. Analysis result and scores are caused by these.", + "items": { + "type": "string" + } + } + }, + "required": [ + "categoriesAnalysis" + ] + }, + "AnnotateTextOptions": { + "type": "object", + "description": "Annotate text options", + "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 + }, + "category": { + "type": "string", + "description": "The category will be analyzed, you can set your customized category or one of built-in categories in 'Hate','Selfharm', 'Sexual' and 'Violence'." + } + }, + "required": [ + "text", + "category" + ] + }, + "AnnotateTextResult": { + "type": "object", + "description": "The text annotation response.", + "properties": { + "id": { + "type": "integer", + "format": "int32", + "description": "The id of annotated subcategory." + }, + "name": { + "type": "string", + "description": "The name of annotated subcategory." + }, + "reasoning": { + "type": "string", + "description": "The reasoning." + } + }, + "required": [ + "id", + "name" + ] + }, + "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." + } + } + }, + "DetectUngroundednessOptions": { + "type": "object", + "description": "The request of ungroundedness detection.", + "properties": { + "domain": { + "$ref": "#/definitions/Domain", + "description": "The domain of the text for analysis.\nThis field is optional, with a default value of Generic." + }, + "task": { + "$ref": "#/definitions/Task", + "description": "The task type for the text analysis.\nThis field is optional, with a default value of Summarization." + }, + "query": { + "type": "string", + "description": "The user's question input in a QnA scenario.\nThis field is optional, but if the task type is set to QnA, it becomes required." + }, + "text": { + "type": "string", + "description": "The text requiring analysis." + }, + "groundingSources": { + "type": "array", + "description": "The source information used as a grounding reference.", + "items": { + "type": "string" + } + }, + "reasoning": { + "type": "boolean", + "description": "A value indicating if the output includes an explanation for the identified ungroundedness.\nThis field is optional, with a default value of false." + }, + "gptResource": { + "$ref": "#/definitions/GptResource", + "description": "Connection details for the GPT resource. \nThis field will be used only when the 'reasoning' field is set to true; otherwise, it will be ignored." + } + }, + "required": [ + "text", + "groundingSources" + ] + }, + "DetectUngroundednessResult": { + "type": "object", + "description": "The response of ungroundedness detection.", + "properties": { + "ungrounded": { + "type": "boolean", + "description": "Detection result for ungrounded text." + }, + "confidenceScore": { + "type": "number", + "format": "float", + "description": "Confidence score of the model in the analysis results." + }, + "ungroundedPercentage": { + "type": "number", + "format": "float", + "description": "Percentage of ungrounded Text." + }, + "ungroundedDetails": { + "type": "array", + "description": "The detailed information about a text identified as ungrounded.", + "items": { + "$ref": "#/definitions/UngroundedDetails" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "ungrounded", + "confidenceScore", + "ungroundedPercentage", + "ungroundedDetails" + ] + }, + "Domain": { + "type": "string", + "description": "Domain.", + "enum": [ + "Generic", + "Medical" + ], + "x-ms-enum": { + "name": "Domain", + "modelAsString": true + } + }, + "GptResource": { + "type": "object", + "description": "Connection details for the GPT resource.", + "properties": { + "azureOpenAIEndpoint": { + "type": "string", + "description": "Endpoint for Azure OpenAI resource." + }, + "deploymentName": { + "type": "string", + "description": "Deployment model name." + } + }, + "required": [ + "azureOpenAIEndpoint", + "deploymentName" + ] + }, + "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." + } + } + }, + "ImageDataResult": { + "type": "object", + "description": "The image result is base64 encoded bytes", + "properties": { + "content": { + "type": "string", + "format": "byte", + "description": "The Base64 encoding of the image." + } + } + }, + "ImageIncident": { + "type": "object", + "description": "Image Incident.", + "properties": { + "incidentName": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "description": { + "type": "string", + "description": "Incident description.", + "maxLength": 1024 + }, + "created": { + "type": "string", + "format": "date-time", + "description": "Incident created time.", + "x-ms-mutability": [ + "read" + ] + }, + "lastUpdated": { + "type": "string", + "format": "date-time", + "description": "Incident updated time.", + "x-ms-mutability": [ + "read" + ] + } + }, + "required": [ + "incidentName", + "created", + "lastUpdated" + ] + }, + "ImageIncidentCreateOrUpdate": { + "type": "object", + "description": "Image Incident.", + "properties": { + "incidentName": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "description": { + "type": "string", + "description": "Incident description.", + "maxLength": 1024 + } + } + }, + "ImageIncidentSample": { + "type": "object", + "description": "Sample in an Image Incident.", + "properties": { + "incidentSampleId": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "readOnly": true + }, + "image": { + "$ref": "#/definitions/ImageData", + "description": "IncidentSample image content." + } + }, + "required": [ + "incidentSampleId" + ] + }, + "ImageIncidentSampleResult": { + "type": "object", + "description": "Sample Result in an Image Incident.", + "properties": { + "incidentSampleId": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "readOnly": true + }, + "image": { + "$ref": "#/definitions/ImageDataResult", + "description": "IncidentSample image content." + } + }, + "required": [ + "incidentSampleId" + ] + }, + "ImageWithTextCategoriesAnalysis": { + "type": "object", + "description": "ImageWithText analysis result.", + "properties": { + "category": { + "$ref": "#/definitions/ImageWithTextCategory", + "description": "The imageWithtext analysis category." + }, + "severity": { + "type": "integer", + "format": "int32", + "description": "The higher the severity of input content, the larger this value is. The values could be: 0,2,4,6." + } + }, + "required": [ + "category" + ] + }, + "ImageWithTextCategory": { + "type": "string", + "description": "ImageWithText analyze category.", + "enum": [ + "Hate", + "SelfHarm", + "Sexual", + "Violence" + ], + "x-ms-enum": { + "name": "ImageWithTextCategory", + "modelAsString": true + } + }, + "IncidentMatch": { + "type": "object", + "description": "The result of text incident match.", + "properties": { + "incidentName": { + "type": "string", + "description": "The name of the matched incident.", + "maxLength": 64 + } + }, + "required": [ + "incidentName" + ] + }, + "IncidentOptions": { + "type": "object", + "description": "The text analysis request.", + "properties": { + "incidentNames": { + "type": "array", + "description": "The accept decision made by service.", + "items": { + "type": "string" + } + }, + "haltOnIncidentHit": { + "type": "boolean", + "description": "When set to true, further analyses of harmful content will not be performed in cases where incidents are hit. When set to false, all analyses of harmful content will be performed, whether or not incidents are hit." + } + } + }, + "JailbreakAnalysisResult": { + "type": "object", + "description": "The text jailbreak analysis response.", + "properties": { + "detected": { + "type": "boolean", + "description": "Analysis result for jailbreak." + } + }, + "required": [ + "detected" + ] + }, + "ListImageIncidentSampleResult": { + "type": "object", + "description": "Sample in a Image Incident.", + "properties": { + "incidentSampleId": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "readOnly": true + } + }, + "required": [ + "incidentSampleId" + ] + }, + "PagedImageIncident": { + "type": "object", + "description": "Paged collection of ImageIncident items", + "properties": { + "value": { + "type": "array", + "description": "The ImageIncident items on this page", + "items": { + "$ref": "#/definitions/ImageIncident" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "PagedListImageIncidentSampleResult": { + "type": "object", + "description": "Paged collection of ListImageIncidentSampleResult items", + "properties": { + "value": { + "type": "array", + "description": "The ListImageIncidentSampleResult items on this page", + "items": { + "$ref": "#/definitions/ListImageIncidentSampleResult" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "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" + ] + }, + "PagedTextCustomizedCategory": { + "type": "object", + "description": "Paged collection of TextCustomizedCategory items", + "properties": { + "value": { + "type": "array", + "description": "The TextCustomizedCategory items on this page", + "items": { + "$ref": "#/definitions/TextCustomizedCategory" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "PagedTextIncident": { + "type": "object", + "description": "Paged collection of TextIncident items", + "properties": { + "value": { + "type": "array", + "description": "The TextIncident items on this page", + "items": { + "$ref": "#/definitions/TextIncident" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "PagedTextIncidentSample": { + "type": "object", + "description": "Paged collection of TextIncidentSample items", + "properties": { + "value": { + "type": "array", + "description": "The TextIncidentSample items on this page", + "items": { + "$ref": "#/definitions/TextIncidentSample" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "PreDefinedConcept": { + "type": "object", + "description": "Pre-defined concept.", + "properties": { + "concept": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "concept", + "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.", + "properties": { + "incidentSampleIds": { + "type": "array", + "description": "Array of incidentSamples to remove.", + "items": { + "type": "string" + } + } + }, + "required": [ + "incidentSampleIds" + ] + }, + "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" + ] + }, + "RemoveTextIncidentSamplesOptions": { + "type": "object", + "description": "The request to remove incidentSamples from a incident.", + "properties": { + "incidentSampleIds": { + "type": "array", + "description": "Array of incidentSamples to remove.", + "items": { + "type": "string" + } + } + }, + "required": [ + "incidentSampleIds" + ] + }, + "SubCategory": { + "type": "object", + "description": "Label definition.", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "statements": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "id", + "name", + "statements" + ] + }, + "Task": { + "type": "string", + "description": "Task type.", + "enum": [ + "Summarization", + "QnA" + ], + "x-ms-enum": { + "name": "Task", + "modelAsString": true + } + }, + "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 + } + }, + "TextCustomizedCategory": { + "type": "object", + "description": "Text Customized categories.", + "properties": { + "categoryName": { + "type": "string", + "description": "Text customizedCategories name.", + "maxLength": 64, + "pattern": "^Customized_[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "preDefinedConcepts": { + "type": "array", + "items": { + "$ref": "#/definitions/PreDefinedConcept" + }, + "x-ms-identifiers": [] + }, + "subCategories": { + "type": "array", + "items": { + "$ref": "#/definitions/SubCategory" + } + }, + "emphases": { + "type": "array", + "items": { + "type": "string" + } + }, + "exampleBlobUrl": { + "type": "string", + "format": "uri" + } + }, + "required": [ + "categoryName", + "subCategories" + ] + }, + "TextIncident": { + "type": "object", + "description": "Text Incident.", + "properties": { + "incidentName": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "description": { + "type": "string", + "description": "Incident description.", + "maxLength": 1024 + }, + "created": { + "type": "string", + "format": "date-time", + "description": "Incident created time.", + "x-ms-mutability": [ + "read" + ] + }, + "lastUpdated": { + "type": "string", + "format": "date-time", + "description": "Incident updated time.", + "x-ms-mutability": [ + "read" + ] + } + }, + "required": [ + "incidentName", + "created", + "lastUpdated" + ] + }, + "TextIncidentCreateOrUpdate": { + "type": "object", + "description": "Text Incident.", + "properties": { + "incidentName": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "description": { + "type": "string", + "description": "Incident description.", + "maxLength": 1024 + } + } + }, + "TextIncidentSample": { + "type": "object", + "description": "Sample in a Text Incident.", + "properties": { + "incidentSampleId": { + "type": "string", + "description": "incident name.", + "maxLength": 64, + "readOnly": true + }, + "text": { + "type": "string", + "description": "IncidentSample text content.", + "maxLength": 1024 + } + }, + "required": [ + "incidentSampleId" + ] + }, + "UngroundedDetails": { + "type": "object", + "description": "The detailed information about a text identified as ungrounded.", + "properties": { + "text": { + "type": "string", + "description": "The ungrounded text." + }, + "reason": { + "type": "string", + "description": "The explanation for identifying the text as ungrounded. \nOnly when the 'reasoning' field in the input is set to true 'reason' field will be returned." + } + }, + "required": [ + "text" + ] + } + }, + "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/readme.md b/specification/cognitiveservices/data-plane/ContentSafety/readme.md index 2635c4c7cf2d..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. From f76e444f586b0056a4366c0a4528e5a78e0f554f Mon Sep 17 00:00:00 2001 From: David Liang Date: Thu, 11 Jan 2024 18:56:17 +0800 Subject: [PATCH 02/13] Customized category / customized model related spec changes (#45) * Add ga contract for Content Safety * Update examples for 2023-10-01 * Resolve ModelValidation SpellCheck and Avocado * Fix typo * Fix minor errors in example and readme * Fix example * remove the 0430 content * update readme * re-format markdowm * Fix example * init content safety 2023-10-15-preview * init content safety 2023-10-15-previwe * update * format example * update read me file * update * update * update contract * update * update * update threshold * update new contract by add judgement kind enum * update description * u * update * updat length * update * update * update description for accept severity threshodl * update * merge with acs-ga * Add snippy contract * remove 8 sev levels for image * update contentsafety.json * Update snippy path * add type spec for jailbreak * Add incident response API in 2023-10-30-preview * compiled * Adaptive annotation service contract * Remove operations * update * update * refine * update * make 0,1,2,3,4,5,6,7 to 0, 1, 2, 3, ... and add comman in last enum value * update path * Update NL Snippy path * Resolve conflict * add * add * remove labelName * Fix route and minor errors * Change typo * update * Update protected material API * update project sample * Change path name * Update protect material contract * update jailbreak * Update incident contract * Update contract * Update * scenarios to enumerations (#19) * Remove project related contract (#20) * Remove project related things * Remove accepted * Remove examples * Merge 1015 (#22) * Add ga contract for Content Safety * Update examples for 2023-10-01 * Resolve ModelValidation SpellCheck and Avocado * Fix typo * Fix minor errors in example and readme * Fix example * remove the 0430 content * update readme * re-format markdowm * Fix example * init content safety 2023-10-15-preview * init content safety 2023-10-15-previwe * update * format example * update read me file * update * update * update contract * update * update * update threshold * update new contract by add judgement kind enum * update description * u * update * updat length * update * update * update description for accept severity threshodl * update * merge with acs-ga * Add snippy contract * remove 8 sev levels for image * update contentsafety.json * Update snippy path * add type spec for jailbreak * compiled * update * update * refine * update * make 0,1,2,3,4,5,6,7 to 0, 1, 2, 3, ... and add comman in last enum value * update path * Update NL Snippy path * Resolve conflict * Update protected material API * update project sample * Change path name * Update protect material contract * update jailbreak * Remove project related contract (#20) * Remove project related things * Remove accepted * Remove examples --------- Co-authored-by: FAREAST\suxi Co-authored-by: Lixiang Liu Co-authored-by: Lixiang Liu Co-authored-by: zhaiyutong * Add list API for Annotation Service (#23) * Add ga contract for Content Safety * Update examples for 2023-10-01 * Resolve ModelValidation SpellCheck and Avocado * Fix typo * Fix minor errors in example and readme * Fix example * remove the 0430 content * update readme * re-format markdowm * Fix example * init content safety 2023-10-15-preview * init content safety 2023-10-15-previwe * update * format example * update read me file * update * update * update contract * update * update * update threshold * update new contract by add judgement kind enum * update description * u * update * updat length * update * update * update description for accept severity threshodl * update * merge with acs-ga * Add snippy contract * remove 8 sev levels for image * update contentsafety.json * Update snippy path * add type spec for jailbreak * compiled * update * update * refine * update * make 0,1,2,3,4,5,6,7 to 0, 1, 2, 3, ... and add comman in last enum value * update path * Update NL Snippy path * Resolve conflict * Update protected material API * update project sample * Change path name * Update protect material contract * update jailbreak * Remove project related contract (#20) * Remove project related things * Remove accepted * Remove examples * Add list category APIs --------- Co-authored-by: FAREAST\suxi Co-authored-by: Lixiang Liu Co-authored-by: Lixiang Liu Co-authored-by: zhaiyutong * Update contract for incident response (#24) Co-authored-by: Lixiang Liu * scenarios to enumerations (#25) * [Cognitive Services - Azure AI Content Safety] - 2023-11-30-preview Private Preview * update doc * resolve comments. * Merge main and recompile swagger * add explanation for 2023-11-30-preview * format * generate swagger * Optimize contract (#36) * add 12-30-preview, add explanation spec * update * renamed reason -> harmful chunks * update. * remove new version enum from GA version * Remove examples from 1015 * restore examples * Add examples for jailbreak and protected material * run prettier for example * commit add enum to stable * Add omit-unreachable-types: true to typespec * compile preview * Fix readme * renamed to citation * UPDATE: add reasoning column and update some docs. * update doc. * update api version. * Fix some typo issues. (#40) * Update data plane. * draft * draft * draft * draft * draft * draft * draft * draft * draft * draft * draft * update bd draft * update spec draft * update spec draft * update spec draft --------- Co-authored-by: mengaims Co-authored-by: FAREAST\suxi Co-authored-by: Lixiang Liu Co-authored-by: Lixiang Liu Co-authored-by: zhaiyutong Co-authored-by: mengaims <50131889+mengaims@users.noreply.github.com> Co-authored-by: YUTONG_ZHAI <32332316+zhaiyutong@users.noreply.github.com> Co-authored-by: Jie Zhou Co-authored-by: Yuxiao Wang Co-authored-by: Yuxiao Wang <58904990+Sayaka-4987@users.noreply.github.com> Co-authored-by: jiezhou_microsoft <94604058+JieZhou000@users.noreply.github.com> Co-authored-by: David Liang --- .../ContentSafety/models.tsp | 92 +++- .../ContentSafety/routes.tsp | 31 ++ .../2023-10-30-preview/contentsafety.json | 5 +- .../2024-01-30-preview/contentsafety.json | 415 +++++++++++++++--- 4 files changed, 490 insertions(+), 53 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index 6459f69d9e01..b77017314c13 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -40,6 +40,14 @@ enum AnalyzeImageOutputType { FourSeverityLevels, } +@added(ContentSafety.Versions.v2024_01_30_Preview) +enum ModelStatus { + created, + training, + ready, + failed, +} + @doc("The text analysis request.") model AnalyzeTextOptions { @doc("The text needs to be analyzed. We support a maximum of 10k Unicode characters (Unicode code points) in the text of one request.") @@ -61,6 +69,20 @@ model AnalyzeTextOptions { @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The incidents to detect.") incidents?: IncidentOptions; + + @added(ContentSafety.Versions.v2024_01_30_Preview) + @doc("The customized categories will be analyzed. If they are not assigned, the analysis results for all available customized categories will be returned.") + customizedCategories?: CustomizedCategory[]; +} + +@added(ContentSafety.Versions.v2024_01_30_Preview) +@doc("Customized category for inference.") +model CustomizedCategory { + @doc("Category name") + categoryName: string; + + @doc("Model ID for the category. If not provided, the latest available model will be used.") + modelId: string; } @added(ContentSafety.Versions.v2023_10_30_Preview) @@ -88,6 +110,28 @@ model AnalyzeTextResult { @added(ContentSafety.Versions.v2024_01_30_Preview) @doc("Chunks in the original text detected as harmful content. Analysis result and scores are caused by these.") citation?: string[]; + + @added(ContentSafety.Versions.v2024_01_30_Preview) + @doc("Analysis result for customized categories.") + customizedCategoriesAnalysis: TextCustomizedCategoryAnalysis[]; +} + +@added(ContentSafety.Versions.v2024_01_30_Preview) +@doc("Text customized category analysis result.") +model TextCustomizedCategoryAnalysis { + @doc("Customized category name") + categoryName: string; + + @doc("customized category analysis") + customizedCategoriesAnalysis: TextCustomizedCategoryClassResult[]; +} + +@added(ContentSafety.Versions.v2024_01_30_Preview) +@doc("customized category analysis result") +model TextCustomizedCategoryClassResult { + id: int32; + @renamedFrom(Versions.v2024_01_30_Preview, "name") + className: string; } @doc("The result of blocklist match.") @@ -456,9 +500,11 @@ model PreDefinedConcept { @added(Versions.v2023_10_30_Preview) @doc("Label definition.") -model SubCategory { +@renamedFrom(Versions.v2024_01_30_Preview, "SubCategory") +model Class { id: int32; - name: string; + @renamedFrom(Versions.v2024_01_30_Preview, "name") + className: string; statements: string[]; } @@ -473,12 +519,39 @@ model TextCustomizedCategory { @maxLength(64) categoryName: string; + @doc("A predefined concept with its definition can be used directly in the subcategories.") + @added(Versions.v2023_10_30_Preview) + @removed(Versions.v2024_01_30_Preview) preDefinedConcepts?: PreDefinedConcept[]; - subCategories: SubCategory[]; + + @doc("Subcategories are detailed classes of the category. It is required there is a class 'safe' with id=0.") + @renamedFrom(Versions.v2024_01_30_Preview, "subCategories") + classes: Class[]; + + @added(Versions.v2023_10_30_Preview) + @removed(Versions.v2024_01_30_Preview) emphases?: string[]; + + @doc("Blob that stores the examples.") exampleBlobUrl?: url; } +@added(ContentSafety.Versions.v2024_01_30_Preview) +@doc("The response for async training triggering.") +model SubmitModelTrainingResponse { + ...AcceptedResponse; + + @header("operation-location") + @doc("The location of the status API for monitoring the triggered model.") + modelUrl: string; +} + +@added(ContentSafety.Versions.v2024_01_30_Preview) +model AsyncJobWarning { + code: string; + messgae: string; +} + #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("ImageWithText analyze category.") @@ -489,6 +562,19 @@ enum ImageWithTextCategory { Violence, } +@added(ContentSafety.Versions.v2024_01_30_Preview) +@parentResource(TextCustomizedCategory) +@resource("models") +model TextTrainedModel { + @key + modelId: string; + status: ModelStatus; + createdTime: utcDateTime; + lastUpdateTime: utcDateTime; + warnings?: AsyncJobWarning[]; + errors?: string[]; +} + @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The analysis request of the image with text.") model AnalyzeImageWithTextOptions { diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 6e0b436297b0..16b36381a21a 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -290,6 +290,37 @@ interface TextCategoryCustomization { TextCustomizedCategory, ListQueryParametersTrait >; + + @action("trainModel") + @added(Versions.v2024_01_30_Preview) + trainModel is CategoryOps.ResourceAction< + TextCustomizedCategory, + {}, + SubmitModelTrainingResponse + >; +} + +interface TextCustomizedMdoelOps + extends Azure.Core.ResourceOperations {} + +@added(Versions.v2024_01_30_Preview) +interface TextCustomizedModelOperations { + @summary("List all existing models") + @doc("List existing models.") + listTextCustomizedModels is TextCustomizedMdoelOps.ResourceList< + TextTrainedModel, + ListQueryParametersTrait + >; + + @doc("Get a model that is not deleted.") + getTextCustomizedModels is TextCustomizedMdoelOps.ResourceRead; + + @doc("If the model is training, the training process will be cancelled and the model will also be deleted.") + deleteCustomizedModel is TextCustomizedMdoelOps.ResourceDelete< + TextTrainedModel + >; } @added(Versions.v2023_10_30_Preview) 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 f4f32e3af776..9d0aad9dfe01 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 @@ -2931,6 +2931,7 @@ }, "preDefinedConcepts": { "type": "array", + "description": "A predefined concept with its definition can be used directly in the subcategories.", "items": { "$ref": "#/definitions/PreDefinedConcept" }, @@ -2938,6 +2939,7 @@ }, "subCategories": { "type": "array", + "description": "Subcategories are detailed classes of the category. It is required there is a class 'safe' with id=0.", "items": { "$ref": "#/definitions/SubCategory" } @@ -2950,7 +2952,8 @@ }, "exampleBlobUrl": { "type": "string", - "format": "uri" + "format": "uri", + "description": "Blob that stores the examples." } }, "required": [ diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json index 208f36065325..f1efad653ecf 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json @@ -1055,6 +1055,189 @@ } } }, + "/text/categories/{categoryName}:trainModel": { + "post": { + "operationId": "TextCategoryCustomization_TrainModel", + "description": "Resource action operation template.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "categoryName", + "in": "path", + "description": "Text customizedCategories name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^Customized_[0-9A-Za-z._~-]+$" + } + ], + "responses": { + "202": { + "description": "The request has been accepted for processing, but processing has not yet completed.", + "headers": { + "operation-location": { + "type": "string", + "description": "The location of the status API for monitoring the triggered model." + } + } + }, + "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/categories/{categoryName}/models": { + "get": { + "operationId": "TextCustomizedModelOperations_ListTextCustomizedModels", + "summary": "List all existing models", + "description": "List existing models.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "categoryName", + "in": "path", + "description": "Text customizedCategories name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^Customized_[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/PagedTextTrainedModel" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/text/categories/{categoryName}/models/{modelId}": { + "get": { + "operationId": "TextCustomizedModelOperations_GetTextCustomizedModels", + "description": "Get a model that is not deleted.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "categoryName", + "in": "path", + "description": "Text customizedCategories name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^Customized_[0-9A-Za-z._~-]+$" + }, + { + "name": "modelId", + "in": "path", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextTrainedModel" + } + }, + "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." + } + } + } + } + }, + "delete": { + "operationId": "TextCustomizedModelOperations_DeleteCustomizedModel", + "description": "If the model is training, the training process will be cancelled and the model will also be deleted.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "categoryName", + "in": "path", + "description": "Text customizedCategories name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^Customized_[0-9A-Za-z._~-]+$" + }, + { + "name": "modelId", + "in": "path", + "required": true, + "type": "string" + } + ], + "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." + } + } + } + } + } + }, "/text/incidents": { "get": { "operationId": "TextIncidents_ListIncidents", @@ -1920,6 +2103,14 @@ "incidents": { "$ref": "#/definitions/IncidentOptions", "description": "The incidents to detect." + }, + "customizedCategories": { + "type": "array", + "description": "The customized categories will be analyzed. If they are not assigned, the analysis results for all available customized categories will be returned.", + "items": { + "$ref": "#/definitions/CustomizedCategory" + }, + "x-ms-identifiers": [] } }, "required": [ @@ -2011,10 +2202,19 @@ "items": { "type": "string" } + }, + "customizedCategoriesAnalysis": { + "type": "array", + "description": "Analysis result for customized categories.", + "items": { + "$ref": "#/definitions/TextCustomizedCategoryAnalysis" + }, + "x-ms-identifiers": [] } }, "required": [ - "categoriesAnalysis" + "categoriesAnalysis", + "customizedCategoriesAnalysis" ] }, "AnnotateTextOptions": { @@ -2059,6 +2259,21 @@ "name" ] }, + "AsyncJobWarning": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "messgae": { + "type": "string" + } + }, + "required": [ + "code", + "messgae" + ] + }, "Azure.Core.Foundations.Error": { "type": "object", "description": "The error object.", @@ -2120,6 +2335,48 @@ } } }, + "Class": { + "type": "object", + "description": "Label definition.", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "className": { + "type": "string" + }, + "statements": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "id", + "className", + "statements" + ] + }, + "CustomizedCategory": { + "type": "object", + "description": "Customized category for inference.", + "properties": { + "categoryName": { + "type": "string", + "description": "Category name" + }, + "modelId": { + "type": "string", + "description": "Model ID for the category. If not provided, the latest available model will be used." + } + }, + "required": [ + "categoryName", + "modelId" + ] + }, "DetectUngroundednessOptions": { "type": "object", "description": "The request of ungroundedness detection.", @@ -2476,6 +2733,19 @@ "incidentSampleId" ] }, + "ModelStatus": { + "type": "string", + "enum": [ + "created", + "training", + "ready", + "failed" + ], + "x-ms-enum": { + "name": "ModelStatus", + "modelAsString": true + } + }, "PagedImageIncident": { "type": "object", "description": "Paged collection of ImageIncident items", @@ -2630,20 +2900,26 @@ "value" ] }, - "PreDefinedConcept": { + "PagedTextTrainedModel": { "type": "object", - "description": "Pre-defined concept.", + "description": "Paged collection of TextTrainedModel items", "properties": { - "concept": { - "type": "string" + "value": { + "type": "array", + "description": "The TextTrainedModel items on this page", + "items": { + "$ref": "#/definitions/TextTrainedModel" + }, + "x-ms-identifiers": [] }, - "description": { - "type": "string" + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" } }, "required": [ - "concept", - "description" + "value" ] }, "ProtectedMaterialAnalysisResult": { @@ -2707,30 +2983,6 @@ "incidentSampleIds" ] }, - "SubCategory": { - "type": "object", - "description": "Label definition.", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - }, - "statements": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "id", - "name", - "statements" - ] - }, "Task": { "type": "string", "description": "Task type.", @@ -2886,33 +3138,60 @@ "create" ] }, - "preDefinedConcepts": { - "type": "array", - "items": { - "$ref": "#/definitions/PreDefinedConcept" - }, - "x-ms-identifiers": [] - }, - "subCategories": { + "classes": { "type": "array", + "description": "Subcategories are detailed classes of the category. It is required there is a class 'safe' with id=0.", "items": { - "$ref": "#/definitions/SubCategory" + "$ref": "#/definitions/Class" } }, - "emphases": { + "exampleBlobUrl": { + "type": "string", + "format": "uri", + "description": "Blob that stores the examples." + } + }, + "required": [ + "categoryName", + "classes" + ] + }, + "TextCustomizedCategoryAnalysis": { + "type": "object", + "description": "Text customized category analysis result.", + "properties": { + "categoryName": { + "type": "string", + "description": "Customized category name" + }, + "customizedCategoriesAnalysis": { "type": "array", + "description": "customized category analysis", "items": { - "type": "string" + "$ref": "#/definitions/TextCustomizedCategoryClassResult" } - }, - "exampleBlobUrl": { - "type": "string", - "format": "uri" } }, "required": [ "categoryName", - "subCategories" + "customizedCategoriesAnalysis" + ] + }, + "TextCustomizedCategoryClassResult": { + "type": "object", + "description": "customized category analysis result", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "className": { + "type": "string" + } + }, + "required": [ + "id", + "className" ] }, "TextIncident": { @@ -2998,6 +3277,44 @@ "incidentSampleId" ] }, + "TextTrainedModel": { + "type": "object", + "properties": { + "modelId": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/ModelStatus" + }, + "createdTime": { + "type": "string", + "format": "date-time" + }, + "lastUpdateTime": { + "type": "string", + "format": "date-time" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/AsyncJobWarning" + }, + "x-ms-identifiers": [] + }, + "errors": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "modelId", + "status", + "createdTime", + "lastUpdateTime" + ] + }, "UngroundedDetails": { "type": "object", "description": "The detailed information about a text identified as ungrounded.", From cd1c2740a8ac719acf389b6c38dcf7a12275d577 Mon Sep 17 00:00:00 2001 From: MinjueWu <597922968@qq.com> Date: Thu, 11 Jan 2024 20:19:00 +0800 Subject: [PATCH 03/13] Add async batch image APIs in 2024-01-30-preview (#44) * Add async batch image APIs in 2024-01-30-preview * Update * Update * Add error message in GET resonse --- .../ContentSafety/models.tsp | 71 ++++++ .../ContentSafety/routes.tsp | 35 +++ .../2024-01-30-preview/contentsafety.json | 218 ++++++++++++++++++ 3 files changed, 324 insertions(+) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index b77017314c13..dfe70b289456 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -40,6 +40,32 @@ enum AnalyzeImageOutputType { FourSeverityLevels, } +@added(ContentSafety.Versions.v2024_01_30_Preview) +@doc("The type of batch results storage mode.") +enum BatchResultsStorageMode { + @doc("Merge each result into one file.") + CollectiveResultFile, + + @doc("Store each result in a single file.") + IndividualResultFiles, +} + +@added(ContentSafety.Versions.v2024_01_30_Preview) +@doc("The type of batch analysis task status.") +enum BatchTaskStatus { + @doc("The task has not started yet.") + NotStarted, + + @doc("The task is in progress.") + Running, + + @doc("The task has failed.") + Failed, + + @doc("The task has been succeeded.") + Succeeded, +} + @added(ContentSafety.Versions.v2024_01_30_Preview) enum ModelStatus { created, @@ -213,6 +239,51 @@ model ImageCategoriesAnalysis { severity?: int32; } +@added(ContentSafety.Versions.v2024_01_30_Preview) +@doc("The image batch analysis request.") +model BatchAnalyzeImagesOptions { + @doc("The URL of the Azure Storage Blob containing all the images to be analyzed in the batch task.") + imagesBlobFolderUrl: url; + + @doc("The URL of the Azure Storage Blob where the batch task results will be written.") + analysisResultsBlobFolderUrl: url; + + @doc("The storage mode for the batch task results, either 'CollectiveResultFile' or 'IndividualResultFiles'.") + resultsStorageMode?: BatchResultsStorageMode = BatchResultsStorageMode.CollectiveResultFile; + + @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 incidents to detect.") + incidents?: IncidentOptions; +} + +@added(ContentSafety.Versions.v2024_01_30_Preview) +@doc("Image batch analyze task.") +@resource("image/batchAnalyzeTasks") +model ImageBatchTaskDetail { + @doc("The id of image batch analysis task.") + @key("taskId") + @visibility("read") + @maxLength(64) + taskId: string; + + @doc("The status of the batch image analysis task.") + status: BatchTaskStatus; + + @doc("The progress of the batch image analysis task, represented as a percentage (0-100).") + progressPercentage: float64; + + @doc("The timestamp of when batch image analysis task was created.") + taskCreatedTime: utcDateTime; + + @doc("Return error detail when the task failed.") + error?: Azure.Core.Foundations.Error; +} + @doc("Text Blocklist.") @resource("text/blocklists") model TextBlocklist { diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 16b36381a21a..4e222d6359e9 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -81,6 +81,41 @@ interface ImageOperations { >; } +interface ImageBatchOperations { + @added(ContentSafety.Versions.v2024_01_30_Preview) + @summary("Start Batch Analyze Images") + @doc("An asynchronous API for the batch analysis of potentially harmful image content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.") + @route("/image:batchAnalyze") + batchAnalyzeImage is ImageLongRunningRpcOperation< + { + @body + @doc("The image batch analysis request.") + body: BatchAnalyzeImagesOptions; + }, + ImageBatchTaskDetail + >; + + @added(ContentSafety.Versions.v2024_01_30_Preview) + @summary("Get Batch Analyze Status") + @doc("Check the status of a batch image analysis task.") + getBatchTaskStatus is Azure.Core.ResourceRead; +} + +@doc("Long running RPC operation template") +op ImageLongRunningRpcOperation< + TParams extends TypeSpec.Reflection.Model, + TResponse extends TypeSpec.Reflection.Model +> is Azure.Core.Foundations.Operation< + TParams, + Azure.Core.Foundations.AcceptedResponse & TResponse, + Azure.Core.Foundations.ErrorResponse +>; + +interface BatchOps + extends Azure.Core.ResourceOperations {} + interface BlockOps extends Azure.Core.ResourceOperations Date: Thu, 11 Jan 2024 21:44:22 +0800 Subject: [PATCH 04/13] Mengai/acs customization (#47) * Change annotation API * Add prompt generation APIs --- .../ContentSafety/models.tsp | 37 +++++- .../ContentSafety/routes.tsp | 31 ++++- .../2024-01-30-preview/contentsafety.json | 122 +++++++++++++++++- 3 files changed, 174 insertions(+), 16 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index dfe70b289456..cda5c76d1d8e 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -68,10 +68,17 @@ enum BatchTaskStatus { @added(ContentSafety.Versions.v2024_01_30_Preview) enum ModelStatus { - created, - training, - ready, - failed, + Created, + Training, + Ready, + Failed, +} + +@added(ContentSafety.Versions.v2024_01_30_Preview) +enum GeneratePromptStatus { + Running, + Ready, + Failed, } @doc("The text analysis request.") @@ -156,6 +163,7 @@ model TextCustomizedCategoryAnalysis { @doc("customized category analysis result") model TextCustomizedCategoryClassResult { id: int32; + @renamedFrom(Versions.v2024_01_30_Preview, "name") className: string; } @@ -574,8 +582,10 @@ model PreDefinedConcept { @renamedFrom(Versions.v2024_01_30_Preview, "SubCategory") model Class { id: int32; + @renamedFrom(Versions.v2024_01_30_Preview, "name") className: string; + statements: string[]; } @@ -611,7 +621,7 @@ model TextCustomizedCategory { @doc("The response for async training triggering.") model SubmitModelTrainingResponse { ...AcceptedResponse; - + @header("operation-location") @doc("The location of the status API for monitoring the triggered model.") modelUrl: string; @@ -623,6 +633,22 @@ model AsyncJobWarning { messgae: string; } +@added(ContentSafety.Versions.v2024_01_30_Preview) +@resource("text/generatePromptTasks") +model GeneratePromptTaskDetail { + @doc("The id of image batch analysis task.") + @key("taskId") + @visibility("read") + @maxLength(64) + taskId: string; + + @doc("The status of the batch image analysis task.") + status: GeneratePromptStatus; + + @doc("Return error detail when the task failed.") + error?: Azure.Core.Foundations.Error; +} + #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("ImageWithText analyze category.") @@ -639,6 +665,7 @@ enum ImageWithTextCategory { model TextTrainedModel { @key modelId: string; + status: ModelStatus; createdTime: utcDateTime; lastUpdateTime: utcDateTime; diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 4e222d6359e9..e68ebcbed8a6 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -86,7 +86,7 @@ interface ImageBatchOperations { @summary("Start Batch Analyze Images") @doc("An asynchronous API for the batch analysis of potentially harmful image content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.") @route("/image:batchAnalyze") - batchAnalyzeImage is ImageLongRunningRpcOperation< + batchAnalyzeImage is ContentSafetyLongRunningRpcOperation< { @body @doc("The image batch analysis request.") @@ -102,7 +102,7 @@ interface ImageBatchOperations { } @doc("Long running RPC operation template") -op ImageLongRunningRpcOperation< +op ContentSafetyLongRunningRpcOperation< TParams extends TypeSpec.Reflection.Model, TResponse extends TypeSpec.Reflection.Model > is Azure.Core.Foundations.Operation< @@ -326,14 +326,33 @@ interface TextCategoryCustomization { ListQueryParametersTrait >; - @action("trainModel") @added(Versions.v2024_01_30_Preview) + @action("trainModel") trainModel is CategoryOps.ResourceAction< TextCustomizedCategory, {}, SubmitModelTrainingResponse >; -} + + @added(ContentSafety.Versions.v2024_01_30_Preview) + @route("/text/categories/{categoryName}:generatePrompt") + @post + @summary("Trigger prompt generation") + @doc("An asynchronous API to generate prompt from customized category.") + generateCustomizedCategoryPrompt is ContentSafetyLongRunningRpcOperation< + { + @path + @doc("The customized category name.") + categoryName: string; + }, + GeneratePromptTaskDetail + >; + + @added(ContentSafety.Versions.v2024_01_30_Preview) + @summary("Get Generate Prompt Task Status") + @doc("Check the status of a generate prompt task.") + getGeneratePromptTaskStatus is Azure.Core.ResourceRead; +} interface TextCustomizedMdoelOps extends Azure.Core.ResourceOperations; @doc("If the model is training, the training process will be cancelled and the model will also be deleted.") - deleteCustomizedModel is TextCustomizedMdoelOps.ResourceDelete< - TextTrainedModel - >; + deleteCustomizedModel is TextCustomizedMdoelOps.ResourceDelete; } @added(Versions.v2023_10_30_Preview) diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json index ddad37c54867..c6c39ee3ff11 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json @@ -1179,6 +1179,45 @@ } } }, + "/text/categories/{categoryName}:generatePrompt": { + "post": { + "operationId": "TextCategoryCustomization_GenerateCustomizedCategoryPrompt", + "summary": "Trigger prompt generation", + "description": "An asynchronous API to generate prompt from customized category.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "categoryName", + "in": "path", + "description": "The customized category name.", + "required": true, + "type": "string" + } + ], + "responses": { + "202": { + "description": "The request has been accepted for processing, but processing has not yet completed.", + "schema": { + "$ref": "#/definitions/GeneratePromptTaskDetail" + } + }, + "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/categories/{categoryName}/models": { "get": { "operationId": "TextCustomizedModelOperations_ListTextCustomizedModels", @@ -1319,6 +1358,46 @@ } } }, + "/text/generatePromptTasks/{taskId}": { + "get": { + "operationId": "TextCategoryCustomization_GetGeneratePromptTaskStatus", + "summary": "Get Generate Prompt Task Status", + "description": "Check the status of a generate prompt task.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "taskId", + "in": "path", + "description": "The id of image batch analysis task.", + "required": true, + "type": "string", + "maxLength": 64 + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/GeneratePromptTaskDetail" + } + }, + "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/incidents": { "get": { "operationId": "TextIncidents_ListIncidents", @@ -2646,6 +2725,41 @@ "modelAsString": true } }, + "GeneratePromptStatus": { + "type": "string", + "enum": [ + "Running", + "Ready", + "Failed" + ], + "x-ms-enum": { + "name": "GeneratePromptStatus", + "modelAsString": true + } + }, + "GeneratePromptTaskDetail": { + "type": "object", + "properties": { + "taskId": { + "type": "string", + "description": "The id of image batch analysis task.", + "maxLength": 64, + "readOnly": true + }, + "status": { + "$ref": "#/definitions/GeneratePromptStatus", + "description": "The status of the batch image analysis task." + }, + "error": { + "$ref": "#/definitions/Azure.Core.Foundations.Error", + "description": "Return error detail when the task failed." + } + }, + "required": [ + "taskId", + "status" + ] + }, "GptResource": { "type": "object", "description": "Connection details for the GPT resource.", @@ -2954,10 +3068,10 @@ "ModelStatus": { "type": "string", "enum": [ - "created", - "training", - "ready", - "failed" + "Created", + "Training", + "Ready", + "Failed" ], "x-ms-enum": { "name": "ModelStatus", From 4681f0b474ec0a1c7bce450e93e5f474bee0ef5f Mon Sep 17 00:00:00 2001 From: Yuxiao Wang <58904990+Sayaka-4987@users.noreply.github.com> Date: Fri, 19 Jan 2024 16:45:15 +0800 Subject: [PATCH 05/13] fix explanation version (#52) * fix explanation version * delete 0130 version --- .../cognitiveservices/ContentSafety/main.tsp | 3 - .../ContentSafety/models.tsp | 44 +- .../ContentSafety/routes.tsp | 12 +- .../2023-10-30-preview/contentsafety.json | 1009 ++++- .../2024-01-30-preview/contentsafety.json | 3708 ----------------- 5 files changed, 859 insertions(+), 3917 deletions(-) delete mode 100644 specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json diff --git a/specification/cognitiveservices/ContentSafety/main.tsp b/specification/cognitiveservices/ContentSafety/main.tsp index f98389174c9b..e50e8d924e4f 100644 --- a/specification/cognitiveservices/ContentSafety/main.tsp +++ b/specification/cognitiveservices/ContentSafety/main.tsp @@ -47,7 +47,4 @@ enum Versions { @useDependency(Azure.Core.Versions.v1_0_Preview_2) v2023_10_30_Preview: "2023-10-30-preview", - - @useDependency(Azure.Core.Versions.v1_0_Preview_2) - v2024_01_30_Preview: "2024-01-30-preview", } diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index cda5c76d1d8e..aa7bdc833a85 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -40,7 +40,7 @@ enum AnalyzeImageOutputType { FourSeverityLevels, } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The type of batch results storage mode.") enum BatchResultsStorageMode { @doc("Merge each result into one file.") @@ -50,7 +50,7 @@ enum BatchResultsStorageMode { IndividualResultFiles, } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The type of batch analysis task status.") enum BatchTaskStatus { @doc("The task has not started yet.") @@ -66,7 +66,7 @@ enum BatchTaskStatus { Succeeded, } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) enum ModelStatus { Created, Training, @@ -74,7 +74,7 @@ enum ModelStatus { Failed, } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) enum GeneratePromptStatus { Running, Ready, @@ -103,12 +103,12 @@ model AnalyzeTextOptions { @doc("The incidents to detect.") incidents?: IncidentOptions; - @added(ContentSafety.Versions.v2024_01_30_Preview) + @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The customized categories will be analyzed. If they are not assigned, the analysis results for all available customized categories will be returned.") customizedCategories?: CustomizedCategory[]; } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) @doc("Customized category for inference.") model CustomizedCategory { @doc("Category name") @@ -140,16 +140,16 @@ model AnalyzeTextResult { @doc("The incident match details.") incidentMatches?: IncidentMatch[]; - @added(ContentSafety.Versions.v2024_01_30_Preview) + @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("Chunks in the original text detected as harmful content. Analysis result and scores are caused by these.") citation?: string[]; - @added(ContentSafety.Versions.v2024_01_30_Preview) + @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("Analysis result for customized categories.") customizedCategoriesAnalysis: TextCustomizedCategoryAnalysis[]; } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) @doc("Text customized category analysis result.") model TextCustomizedCategoryAnalysis { @doc("Customized category name") @@ -159,12 +159,12 @@ model TextCustomizedCategoryAnalysis { customizedCategoriesAnalysis: TextCustomizedCategoryClassResult[]; } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) @doc("customized category analysis result") model TextCustomizedCategoryClassResult { id: int32; - @renamedFrom(Versions.v2024_01_30_Preview, "name") + @renamedFrom(Versions.v2023_10_30_Preview, "name") className: string; } @@ -247,7 +247,7 @@ model ImageCategoriesAnalysis { severity?: int32; } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The image batch analysis request.") model BatchAnalyzeImagesOptions { @doc("The URL of the Azure Storage Blob containing all the images to be analyzed in the batch task.") @@ -269,7 +269,7 @@ model BatchAnalyzeImagesOptions { incidents?: IncidentOptions; } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) @doc("Image batch analyze task.") @resource("image/batchAnalyzeTasks") model ImageBatchTaskDetail { @@ -579,11 +579,11 @@ model PreDefinedConcept { @added(Versions.v2023_10_30_Preview) @doc("Label definition.") -@renamedFrom(Versions.v2024_01_30_Preview, "SubCategory") +@renamedFrom(Versions.v2023_10_30_Preview, "SubCategory") model Class { id: int32; - @renamedFrom(Versions.v2024_01_30_Preview, "name") + @renamedFrom(Versions.v2023_10_30_Preview, "name") className: string; statements: string[]; @@ -602,22 +602,22 @@ model TextCustomizedCategory { @doc("A predefined concept with its definition can be used directly in the subcategories.") @added(Versions.v2023_10_30_Preview) - @removed(Versions.v2024_01_30_Preview) + @removed(Versions.v2023_10_30_Preview) preDefinedConcepts?: PreDefinedConcept[]; @doc("Subcategories are detailed classes of the category. It is required there is a class 'safe' with id=0.") - @renamedFrom(Versions.v2024_01_30_Preview, "subCategories") + @renamedFrom(Versions.v2023_10_30_Preview, "subCategories") classes: Class[]; @added(Versions.v2023_10_30_Preview) - @removed(Versions.v2024_01_30_Preview) + @removed(Versions.v2023_10_30_Preview) emphases?: string[]; @doc("Blob that stores the examples.") exampleBlobUrl?: url; } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The response for async training triggering.") model SubmitModelTrainingResponse { ...AcceptedResponse; @@ -627,13 +627,13 @@ model SubmitModelTrainingResponse { modelUrl: string; } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) model AsyncJobWarning { code: string; messgae: string; } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) @resource("text/generatePromptTasks") model GeneratePromptTaskDetail { @doc("The id of image batch analysis task.") @@ -659,7 +659,7 @@ enum ImageWithTextCategory { Violence, } -@added(ContentSafety.Versions.v2024_01_30_Preview) +@added(ContentSafety.Versions.v2023_10_30_Preview) @parentResource(TextCustomizedCategory) @resource("models") model TextTrainedModel { diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index e68ebcbed8a6..4735ecf3e324 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -82,7 +82,7 @@ interface ImageOperations { } interface ImageBatchOperations { - @added(ContentSafety.Versions.v2024_01_30_Preview) + @added(ContentSafety.Versions.v2023_10_30_Preview) @summary("Start Batch Analyze Images") @doc("An asynchronous API for the batch analysis of potentially harmful image content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.") @route("/image:batchAnalyze") @@ -95,7 +95,7 @@ interface ImageBatchOperations { ImageBatchTaskDetail >; - @added(ContentSafety.Versions.v2024_01_30_Preview) + @added(ContentSafety.Versions.v2023_10_30_Preview) @summary("Get Batch Analyze Status") @doc("Check the status of a batch image analysis task.") getBatchTaskStatus is Azure.Core.ResourceRead; @@ -326,7 +326,7 @@ interface TextCategoryCustomization { ListQueryParametersTrait >; - @added(Versions.v2024_01_30_Preview) + @added(Versions.v2023_10_30_Preview) @action("trainModel") trainModel is CategoryOps.ResourceAction< TextCustomizedCategory, @@ -334,7 +334,7 @@ interface TextCategoryCustomization { SubmitModelTrainingResponse >; - @added(ContentSafety.Versions.v2024_01_30_Preview) + @added(ContentSafety.Versions.v2023_10_30_Preview) @route("/text/categories/{categoryName}:generatePrompt") @post @summary("Trigger prompt generation") @@ -348,7 +348,7 @@ interface TextCategoryCustomization { GeneratePromptTaskDetail >; - @added(ContentSafety.Versions.v2024_01_30_Preview) + @added(ContentSafety.Versions.v2023_10_30_Preview) @summary("Get Generate Prompt Task Status") @doc("Check the status of a generate prompt task.") getGeneratePromptTaskStatus is Azure.Core.ResourceRead; @@ -359,7 +359,7 @@ interface TextCustomizedMdoelOps NoConditionalRequests & NoClientRequestId> {} -@added(Versions.v2024_01_30_Preview) +@added(Versions.v2023_10_30_Preview) interface TextCustomizedModelOperations { @summary("List all existing models") @doc("List existing models.") 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 9d0aad9dfe01..95d30e1a4d91 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 @@ -59,6 +59,46 @@ }, "tags": [], "paths": { + "/image/batchAnalyzeTasks/{taskId}": { + "get": { + "operationId": "ImageBatchOperations_GetBatchTaskStatus", + "summary": "Get Batch Analyze Status", + "description": "Check the status of a batch image analysis task.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "taskId", + "in": "path", + "description": "The id of image batch analysis task.", + "required": true, + "type": "string", + "maxLength": 64 + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/ImageBatchTaskDetail" + } + }, + "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." + } + } + } + } + } + }, "/image/incidents": { "get": { "operationId": "ImageIncidents_ListIncidents", @@ -480,6 +520,47 @@ } } }, + "/image:batchAnalyze": { + "post": { + "operationId": "ImageBatchOperations_BatchAnalyzeImage", + "summary": "Start Batch Analyze Images", + "description": "An asynchronous API for the batch 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 batch analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/BatchAnalyzeImagesOptions" + } + } + ], + "responses": { + "202": { + "description": "The request has been accepted for processing, but processing has not yet completed.", + "schema": { + "$ref": "#/definitions/ImageBatchTaskDetail" + } + }, + "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." + } + } + } + } + } + }, "/imageWithText:analyze": { "post": { "operationId": "ImageWithTextOperations_AnalyzeImageWithText", @@ -1100,30 +1181,32 @@ } } }, - "/text/incidents": { - "get": { - "operationId": "TextIncidents_ListIncidents", - "summary": "Get All Text Incidents", - "description": "Get all incidents details.", + "/text/categories/{categoryName}:trainModel": { + "post": { + "operationId": "TextCategoryCustomization_TrainModel", + "description": "Resource action operation template.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "$ref": "#/parameters/Azure.Core.TopQueryParameter" - }, - { - "$ref": "#/parameters/Azure.Core.SkipQueryParameter" - }, - { - "$ref": "#/parameters/Azure.Core.MaxPageSizeQueryParameter" + "name": "categoryName", + "in": "path", + "description": "Text customizedCategories name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^Customized_[0-9A-Za-z._~-]+$" } ], "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/PagedTextIncident" + "202": { + "description": "The request has been accepted for processing, but processing has not yet completed.", + "headers": { + "operation-location": { + "type": "string", + "description": "The location of the status API for monitoring the triggered model." + } } }, "default": { @@ -1138,36 +1221,31 @@ } } } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" } } }, - "/text/incidents/{incidentName}": { - "get": { - "operationId": "TextIncidents_GetIncidents", - "summary": "Get Text Incident By incidentName", - "description": "Returns text incident details.", + "/text/categories/{categoryName}:generatePrompt": { + "post": { + "operationId": "TextCategoryCustomization_GenerateCustomizedCategoryPrompt", + "summary": "Trigger prompt generation", + "description": "An asynchronous API to generate prompt from customized category.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "name": "incidentName", + "name": "categoryName", "in": "path", - "description": "incident name.", + "description": "The customized category name.", "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" + "type": "string" } ], "responses": { - "200": { - "description": "The request has succeeded.", + "202": { + "description": "The request has been accepted for processing, but processing has not yet completed.", "schema": { - "$ref": "#/definitions/TextIncident" + "$ref": "#/definitions/GeneratePromptTaskDetail" } }, "default": { @@ -1183,48 +1261,41 @@ } } } - }, - "patch": { - "operationId": "TextIncidents_CreateOrUpdateIncident", - "summary": "Create Or Update Text Incident", - "description": "Updates a text incident. If the text incident does not exist, a new text incident will be created.", - "consumes": [ - "application/merge-patch+json" - ], + } + }, + "/text/categories/{categoryName}/models": { + "get": { + "operationId": "TextCustomizedModelOperations_ListTextCustomizedModels", + "summary": "List all existing models", + "description": "List existing models.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "name": "incidentName", + "name": "categoryName", "in": "path", - "description": "incident name.", + "description": "Text customizedCategories name.", "required": true, "type": "string", "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" + "pattern": "^Customized_[0-9A-Za-z._~-]+$" }, { - "name": "resource", - "in": "body", - "description": "The resource instance.", - "required": true, - "schema": { - "$ref": "#/definitions/TextIncidentCreateOrUpdate" - } + "$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/TextIncident" - } - }, - "201": { - "description": "The request has succeeded and a new resource has been created as a result.", - "schema": { - "$ref": "#/definitions/TextIncident" + "$ref": "#/definitions/PagedTextTrainedModel" } }, "default": { @@ -1239,29 +1310,42 @@ } } } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" } - }, - "delete": { - "operationId": "TextIncidents_DeleteIncident", - "summary": "Delete Text Incident By incidentName", - "description": "Deletes a text incident.", + } + }, + "/text/categories/{categoryName}/models/{modelId}": { + "get": { + "operationId": "TextCustomizedModelOperations_GetTextCustomizedModels", + "description": "Get a model that is not deleted.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "name": "incidentName", + "name": "categoryName", "in": "path", - "description": "incident name.", + "description": "Text customizedCategories name.", "required": true, "type": "string", "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" + "pattern": "^Customized_[0-9A-Za-z._~-]+$" + }, + { + "name": "modelId", + "in": "path", + "required": true, + "type": "string" } ], "responses": { - "204": { - "description": "There is no content to send for this request, but the headers may be useful. " + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextTrainedModel" + } }, "default": { "description": "An unexpected error response.", @@ -1276,41 +1360,33 @@ } } } - } - }, - "/text/incidents/{incidentName}:addIncidentSamples": { - "post": { - "operationId": "TextIncidents_AddIncidentSamples", - "summary": "Add TextIncidentSamples To Incident", - "description": "Add textIncidentSamples to an incident. You can add at most 100 textIncidentSamples in one request.", + }, + "delete": { + "operationId": "TextCustomizedModelOperations_DeleteCustomizedModel", + "description": "If the model is training, the training process will be cancelled and the model will also be deleted.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "name": "incidentName", + "name": "categoryName", "in": "path", - "description": "incident name.", + "description": "Text customizedCategories name.", "required": true, "type": "string", "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" + "pattern": "^Customized_[0-9A-Za-z._~-]+$" }, { - "name": "body", - "in": "body", + "name": "modelId", + "in": "path", "required": true, - "schema": { - "$ref": "#/definitions/AddTextIncidentSamplesOptions" - } + "type": "string" } ], "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/AddTextIncidentSamplesResult" - } + "204": { + "description": "There is no content to send for this request, but the headers may be useful. " }, "default": { "description": "An unexpected error response.", @@ -1327,36 +1403,30 @@ } } }, - "/text/incidents/{incidentName}:removeIncidentSamples": { - "post": { - "operationId": "TextIncidents_RemoveIncidentSamples", - "summary": "Remove TextIncidentSamples From Incident", - "description": "Remove textIncidentSamples from an incident. You can remove at most 100 Text Incident in one request.", + "/text/generatePromptTasks/{taskId}": { + "get": { + "operationId": "TextCategoryCustomization_GetGeneratePromptTaskStatus", + "summary": "Get Generate Prompt Task Status", + "description": "Check the status of a generate prompt task.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "name": "incidentName", + "name": "taskId", "in": "path", - "description": "incident name.", + "description": "The id of image batch analysis task.", "required": true, "type": "string", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RemoveTextIncidentSamplesOptions" - } + "maxLength": 64 } ], "responses": { - "204": { - "description": "There is no content to send for this request, but the headers may be useful. " + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/GeneratePromptTaskDetail" + } }, "default": { "description": "An unexpected error response.", @@ -1373,24 +1443,15 @@ } } }, - "/text/incidents/{incidentName}/incidentSamples": { + "/text/incidents": { "get": { - "operationId": "TextIncidents_ListIncidentSamples", - "summary": "Get All TextIncidentSamples By textIncidentName", - "description": "Get all TextIncidentSamples in a text incident.", + "operationId": "TextIncidents_ListIncidents", + "summary": "Get All Text Incidents", + "description": "Get all incidents details.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, - { - "name": "incidentName", - "in": "path", - "description": "incident name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" - }, { "$ref": "#/parameters/Azure.Core.TopQueryParameter" }, @@ -1405,7 +1466,7 @@ "200": { "description": "The request has succeeded.", "schema": { - "$ref": "#/definitions/PagedTextIncidentSample" + "$ref": "#/definitions/PagedTextIncident" } }, "default": { @@ -1426,12 +1487,294 @@ } } }, - "/text/incidents/{incidentName}/incidentSamples/{incidentSampleId}": { + "/text/incidents/{incidentName}": { "get": { - "operationId": "TextIncidents_GetIncidentSample", - "summary": "Get TextIncidentSample By textIncidentName And textIncidentSampleId", - "description": "Get textIncidentSample by textIncidentName and textIncidentSampleId from a text incident.", - "parameters": [ + "operationId": "TextIncidents_GetIncidents", + "summary": "Get Text Incident By incidentName", + "description": "Returns text incident details.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextIncident" + } + }, + "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." + } + } + } + } + }, + "patch": { + "operationId": "TextIncidents_CreateOrUpdateIncident", + "summary": "Create Or Update Text Incident", + "description": "Updates a text incident. If the text incident does not exist, a new text incident will be created.", + "consumes": [ + "application/merge-patch+json" + ], + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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/TextIncidentCreateOrUpdate" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/TextIncident" + } + }, + "201": { + "description": "The request has succeeded and a new resource has been created as a result.", + "schema": { + "$ref": "#/definitions/TextIncident" + } + }, + "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." + } + } + } + } + }, + "delete": { + "operationId": "TextIncidents_DeleteIncident", + "summary": "Delete Text Incident By incidentName", + "description": "Deletes a text incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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." + } + } + } + } + } + }, + "/text/incidents/{incidentName}:addIncidentSamples": { + "post": { + "operationId": "TextIncidents_AddIncidentSamples", + "summary": "Add TextIncidentSamples To Incident", + "description": "Add textIncidentSamples to an incident. You can add at most 100 textIncidentSamples in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddTextIncidentSamplesOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AddTextIncidentSamplesResult" + } + }, + "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/incidents/{incidentName}:removeIncidentSamples": { + "post": { + "operationId": "TextIncidents_RemoveIncidentSamples", + "summary": "Remove TextIncidentSamples From Incident", + "description": "Remove textIncidentSamples from an incident. You can remove at most 100 Text Incident in one request.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident name.", + "required": true, + "type": "string", + "maxLength": 64, + "pattern": "^[0-9A-Za-z._~-]+$" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RemoveTextIncidentSamplesOptions" + } + } + ], + "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." + } + } + } + } + } + }, + "/text/incidents/{incidentName}/incidentSamples": { + "get": { + "operationId": "TextIncidents_ListIncidentSamples", + "summary": "Get All TextIncidentSamples By textIncidentName", + "description": "Get all TextIncidentSamples in a text incident.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "incidentName", + "in": "path", + "description": "incident 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/PagedTextIncidentSample" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/text/incidents/{incidentName}/incidentSamples/{incidentSampleId}": { + "get": { + "operationId": "TextIncidents_GetIncidentSample", + "summary": "Get TextIncidentSample By textIncidentName And textIncidentSampleId", + "description": "Get textIncidentSample by textIncidentName and textIncidentSampleId from a text incident.", + "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, @@ -1970,6 +2313,14 @@ "incidents": { "$ref": "#/definitions/IncidentOptions", "description": "The incidents to detect." + }, + "customizedCategories": { + "type": "array", + "description": "The customized categories will be analyzed. If they are not assigned, the analysis results for all available customized categories will be returned.", + "items": { + "$ref": "#/definitions/CustomizedCategory" + }, + "x-ms-identifiers": [] } }, "required": [ @@ -2047,17 +2398,33 @@ }, "x-ms-identifiers": [] }, - "incidentMatches": { + "incidentMatches": { + "type": "array", + "description": "The incident match details.", + "items": { + "$ref": "#/definitions/IncidentMatch" + }, + "x-ms-identifiers": [] + }, + "citation": { "type": "array", - "description": "The incident match details.", + "description": "Chunks in the original text detected as harmful content. Analysis result and scores are caused by these.", "items": { - "$ref": "#/definitions/IncidentMatch" + "type": "string" + } + }, + "customizedCategoriesAnalysis": { + "type": "array", + "description": "Analysis result for customized categories.", + "items": { + "$ref": "#/definitions/TextCustomizedCategoryAnalysis" }, "x-ms-identifiers": [] } }, "required": [ - "categoriesAnalysis" + "categoriesAnalysis", + "customizedCategoriesAnalysis" ] }, "AnnotateTextOptions": { @@ -2102,6 +2469,21 @@ "name" ] }, + "AsyncJobWarning": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "messgae": { + "type": "string" + } + }, + "required": [ + "code", + "messgae" + ] + }, "Azure.Core.Foundations.Error": { "type": "object", "description": "The error object.", @@ -2163,6 +2545,149 @@ } } }, + "BatchAnalyzeImagesOptions": { + "type": "object", + "description": "The image batch analysis request.", + "properties": { + "imagesBlobFolderUrl": { + "type": "string", + "format": "uri", + "description": "The URL of the Azure Storage Blob containing all the images to be analyzed in the batch task." + }, + "analysisResultsBlobFolderUrl": { + "type": "string", + "format": "uri", + "description": "The URL of the Azure Storage Blob where the batch task results will be written." + }, + "resultsStorageMode": { + "$ref": "#/definitions/BatchResultsStorageMode", + "description": "The storage mode for the batch task results, either 'CollectiveResultFile' or 'IndividualResultFiles'.", + "default": "CollectiveResultFile" + }, + "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" + }, + "incidents": { + "$ref": "#/definitions/IncidentOptions", + "description": "The incidents to detect." + } + }, + "required": [ + "imagesBlobFolderUrl", + "analysisResultsBlobFolderUrl" + ] + }, + "BatchResultsStorageMode": { + "type": "string", + "description": "The type of batch results storage mode.", + "enum": [ + "CollectiveResultFile", + "IndividualResultFiles" + ], + "x-ms-enum": { + "name": "BatchResultsStorageMode", + "modelAsString": true, + "values": [ + { + "name": "CollectiveResultFile", + "value": "CollectiveResultFile", + "description": "Merge each result into one file." + }, + { + "name": "IndividualResultFiles", + "value": "IndividualResultFiles", + "description": "Store each result in a single file." + } + ] + } + }, + "BatchTaskStatus": { + "type": "string", + "description": "The type of batch analysis task status.", + "enum": [ + "NotStarted", + "Running", + "Failed", + "Succeeded" + ], + "x-ms-enum": { + "name": "BatchTaskStatus", + "modelAsString": true, + "values": [ + { + "name": "NotStarted", + "value": "NotStarted", + "description": "The task has not started yet." + }, + { + "name": "Running", + "value": "Running", + "description": "The task is in progress." + }, + { + "name": "Failed", + "value": "Failed", + "description": "The task has failed." + }, + { + "name": "Succeeded", + "value": "Succeeded", + "description": "The task has been succeeded." + } + ] + } + }, + "Class": { + "type": "object", + "description": "Label definition.", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "className": { + "type": "string" + }, + "statements": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "id", + "className", + "statements" + ] + }, + "CustomizedCategory": { + "type": "object", + "description": "Customized category for inference.", + "properties": { + "categoryName": { + "type": "string", + "description": "Category name" + }, + "modelId": { + "type": "string", + "description": "Model ID for the category. If not provided, the latest available model will be used." + } + }, + "required": [ + "categoryName", + "modelId" + ] + }, "DetectUngroundednessOptions": { "type": "object", "description": "The request of ungroundedness detection.", @@ -2250,6 +2775,41 @@ "modelAsString": true } }, + "GeneratePromptStatus": { + "type": "string", + "enum": [ + "Running", + "Ready", + "Failed" + ], + "x-ms-enum": { + "name": "GeneratePromptStatus", + "modelAsString": true + } + }, + "GeneratePromptTaskDetail": { + "type": "object", + "properties": { + "taskId": { + "type": "string", + "description": "The id of image batch analysis task.", + "maxLength": 64, + "readOnly": true + }, + "status": { + "$ref": "#/definitions/GeneratePromptStatus", + "description": "The status of the batch image analysis task." + }, + "error": { + "$ref": "#/definitions/Azure.Core.Foundations.Error", + "description": "Return error detail when the task failed." + } + }, + "required": [ + "taskId", + "status" + ] + }, "GptResource": { "type": "object", "description": "Connection details for the GPT resource.", @@ -2268,6 +2828,42 @@ "deploymentName" ] }, + "ImageBatchTaskDetail": { + "type": "object", + "description": "Image batch analyze task.", + "properties": { + "taskId": { + "type": "string", + "description": "The id of image batch analysis task.", + "maxLength": 64, + "readOnly": true + }, + "status": { + "$ref": "#/definitions/BatchTaskStatus", + "description": "The status of the batch image analysis task." + }, + "progressPercentage": { + "type": "number", + "format": "double", + "description": "The progress of the batch image analysis task, represented as a percentage (0-100)." + }, + "taskCreatedTime": { + "type": "string", + "format": "date-time", + "description": "The timestamp of when batch image analysis task was created." + }, + "error": { + "$ref": "#/definitions/Azure.Core.Foundations.Error", + "description": "Return error detail when the task failed." + } + }, + "required": [ + "taskId", + "status", + "progressPercentage", + "taskCreatedTime" + ] + }, "ImageCategoriesAnalysis": { "type": "object", "description": "Image analysis result.", @@ -2519,6 +3115,19 @@ "incidentSampleId" ] }, + "ModelStatus": { + "type": "string", + "enum": [ + "Created", + "Training", + "Ready", + "Failed" + ], + "x-ms-enum": { + "name": "ModelStatus", + "modelAsString": true + } + }, "PagedImageIncident": { "type": "object", "description": "Paged collection of ImageIncident items", @@ -2673,20 +3282,26 @@ "value" ] }, - "PreDefinedConcept": { + "PagedTextTrainedModel": { "type": "object", - "description": "Pre-defined concept.", + "description": "Paged collection of TextTrainedModel items", "properties": { - "concept": { - "type": "string" + "value": { + "type": "array", + "description": "The TextTrainedModel items on this page", + "items": { + "$ref": "#/definitions/TextTrainedModel" + }, + "x-ms-identifiers": [] }, - "description": { - "type": "string" + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" } }, "required": [ - "concept", - "description" + "value" ] }, "ProtectedMaterialAnalysisResult": { @@ -2750,30 +3365,6 @@ "incidentSampleIds" ] }, - "SubCategory": { - "type": "object", - "description": "Label definition.", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - }, - "statements": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "id", - "name", - "statements" - ] - }, "Task": { "type": "string", "description": "Task type.", @@ -2929,25 +3520,11 @@ "create" ] }, - "preDefinedConcepts": { - "type": "array", - "description": "A predefined concept with its definition can be used directly in the subcategories.", - "items": { - "$ref": "#/definitions/PreDefinedConcept" - }, - "x-ms-identifiers": [] - }, - "subCategories": { + "classes": { "type": "array", "description": "Subcategories are detailed classes of the category. It is required there is a class 'safe' with id=0.", "items": { - "$ref": "#/definitions/SubCategory" - } - }, - "emphases": { - "type": "array", - "items": { - "type": "string" + "$ref": "#/definitions/Class" } }, "exampleBlobUrl": { @@ -2958,7 +3535,45 @@ }, "required": [ "categoryName", - "subCategories" + "classes" + ] + }, + "TextCustomizedCategoryAnalysis": { + "type": "object", + "description": "Text customized category analysis result.", + "properties": { + "categoryName": { + "type": "string", + "description": "Customized category name" + }, + "customizedCategoriesAnalysis": { + "type": "array", + "description": "customized category analysis", + "items": { + "$ref": "#/definitions/TextCustomizedCategoryClassResult" + } + } + }, + "required": [ + "categoryName", + "customizedCategoriesAnalysis" + ] + }, + "TextCustomizedCategoryClassResult": { + "type": "object", + "description": "customized category analysis result", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "className": { + "type": "string" + } + }, + "required": [ + "id", + "className" ] }, "TextIncident": { @@ -3044,6 +3659,44 @@ "incidentSampleId" ] }, + "TextTrainedModel": { + "type": "object", + "properties": { + "modelId": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/ModelStatus" + }, + "createdTime": { + "type": "string", + "format": "date-time" + }, + "lastUpdateTime": { + "type": "string", + "format": "date-time" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/definitions/AsyncJobWarning" + }, + "x-ms-identifiers": [] + }, + "errors": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "modelId", + "status", + "createdTime", + "lastUpdateTime" + ] + }, "UngroundedDetails": { "type": "object", "description": "The detailed information about a text identified as ungrounded.", diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json deleted file mode 100644 index c6c39ee3ff11..000000000000 --- a/specification/cognitiveservices/data-plane/ContentSafety/preview/2024-01-30-preview/contentsafety.json +++ /dev/null @@ -1,3708 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "ContentSafety Service", - "version": "2024-01-30-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/batchAnalyzeTasks/{taskId}": { - "get": { - "operationId": "ImageBatchOperations_GetBatchTaskStatus", - "summary": "Get Batch Analyze Status", - "description": "Check the status of a batch image analysis task.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "taskId", - "in": "path", - "description": "The id of image batch analysis task.", - "required": true, - "type": "string", - "maxLength": 64 - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/ImageBatchTaskDetail" - } - }, - "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." - } - } - } - } - } - }, - "/image/incidents": { - "get": { - "operationId": "ImageIncidents_ListIncidents", - "summary": "Get All Image Incidents", - "description": "Get all incidents details.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "$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/PagedImageIncident" - } - }, - "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-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/image/incidents/{incidentName}": { - "get": { - "operationId": "ImageIncidents_GetIncidents", - "summary": "Get Image Incident By incidentName", - "description": "Returns image incident details.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/ImageIncident" - } - }, - "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." - } - } - } - } - }, - "patch": { - "operationId": "ImageIncidents_CreateOrUpdateIncident", - "summary": "Create Or Update Image Incident", - "description": "Updates a image incident. If the image incident does not exist, a new image incident will be created.", - "consumes": [ - "application/merge-patch+json" - ], - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident 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/ImageIncidentCreateOrUpdate" - } - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/ImageIncident" - } - }, - "201": { - "description": "The request has succeeded and a new resource has been created as a result.", - "schema": { - "$ref": "#/definitions/ImageIncident" - } - }, - "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." - } - } - } - } - }, - "delete": { - "operationId": "ImageIncidents_DeleteIncident", - "summary": "Delete Image Incident By incidentName", - "description": "Deletes a image incident.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident 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." - } - } - } - } - } - }, - "/image/incidents/{incidentName}:addIncidentSamples": { - "post": { - "operationId": "ImageIncidents_AddIncidentSamples", - "summary": "Add ImageIncidentSamples To Incident", - "description": "Add imageIncidentSamples to an incident. You can add at most 100 imageIncidentSamples in one request.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddImageIncidentSamplesOptions" - } - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/AddImageIncidentSamplesResult" - } - }, - "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." - } - } - } - } - } - }, - "/image/incidents/{incidentName}:removeIncidentSamples": { - "post": { - "operationId": "ImageIncidents_RemoveIncidentSamples", - "summary": "Remove ImageIncidentSamples From Incident", - "description": "Remove imageIncidentSamples from an incident. You can remove at most 100 Image Incident in one request.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RemoveImageIncidentSamplesOptions" - } - } - ], - "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." - } - } - } - } - } - }, - "/image/incidents/{incidentName}/incidentSamples": { - "get": { - "operationId": "ImageIncidents_ListIncidentSamples", - "summary": "Get All ImageIncidentSamples By imageIncidentName", - "description": "Get all ImageIncidentSamples in a image incident.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident 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/PagedListImageIncidentSampleResult" - } - }, - "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-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/image/incidents/{incidentName}/incidentSamples/{incidentSampleId}": { - "get": { - "operationId": "ImageIncidents_GetIncidentSample", - "summary": "Get ImageIncidentSample By imageIncidentName And imageIncidentSampleId", - "description": "Get imageIncidentSample by imageIncidentName and imageIncidentSampleId from a image incident.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" - }, - { - "name": "incidentSampleId", - "in": "path", - "description": "incident name.", - "required": true, - "type": "string", - "maxLength": 64 - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/ImageIncidentSampleResult" - } - }, - "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." - } - } - } - } - } - }, - "/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." - } - } - } - } - } - }, - "/image:batchAnalyze": { - "post": { - "operationId": "ImageBatchOperations_BatchAnalyzeImage", - "summary": "Start Batch Analyze Images", - "description": "An asynchronous API for the batch 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 batch analysis request.", - "required": true, - "schema": { - "$ref": "#/definitions/BatchAnalyzeImagesOptions" - } - } - ], - "responses": { - "202": { - "description": "The request has been accepted for processing, but processing has not yet completed.", - "schema": { - "$ref": "#/definitions/ImageBatchTaskDetail" - } - }, - "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." - } - } - } - } - } - }, - "/imageWithText:analyze": { - "post": { - "operationId": "ImageWithTextOperations_AnalyzeImageWithText", - "summary": "Analyze Image With Text", - "description": "A synchronous API for the analysis of potentially harmful image with 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 image with text analysis request.", - "required": true, - "schema": { - "$ref": "#/definitions/AnalyzeImageWithTextOptions" - } - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/AnalyzeImageWithTextResult" - } - }, - "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/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-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." - } - } - } - } - }, - "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." - } - } - } - } - }, - "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." - } - } - } - } - } - }, - "/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", - "description": "Options for adding or updating blocklist items.", - "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." - } - } - } - } - } - }, - "/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", - "description": "Options for removing blocklist items.", - "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." - } - } - } - } - } - }, - "/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-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." - } - } - } - } - } - }, - "/text/categories": { - "get": { - "operationId": "TextCategoryCustomization_ListTextCustomizedCategory", - "description": "Resource list operation template.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "$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/PagedTextCustomizedCategory" - } - }, - "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-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/text/categories/{categoryName}": { - "get": { - "operationId": "TextCategoryCustomization_GetTextCustomizedCategory", - "description": "Resource read operation template.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "Text customizedCategories name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^Customized_[0-9A-Za-z._~-]+$" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/TextCustomizedCategory" - } - }, - "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." - } - } - } - } - }, - "put": { - "operationId": "TextCategoryCustomization_CreateOrReplaceTextCustomizedCategory", - "description": "Create or replace operation template.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "Text customizedCategories name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^Customized_[0-9A-Za-z._~-]+$" - }, - { - "name": "resource", - "in": "body", - "description": "The resource instance.", - "required": true, - "schema": { - "$ref": "#/definitions/TextCustomizedCategory" - } - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/TextCustomizedCategory" - } - }, - "201": { - "description": "The request has succeeded and a new resource has been created as a result.", - "schema": { - "$ref": "#/definitions/TextCustomizedCategory" - } - }, - "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." - } - } - } - } - }, - "delete": { - "operationId": "TextCategoryCustomization_DeleteTextCustomizedCategory", - "description": "Resource delete operation template.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "Text customizedCategories name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^Customized_[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." - } - } - } - } - } - }, - "/text/categories/{categoryName}:trainModel": { - "post": { - "operationId": "TextCategoryCustomization_TrainModel", - "description": "Resource action operation template.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "Text customizedCategories name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^Customized_[0-9A-Za-z._~-]+$" - } - ], - "responses": { - "202": { - "description": "The request has been accepted for processing, but processing has not yet completed.", - "headers": { - "operation-location": { - "type": "string", - "description": "The location of the status API for monitoring the triggered model." - } - } - }, - "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/categories/{categoryName}:generatePrompt": { - "post": { - "operationId": "TextCategoryCustomization_GenerateCustomizedCategoryPrompt", - "summary": "Trigger prompt generation", - "description": "An asynchronous API to generate prompt from customized category.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "The customized category name.", - "required": true, - "type": "string" - } - ], - "responses": { - "202": { - "description": "The request has been accepted for processing, but processing has not yet completed.", - "schema": { - "$ref": "#/definitions/GeneratePromptTaskDetail" - } - }, - "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/categories/{categoryName}/models": { - "get": { - "operationId": "TextCustomizedModelOperations_ListTextCustomizedModels", - "summary": "List all existing models", - "description": "List existing models.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "Text customizedCategories name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^Customized_[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/PagedTextTrainedModel" - } - }, - "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-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/text/categories/{categoryName}/models/{modelId}": { - "get": { - "operationId": "TextCustomizedModelOperations_GetTextCustomizedModels", - "description": "Get a model that is not deleted.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "Text customizedCategories name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^Customized_[0-9A-Za-z._~-]+$" - }, - { - "name": "modelId", - "in": "path", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/TextTrainedModel" - } - }, - "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." - } - } - } - } - }, - "delete": { - "operationId": "TextCustomizedModelOperations_DeleteCustomizedModel", - "description": "If the model is training, the training process will be cancelled and the model will also be deleted.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "Text customizedCategories name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^Customized_[0-9A-Za-z._~-]+$" - }, - { - "name": "modelId", - "in": "path", - "required": true, - "type": "string" - } - ], - "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." - } - } - } - } - } - }, - "/text/generatePromptTasks/{taskId}": { - "get": { - "operationId": "TextCategoryCustomization_GetGeneratePromptTaskStatus", - "summary": "Get Generate Prompt Task Status", - "description": "Check the status of a generate prompt task.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "taskId", - "in": "path", - "description": "The id of image batch analysis task.", - "required": true, - "type": "string", - "maxLength": 64 - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/GeneratePromptTaskDetail" - } - }, - "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/incidents": { - "get": { - "operationId": "TextIncidents_ListIncidents", - "summary": "Get All Text Incidents", - "description": "Get all incidents details.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "$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/PagedTextIncident" - } - }, - "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-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/text/incidents/{incidentName}": { - "get": { - "operationId": "TextIncidents_GetIncidents", - "summary": "Get Text Incident By incidentName", - "description": "Returns text incident details.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/TextIncident" - } - }, - "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." - } - } - } - } - }, - "patch": { - "operationId": "TextIncidents_CreateOrUpdateIncident", - "summary": "Create Or Update Text Incident", - "description": "Updates a text incident. If the text incident does not exist, a new text incident will be created.", - "consumes": [ - "application/merge-patch+json" - ], - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident 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/TextIncidentCreateOrUpdate" - } - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/TextIncident" - } - }, - "201": { - "description": "The request has succeeded and a new resource has been created as a result.", - "schema": { - "$ref": "#/definitions/TextIncident" - } - }, - "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." - } - } - } - } - }, - "delete": { - "operationId": "TextIncidents_DeleteIncident", - "summary": "Delete Text Incident By incidentName", - "description": "Deletes a text incident.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident 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." - } - } - } - } - } - }, - "/text/incidents/{incidentName}:addIncidentSamples": { - "post": { - "operationId": "TextIncidents_AddIncidentSamples", - "summary": "Add TextIncidentSamples To Incident", - "description": "Add textIncidentSamples to an incident. You can add at most 100 textIncidentSamples in one request.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddTextIncidentSamplesOptions" - } - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/AddTextIncidentSamplesResult" - } - }, - "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/incidents/{incidentName}:removeIncidentSamples": { - "post": { - "operationId": "TextIncidents_RemoveIncidentSamples", - "summary": "Remove TextIncidentSamples From Incident", - "description": "Remove textIncidentSamples from an incident. You can remove at most 100 Text Incident in one request.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RemoveTextIncidentSamplesOptions" - } - } - ], - "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." - } - } - } - } - } - }, - "/text/incidents/{incidentName}/incidentSamples": { - "get": { - "operationId": "TextIncidents_ListIncidentSamples", - "summary": "Get All TextIncidentSamples By textIncidentName", - "description": "Get all TextIncidentSamples in a text incident.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident 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/PagedTextIncidentSample" - } - }, - "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-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/text/incidents/{incidentName}/incidentSamples/{incidentSampleId}": { - "get": { - "operationId": "TextIncidents_GetIncidentSample", - "summary": "Get TextIncidentSample By textIncidentName And textIncidentSampleId", - "description": "Get textIncidentSample by textIncidentName and textIncidentSampleId from a text incident.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "incidentName", - "in": "path", - "description": "incident name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$" - }, - { - "name": "incidentSampleId", - "in": "path", - "description": "incident name.", - "required": true, - "type": "string", - "maxLength": 64 - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/TextIncidentSample" - } - }, - "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:adaptiveAnnotate": { - "post": { - "operationId": "PromptTextOperations_AnnotateText", - "summary": "Annotate Text by Prompt", - "description": "A remote procedure call (RPC) operation.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "body", - "in": "body", - "description": "The text analysis request.", - "required": true, - "schema": { - "$ref": "#/definitions/AnnotateTextOptions" - } - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/AnnotateTextResult" - } - }, - "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: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." - } - } - } - } - } - }, - "/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 protected material 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." - } - } - } - } - } - }, - "/text:detectUngroundedness": { - "post": { - "operationId": "TextUngroundednessDetectionOperations_DetectUngroundedness", - "summary": "Detect Ungrounded Information", - "description": "A synchronous API for the analysis of language model outputs to determine alignment with user-provided information or identify fictional content.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "body", - "in": "body", - "description": "The ungroundedness detection request.", - "required": true, - "schema": { - "$ref": "#/definitions/DetectUngroundednessOptions" - } - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/DetectUngroundednessResult" - } - }, - "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": { - "AddImageIncidentSamplesOptions": { - "type": "object", - "description": "The request to add incidentSamples to a incident.", - "properties": { - "incidentSamples": { - "type": "array", - "description": "Array of incidentSamples to add.", - "items": { - "$ref": "#/definitions/ImageIncidentSample" - }, - "x-ms-identifiers": [] - } - }, - "required": [ - "incidentSamples" - ] - }, - "AddImageIncidentSamplesResult": { - "type": "object", - "description": "The response of adding incidentSamples to the incident.", - "properties": { - "incidentSamples": { - "type": "array", - "description": "Array of incidentSamples have been added.", - "items": { - "$ref": "#/definitions/ListImageIncidentSampleResult" - }, - "x-ms-identifiers": [] - } - }, - "required": [ - "incidentSamples" - ] - }, - "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" - ] - }, - "AddTextIncidentSamplesOptions": { - "type": "object", - "description": "The request to add incidentSamples to a incident.", - "properties": { - "incidentSamples": { - "type": "array", - "description": "Array of incidentSamples to add.", - "items": { - "$ref": "#/definitions/TextIncidentSample" - }, - "x-ms-identifiers": [] - } - }, - "required": [ - "incidentSamples" - ] - }, - "AddTextIncidentSamplesResult": { - "type": "object", - "description": "The response of adding incidentSamples to the incident.", - "properties": { - "incidentSamples": { - "type": "array", - "description": "Array of incidentSamples have been added.", - "items": { - "$ref": "#/definitions/TextIncidentSample" - }, - "x-ms-identifiers": [] - } - }, - "required": [ - "incidentSamples" - ] - }, - "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" - }, - "incidents": { - "$ref": "#/definitions/IncidentOptions", - "description": "The incidents to detect." - } - }, - "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": [] - }, - "incidentMatches": { - "type": "array", - "description": "The incident match details.", - "items": { - "$ref": "#/definitions/IncidentMatch" - }, - "x-ms-identifiers": [] - } - }, - "required": [ - "categoriesAnalysis" - ] - }, - "AnalyzeImageWithTextOptions": { - "type": "object", - "description": "The analysis request of the image with text.", - "properties": { - "image": { - "$ref": "#/definitions/ImageData", - "description": "The image needs to be analyzed." - }, - "text": { - "type": "string", - "description": "The text attached to the image. We support at most 1k characters (unicode code points) in one text request.", - "maxLength": 1000 - }, - "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/ImageWithTextCategory" - } - }, - "enableOcr": { - "type": "boolean", - "description": "When set to true, our service will perform OCR and concatenate the recognized text with input text before analyzing. We will recognize at most 256 characters (unicode code points) from input image. The others will be truncated." - } - }, - "required": [ - "image", - "enableOcr" - ] - }, - "AnalyzeImageWithTextResult": { - "type": "object", - "description": "The analysis response of the image with text.", - "properties": { - "categoriesAnalysis": { - "type": "array", - "description": "Analysis result for categories.", - "items": { - "$ref": "#/definitions/ImageWithTextCategoriesAnalysis" - }, - "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" - }, - "incidents": { - "$ref": "#/definitions/IncidentOptions", - "description": "The incidents to detect." - }, - "customizedCategories": { - "type": "array", - "description": "The customized categories will be analyzed. If they are not assigned, the analysis results for all available customized categories will be returned.", - "items": { - "$ref": "#/definitions/CustomizedCategory" - }, - "x-ms-identifiers": [] - } - }, - "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": [] - }, - "incidentMatches": { - "type": "array", - "description": "The incident match details.", - "items": { - "$ref": "#/definitions/IncidentMatch" - }, - "x-ms-identifiers": [] - }, - "citation": { - "type": "array", - "description": "Chunks in the original text detected as harmful content. Analysis result and scores are caused by these.", - "items": { - "type": "string" - } - }, - "customizedCategoriesAnalysis": { - "type": "array", - "description": "Analysis result for customized categories.", - "items": { - "$ref": "#/definitions/TextCustomizedCategoryAnalysis" - }, - "x-ms-identifiers": [] - } - }, - "required": [ - "categoriesAnalysis", - "customizedCategoriesAnalysis" - ] - }, - "AnnotateTextOptions": { - "type": "object", - "description": "Annotate text options", - "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 - }, - "category": { - "type": "string", - "description": "The category will be analyzed, you can set your customized category or one of built-in categories in 'Hate','Selfharm', 'Sexual' and 'Violence'." - } - }, - "required": [ - "text", - "category" - ] - }, - "AnnotateTextResult": { - "type": "object", - "description": "The text annotation response.", - "properties": { - "id": { - "type": "integer", - "format": "int32", - "description": "The id of annotated subcategory." - }, - "name": { - "type": "string", - "description": "The name of annotated subcategory." - }, - "reasoning": { - "type": "string", - "description": "The reasoning." - } - }, - "required": [ - "id", - "name" - ] - }, - "AsyncJobWarning": { - "type": "object", - "properties": { - "code": { - "type": "string" - }, - "messgae": { - "type": "string" - } - }, - "required": [ - "code", - "messgae" - ] - }, - "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." - } - } - }, - "BatchAnalyzeImagesOptions": { - "type": "object", - "description": "The image batch analysis request.", - "properties": { - "imagesBlobFolderUrl": { - "type": "string", - "format": "uri", - "description": "The URL of the Azure Storage Blob containing all the images to be analyzed in the batch task." - }, - "analysisResultsBlobFolderUrl": { - "type": "string", - "format": "uri", - "description": "The URL of the Azure Storage Blob where the batch task results will be written." - }, - "resultsStorageMode": { - "$ref": "#/definitions/BatchResultsStorageMode", - "description": "The storage mode for the batch task results, either 'CollectiveResultFile' or 'IndividualResultFiles'.", - "default": "CollectiveResultFile" - }, - "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" - }, - "incidents": { - "$ref": "#/definitions/IncidentOptions", - "description": "The incidents to detect." - } - }, - "required": [ - "imagesBlobFolderUrl", - "analysisResultsBlobFolderUrl" - ] - }, - "BatchResultsStorageMode": { - "type": "string", - "description": "The type of batch results storage mode.", - "enum": [ - "CollectiveResultFile", - "IndividualResultFiles" - ], - "x-ms-enum": { - "name": "BatchResultsStorageMode", - "modelAsString": true, - "values": [ - { - "name": "CollectiveResultFile", - "value": "CollectiveResultFile", - "description": "Merge each result into one file." - }, - { - "name": "IndividualResultFiles", - "value": "IndividualResultFiles", - "description": "Store each result in a single file." - } - ] - } - }, - "BatchTaskStatus": { - "type": "string", - "description": "The type of batch analysis task status.", - "enum": [ - "NotStarted", - "Running", - "Failed", - "Succeeded" - ], - "x-ms-enum": { - "name": "BatchTaskStatus", - "modelAsString": true, - "values": [ - { - "name": "NotStarted", - "value": "NotStarted", - "description": "The task has not started yet." - }, - { - "name": "Running", - "value": "Running", - "description": "The task is in progress." - }, - { - "name": "Failed", - "value": "Failed", - "description": "The task has failed." - }, - { - "name": "Succeeded", - "value": "Succeeded", - "description": "The task has been succeeded." - } - ] - } - }, - "Class": { - "type": "object", - "description": "Label definition.", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "className": { - "type": "string" - }, - "statements": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "id", - "className", - "statements" - ] - }, - "CustomizedCategory": { - "type": "object", - "description": "Customized category for inference.", - "properties": { - "categoryName": { - "type": "string", - "description": "Category name" - }, - "modelId": { - "type": "string", - "description": "Model ID for the category. If not provided, the latest available model will be used." - } - }, - "required": [ - "categoryName", - "modelId" - ] - }, - "DetectUngroundednessOptions": { - "type": "object", - "description": "The request of ungroundedness detection.", - "properties": { - "domain": { - "$ref": "#/definitions/Domain", - "description": "The domain of the text for analysis.\nThis field is optional, with a default value of Generic." - }, - "task": { - "$ref": "#/definitions/Task", - "description": "The task type for the text analysis.\nThis field is optional, with a default value of Summarization." - }, - "query": { - "type": "string", - "description": "The user's question input in a QnA scenario.\nThis field is optional, but if the task type is set to QnA, it becomes required." - }, - "text": { - "type": "string", - "description": "The text requiring analysis." - }, - "groundingSources": { - "type": "array", - "description": "The source information used as a grounding reference.", - "items": { - "type": "string" - } - }, - "reasoning": { - "type": "boolean", - "description": "A value indicating if the output includes an explanation for the identified ungroundedness.\nThis field is optional, with a default value of false." - }, - "gptResource": { - "$ref": "#/definitions/GptResource", - "description": "Connection details for the GPT resource. \nThis field will be used only when the 'reasoning' field is set to true; otherwise, it will be ignored." - } - }, - "required": [ - "text", - "groundingSources" - ] - }, - "DetectUngroundednessResult": { - "type": "object", - "description": "The response of ungroundedness detection.", - "properties": { - "ungrounded": { - "type": "boolean", - "description": "Detection result for ungrounded text." - }, - "confidenceScore": { - "type": "number", - "format": "float", - "description": "Confidence score of the model in the analysis results." - }, - "ungroundedPercentage": { - "type": "number", - "format": "float", - "description": "Percentage of ungrounded Text." - }, - "ungroundedDetails": { - "type": "array", - "description": "The detailed information about a text identified as ungrounded.", - "items": { - "$ref": "#/definitions/UngroundedDetails" - }, - "x-ms-identifiers": [] - } - }, - "required": [ - "ungrounded", - "confidenceScore", - "ungroundedPercentage", - "ungroundedDetails" - ] - }, - "Domain": { - "type": "string", - "description": "Domain.", - "enum": [ - "Generic", - "Medical" - ], - "x-ms-enum": { - "name": "Domain", - "modelAsString": true - } - }, - "GeneratePromptStatus": { - "type": "string", - "enum": [ - "Running", - "Ready", - "Failed" - ], - "x-ms-enum": { - "name": "GeneratePromptStatus", - "modelAsString": true - } - }, - "GeneratePromptTaskDetail": { - "type": "object", - "properties": { - "taskId": { - "type": "string", - "description": "The id of image batch analysis task.", - "maxLength": 64, - "readOnly": true - }, - "status": { - "$ref": "#/definitions/GeneratePromptStatus", - "description": "The status of the batch image analysis task." - }, - "error": { - "$ref": "#/definitions/Azure.Core.Foundations.Error", - "description": "Return error detail when the task failed." - } - }, - "required": [ - "taskId", - "status" - ] - }, - "GptResource": { - "type": "object", - "description": "Connection details for the GPT resource.", - "properties": { - "azureOpenAIEndpoint": { - "type": "string", - "description": "Endpoint for Azure OpenAI resource." - }, - "deploymentName": { - "type": "string", - "description": "Deployment model name." - } - }, - "required": [ - "azureOpenAIEndpoint", - "deploymentName" - ] - }, - "ImageBatchTaskDetail": { - "type": "object", - "description": "Image batch analyze task.", - "properties": { - "taskId": { - "type": "string", - "description": "The id of image batch analysis task.", - "maxLength": 64, - "readOnly": true - }, - "status": { - "$ref": "#/definitions/BatchTaskStatus", - "description": "The status of the batch image analysis task." - }, - "progressPercentage": { - "type": "number", - "format": "double", - "description": "The progress of the batch image analysis task, represented as a percentage (0-100)." - }, - "taskCreatedTime": { - "type": "string", - "format": "date-time", - "description": "The timestamp of when batch image analysis task was created." - }, - "error": { - "$ref": "#/definitions/Azure.Core.Foundations.Error", - "description": "Return error detail when the task failed." - } - }, - "required": [ - "taskId", - "status", - "progressPercentage", - "taskCreatedTime" - ] - }, - "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." - } - } - }, - "ImageDataResult": { - "type": "object", - "description": "The image result is base64 encoded bytes", - "properties": { - "content": { - "type": "string", - "format": "byte", - "description": "The Base64 encoding of the image." - } - } - }, - "ImageIncident": { - "type": "object", - "description": "Image Incident.", - "properties": { - "incidentName": { - "type": "string", - "description": "incident name.", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$", - "x-ms-mutability": [ - "read", - "create" - ] - }, - "description": { - "type": "string", - "description": "Incident description.", - "maxLength": 1024 - }, - "created": { - "type": "string", - "format": "date-time", - "description": "Incident created time.", - "x-ms-mutability": [ - "read" - ] - }, - "lastUpdated": { - "type": "string", - "format": "date-time", - "description": "Incident updated time.", - "x-ms-mutability": [ - "read" - ] - } - }, - "required": [ - "incidentName", - "created", - "lastUpdated" - ] - }, - "ImageIncidentCreateOrUpdate": { - "type": "object", - "description": "Image Incident.", - "properties": { - "incidentName": { - "type": "string", - "description": "incident name.", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$", - "x-ms-mutability": [ - "read", - "create" - ] - }, - "description": { - "type": "string", - "description": "Incident description.", - "maxLength": 1024 - } - } - }, - "ImageIncidentSample": { - "type": "object", - "description": "Sample in an Image Incident.", - "properties": { - "incidentSampleId": { - "type": "string", - "description": "incident name.", - "maxLength": 64, - "readOnly": true - }, - "image": { - "$ref": "#/definitions/ImageData", - "description": "IncidentSample image content." - } - }, - "required": [ - "incidentSampleId" - ] - }, - "ImageIncidentSampleResult": { - "type": "object", - "description": "Sample Result in an Image Incident.", - "properties": { - "incidentSampleId": { - "type": "string", - "description": "incident name.", - "maxLength": 64, - "readOnly": true - }, - "image": { - "$ref": "#/definitions/ImageDataResult", - "description": "IncidentSample image content." - } - }, - "required": [ - "incidentSampleId" - ] - }, - "ImageWithTextCategoriesAnalysis": { - "type": "object", - "description": "ImageWithText analysis result.", - "properties": { - "category": { - "$ref": "#/definitions/ImageWithTextCategory", - "description": "The imageWithtext analysis category." - }, - "severity": { - "type": "integer", - "format": "int32", - "description": "The higher the severity of input content, the larger this value is. The values could be: 0,2,4,6." - } - }, - "required": [ - "category" - ] - }, - "ImageWithTextCategory": { - "type": "string", - "description": "ImageWithText analyze category.", - "enum": [ - "Hate", - "SelfHarm", - "Sexual", - "Violence" - ], - "x-ms-enum": { - "name": "ImageWithTextCategory", - "modelAsString": true - } - }, - "IncidentMatch": { - "type": "object", - "description": "The result of text incident match.", - "properties": { - "incidentName": { - "type": "string", - "description": "The name of the matched incident.", - "maxLength": 64 - } - }, - "required": [ - "incidentName" - ] - }, - "IncidentOptions": { - "type": "object", - "description": "The text analysis request.", - "properties": { - "incidentNames": { - "type": "array", - "description": "The accept decision made by service.", - "items": { - "type": "string" - } - }, - "haltOnIncidentHit": { - "type": "boolean", - "description": "When set to true, further analyses of harmful content will not be performed in cases where incidents are hit. When set to false, all analyses of harmful content will be performed, whether or not incidents are hit." - } - } - }, - "JailbreakAnalysisResult": { - "type": "object", - "description": "The text jailbreak analysis response.", - "properties": { - "detected": { - "type": "boolean", - "description": "Analysis result for jailbreak." - } - }, - "required": [ - "detected" - ] - }, - "ListImageIncidentSampleResult": { - "type": "object", - "description": "Sample in a Image Incident.", - "properties": { - "incidentSampleId": { - "type": "string", - "description": "incident name.", - "maxLength": 64, - "readOnly": true - } - }, - "required": [ - "incidentSampleId" - ] - }, - "ModelStatus": { - "type": "string", - "enum": [ - "Created", - "Training", - "Ready", - "Failed" - ], - "x-ms-enum": { - "name": "ModelStatus", - "modelAsString": true - } - }, - "PagedImageIncident": { - "type": "object", - "description": "Paged collection of ImageIncident items", - "properties": { - "value": { - "type": "array", - "description": "The ImageIncident items on this page", - "items": { - "$ref": "#/definitions/ImageIncident" - }, - "x-ms-identifiers": [] - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, - "PagedListImageIncidentSampleResult": { - "type": "object", - "description": "Paged collection of ListImageIncidentSampleResult items", - "properties": { - "value": { - "type": "array", - "description": "The ListImageIncidentSampleResult items on this page", - "items": { - "$ref": "#/definitions/ListImageIncidentSampleResult" - }, - "x-ms-identifiers": [] - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, - "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" - ] - }, - "PagedTextCustomizedCategory": { - "type": "object", - "description": "Paged collection of TextCustomizedCategory items", - "properties": { - "value": { - "type": "array", - "description": "The TextCustomizedCategory items on this page", - "items": { - "$ref": "#/definitions/TextCustomizedCategory" - }, - "x-ms-identifiers": [] - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, - "PagedTextIncident": { - "type": "object", - "description": "Paged collection of TextIncident items", - "properties": { - "value": { - "type": "array", - "description": "The TextIncident items on this page", - "items": { - "$ref": "#/definitions/TextIncident" - }, - "x-ms-identifiers": [] - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, - "PagedTextIncidentSample": { - "type": "object", - "description": "Paged collection of TextIncidentSample items", - "properties": { - "value": { - "type": "array", - "description": "The TextIncidentSample items on this page", - "items": { - "$ref": "#/definitions/TextIncidentSample" - }, - "x-ms-identifiers": [] - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, - "PagedTextTrainedModel": { - "type": "object", - "description": "Paged collection of TextTrainedModel items", - "properties": { - "value": { - "type": "array", - "description": "The TextTrainedModel items on this page", - "items": { - "$ref": "#/definitions/TextTrainedModel" - }, - "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" - ] - }, - "RemoveImageIncidentSamplesOptions": { - "type": "object", - "description": "The request to remove incidentSamples from a incident.", - "properties": { - "incidentSampleIds": { - "type": "array", - "description": "Array of incidentSamples to remove.", - "items": { - "type": "string" - } - } - }, - "required": [ - "incidentSampleIds" - ] - }, - "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" - ] - }, - "RemoveTextIncidentSamplesOptions": { - "type": "object", - "description": "The request to remove incidentSamples from a incident.", - "properties": { - "incidentSampleIds": { - "type": "array", - "description": "Array of incidentSamples to remove.", - "items": { - "type": "string" - } - } - }, - "required": [ - "incidentSampleIds" - ] - }, - "Task": { - "type": "string", - "description": "Task type.", - "enum": [ - "Summarization", - "QnA" - ], - "x-ms-enum": { - "name": "Task", - "modelAsString": true - } - }, - "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 - } - }, - "TextCustomizedCategory": { - "type": "object", - "description": "Text Customized categories.", - "properties": { - "categoryName": { - "type": "string", - "description": "Text customizedCategories name.", - "maxLength": 64, - "pattern": "^Customized_[0-9A-Za-z._~-]+$", - "x-ms-mutability": [ - "read", - "create" - ] - }, - "classes": { - "type": "array", - "description": "Subcategories are detailed classes of the category. It is required there is a class 'safe' with id=0.", - "items": { - "$ref": "#/definitions/Class" - } - }, - "exampleBlobUrl": { - "type": "string", - "format": "uri", - "description": "Blob that stores the examples." - } - }, - "required": [ - "categoryName", - "classes" - ] - }, - "TextCustomizedCategoryAnalysis": { - "type": "object", - "description": "Text customized category analysis result.", - "properties": { - "categoryName": { - "type": "string", - "description": "Customized category name" - }, - "customizedCategoriesAnalysis": { - "type": "array", - "description": "customized category analysis", - "items": { - "$ref": "#/definitions/TextCustomizedCategoryClassResult" - } - } - }, - "required": [ - "categoryName", - "customizedCategoriesAnalysis" - ] - }, - "TextCustomizedCategoryClassResult": { - "type": "object", - "description": "customized category analysis result", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "className": { - "type": "string" - } - }, - "required": [ - "id", - "className" - ] - }, - "TextIncident": { - "type": "object", - "description": "Text Incident.", - "properties": { - "incidentName": { - "type": "string", - "description": "incident name.", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$", - "x-ms-mutability": [ - "read", - "create" - ] - }, - "description": { - "type": "string", - "description": "Incident description.", - "maxLength": 1024 - }, - "created": { - "type": "string", - "format": "date-time", - "description": "Incident created time.", - "x-ms-mutability": [ - "read" - ] - }, - "lastUpdated": { - "type": "string", - "format": "date-time", - "description": "Incident updated time.", - "x-ms-mutability": [ - "read" - ] - } - }, - "required": [ - "incidentName", - "created", - "lastUpdated" - ] - }, - "TextIncidentCreateOrUpdate": { - "type": "object", - "description": "Text Incident.", - "properties": { - "incidentName": { - "type": "string", - "description": "incident name.", - "maxLength": 64, - "pattern": "^[0-9A-Za-z._~-]+$", - "x-ms-mutability": [ - "read", - "create" - ] - }, - "description": { - "type": "string", - "description": "Incident description.", - "maxLength": 1024 - } - } - }, - "TextIncidentSample": { - "type": "object", - "description": "Sample in a Text Incident.", - "properties": { - "incidentSampleId": { - "type": "string", - "description": "incident name.", - "maxLength": 64, - "readOnly": true - }, - "text": { - "type": "string", - "description": "IncidentSample text content.", - "maxLength": 1024 - } - }, - "required": [ - "incidentSampleId" - ] - }, - "TextTrainedModel": { - "type": "object", - "properties": { - "modelId": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/ModelStatus" - }, - "createdTime": { - "type": "string", - "format": "date-time" - }, - "lastUpdateTime": { - "type": "string", - "format": "date-time" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/AsyncJobWarning" - }, - "x-ms-identifiers": [] - }, - "errors": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "modelId", - "status", - "createdTime", - "lastUpdateTime" - ] - }, - "UngroundedDetails": { - "type": "object", - "description": "The detailed information about a text identified as ungrounded.", - "properties": { - "text": { - "type": "string", - "description": "The ungrounded text." - }, - "reason": { - "type": "string", - "description": "The explanation for identifying the text as ungrounded. \nOnly when the 'reasoning' field in the input is set to true 'reason' field will be returned." - } - }, - "required": [ - "text" - ] - } - }, - "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 10b327112fe15f55505e39c58d23431639b325b2 Mon Sep 17 00:00:00 2001 From: MinjueWu <597922968@qq.com> Date: Mon, 29 Jan 2024 16:54:31 +0800 Subject: [PATCH 06/13] Update async batch image APIs in 2023-10-30-preview (#54) * Add async batch image APIs in 2024-01-30-preview * Update * Update * Add error message in GET resonse * Update async batch image APIs in 2023-10-30-preview --- .../ContentSafety/models.tsp | 58 +++- .../ContentSafety/routes.tsp | 17 +- .../2023-10-30-preview/contentsafety.json | 262 +++++++++++++----- 3 files changed, 257 insertions(+), 80 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index aa7bdc833a85..6a57774db27e 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -250,11 +250,11 @@ model ImageCategoriesAnalysis { @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The image batch analysis request.") model BatchAnalyzeImagesOptions { - @doc("The URL of the Azure Storage Blob containing all the images to be analyzed in the batch task.") - imagesBlobFolderUrl: url; + @doc("The blob parameters of images to be analyzed.") + images: BatchAnalyzeImages; - @doc("The URL of the Azure Storage Blob where the batch task results will be written.") - analysisResultsBlobFolderUrl: url; + @doc("The blob parameters of result files.") + analysisResults: BatchAnalyzeImagesResults; @doc("The storage mode for the batch task results, either 'CollectiveResultFile' or 'IndividualResultFiles'.") resultsStorageMode?: BatchResultsStorageMode = BatchResultsStorageMode.CollectiveResultFile; @@ -262,31 +262,63 @@ model BatchAnalyzeImagesOptions { @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\".") + @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 incidents to detect.") incidents?: IncidentOptions; } +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The image batch analysis input.") +model BatchAnalyzeImages { + @doc("The URL to a blob prefix which represents a directory containing all the images to be analyzed in this batch task.") + blobPrefixLocation: url; + + @doc("The delimiter character you desire to use in the location URL, typically '/'.") + delimiter: string; + + @doc("An array of strings indicating file extensions of desired images within the logical folder.") + extensions: string[]; + + @doc("The last modified time (in RFC1123 format) of blobs. Only images that were modified before this time will be analyzed.") + lastModified?: utcDateTime; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("The image batch analysis output.") +model BatchAnalyzeImagesResults { + @doc("The URL to a blob prefix which represents a directory. The analysis result file(s) will be written to this directory.") + blobPrefixLocation: url; + + @doc("The delimiter character you desire to use in the location URL, typically '/'.") + delimiter: string; +} + @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("Image batch analyze task.") -@resource("image/batchAnalyzeTasks") +@resource("image/batchAnalyses") model ImageBatchTaskDetail { @doc("The id of image batch analysis task.") - @key("taskId") - @visibility("read") + @key("operationId") + @visibility("read", "create", "query") @maxLength(64) - taskId: string; + id: string; + + @doc("The kind of operation.") + kind: string; @doc("The status of the batch image analysis task.") status: BatchTaskStatus; - @doc("The progress of the batch image analysis task, represented as a percentage (0-100).") - progressPercentage: float64; - @doc("The timestamp of when batch image analysis task was created.") - taskCreatedTime: utcDateTime; + createdTime: utcDateTime; + + @doc("The blob parameters of result files.") + analysisResults: BatchAnalyzeImagesResults; + + @doc("The progress of the batch image analysis task, represented as a percentage (0-100).") + progressPercentage: float32; @doc("Return error detail when the task failed.") error?: Azure.Core.Foundations.Error; diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 4735ecf3e324..0bfd27537200 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -85,9 +85,14 @@ interface ImageBatchOperations { @added(ContentSafety.Versions.v2023_10_30_Preview) @summary("Start Batch Analyze Images") @doc("An asynchronous API for the batch analysis of potentially harmful image content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.") - @route("/image:batchAnalyze") + @route("/image/batchAnalyses") + @put batchAnalyzeImage is ContentSafetyLongRunningRpcOperation< { + @path + @doc("The unique operation id.") + operationId: string; + @body @doc("The image batch analysis request.") body: BatchAnalyzeImagesOptions; @@ -96,9 +101,17 @@ interface ImageBatchOperations { >; @added(ContentSafety.Versions.v2023_10_30_Preview) - @summary("Get Batch Analyze Status") + @summary("Get Image Batch Analysis task Status") @doc("Check the status of a batch image analysis task.") getBatchTaskStatus is Azure.Core.ResourceRead; + + @added(ContentSafety.Versions.v2023_10_30_Preview) + @summary("List All Image Batch Analysis Tasks") + @doc("List all batch image analysis tasks.") + listBatchTasks is Azure.Core.ResourceList< + ImageBatchTaskDetail, + ListQueryParametersTrait + >; } @doc("Long running RPC operation template") 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 95d30e1a4d91..9d266dce6be0 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 @@ -59,17 +59,61 @@ }, "tags": [], "paths": { - "/image/batchAnalyzeTasks/{taskId}": { + "/image/batchAnalyses": { + "get": { + "operationId": "ImageBatchOperations_ListBatchTasks", + "summary": "List All Image Batch Analysis Tasks", + "description": "List all batch image analysis tasks.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "$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/PagedImageBatchTaskDetail" + } + }, + "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-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/image/batchAnalyses/{operationId}": { "get": { "operationId": "ImageBatchOperations_GetBatchTaskStatus", - "summary": "Get Batch Analyze Status", + "summary": "Get Image Batch Analysis task Status", "description": "Check the status of a batch image analysis task.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "name": "taskId", + "name": "operationId", "in": "path", "description": "The id of image batch analysis task.", "required": true, @@ -97,6 +141,52 @@ } } } + }, + "put": { + "operationId": "ImageBatchOperations_BatchAnalyzeImage", + "summary": "Start Batch Analyze Images", + "description": "An asynchronous API for the batch analysis of potentially harmful image content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "operationId", + "in": "path", + "description": "The unique operation id.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "description": "The image batch analysis request.", + "required": true, + "schema": { + "$ref": "#/definitions/BatchAnalyzeImagesOptions" + } + } + ], + "responses": { + "202": { + "description": "The request has been accepted for processing, but processing has not yet completed.", + "schema": { + "$ref": "#/definitions/ImageBatchTaskDetail" + } + }, + "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." + } + } + } + } } }, "/image/incidents": { @@ -520,47 +610,6 @@ } } }, - "/image:batchAnalyze": { - "post": { - "operationId": "ImageBatchOperations_BatchAnalyzeImage", - "summary": "Start Batch Analyze Images", - "description": "An asynchronous API for the batch 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 batch analysis request.", - "required": true, - "schema": { - "$ref": "#/definitions/BatchAnalyzeImagesOptions" - } - } - ], - "responses": { - "202": { - "description": "The request has been accepted for processing, but processing has not yet completed.", - "schema": { - "$ref": "#/definitions/ImageBatchTaskDetail" - } - }, - "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." - } - } - } - } - } - }, "/imageWithText:analyze": { "post": { "operationId": "ImageWithTextOperations_AnalyzeImageWithText", @@ -2545,19 +2594,49 @@ } } }, - "BatchAnalyzeImagesOptions": { + "BatchAnalyzeImages": { "type": "object", - "description": "The image batch analysis request.", + "description": "The image batch analysis input.", "properties": { - "imagesBlobFolderUrl": { + "blobPrefixLocation": { "type": "string", "format": "uri", - "description": "The URL of the Azure Storage Blob containing all the images to be analyzed in the batch task." + "description": "The URL to a blob prefix which represents a directory containing all the images to be analyzed in this batch task." }, - "analysisResultsBlobFolderUrl": { + "delimiter": { "type": "string", - "format": "uri", - "description": "The URL of the Azure Storage Blob where the batch task results will be written." + "description": "The delimiter character you desire to use in the location URL, typically '/'." + }, + "extensions": { + "type": "array", + "description": "An array of strings indicating file extensions of desired images within the logical folder.", + "items": { + "type": "string" + } + }, + "lastModified": { + "type": "string", + "format": "date-time", + "description": "The last modified time (in RFC1123 format) of blobs. Only images that were modified before this time will be analyzed." + } + }, + "required": [ + "blobPrefixLocation", + "delimiter", + "extensions" + ] + }, + "BatchAnalyzeImagesOptions": { + "type": "object", + "description": "The image batch analysis request.", + "properties": { + "images": { + "$ref": "#/definitions/BatchAnalyzeImages", + "description": "The blob parameters of images to be analyzed." + }, + "analysisResults": { + "$ref": "#/definitions/BatchAnalyzeImagesResults", + "description": "The blob parameters of result files." }, "resultsStorageMode": { "$ref": "#/definitions/BatchResultsStorageMode", @@ -2573,7 +2652,7 @@ }, "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\".", + "description": "This refers to the type of image analysis output. If no value is assigned, the default value will be 'FourSeverityLevels'.", "default": "FourSeverityLevels" }, "incidents": { @@ -2582,8 +2661,27 @@ } }, "required": [ - "imagesBlobFolderUrl", - "analysisResultsBlobFolderUrl" + "images", + "analysisResults" + ] + }, + "BatchAnalyzeImagesResults": { + "type": "object", + "description": "The image batch analysis output.", + "properties": { + "blobPrefixLocation": { + "type": "string", + "format": "uri", + "description": "The URL to a blob prefix which represents a directory. The analysis result file(s) will be written to this directory." + }, + "delimiter": { + "type": "string", + "description": "The delimiter character you desire to use in the location URL, typically '/'." + } + }, + "required": [ + "blobPrefixLocation", + "delimiter" ] }, "BatchResultsStorageMode": { @@ -2832,36 +2930,49 @@ "type": "object", "description": "Image batch analyze task.", "properties": { - "taskId": { + "id": { "type": "string", "description": "The id of image batch analysis task.", "maxLength": 64, - "readOnly": true + "x-ms-mutability": [ + "read", + "create" + ] + }, + "kind": { + "type": "string", + "description": "The kind of operation." }, "status": { "$ref": "#/definitions/BatchTaskStatus", "description": "The status of the batch image analysis task." }, - "progressPercentage": { - "type": "number", - "format": "double", - "description": "The progress of the batch image analysis task, represented as a percentage (0-100)." - }, - "taskCreatedTime": { + "createdTime": { "type": "string", "format": "date-time", "description": "The timestamp of when batch image analysis task was created." }, + "analysisResults": { + "$ref": "#/definitions/BatchAnalyzeImagesResults", + "description": "The blob parameters of result files." + }, + "progressPercentage": { + "type": "number", + "format": "float", + "description": "The progress of the batch image analysis task, represented as a percentage (0-100)." + }, "error": { "$ref": "#/definitions/Azure.Core.Foundations.Error", "description": "Return error detail when the task failed." } }, "required": [ - "taskId", + "id", + "kind", "status", - "progressPercentage", - "taskCreatedTime" + "createdTime", + "analysisResults", + "progressPercentage" ] }, "ImageCategoriesAnalysis": { @@ -3128,6 +3239,27 @@ "modelAsString": true } }, + "PagedImageBatchTaskDetail": { + "type": "object", + "description": "Paged collection of ImageBatchTaskDetail items", + "properties": { + "value": { + "type": "array", + "description": "The ImageBatchTaskDetail items on this page", + "items": { + "$ref": "#/definitions/ImageBatchTaskDetail" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, "PagedImageIncident": { "type": "object", "description": "Paged collection of ImageIncident items", From 5766d32fe9df5cf7e31a125a4cdf082abced180e Mon Sep 17 00:00:00 2001 From: mengaims <50131889+mengaims@users.noreply.github.com> Date: Mon, 5 Feb 2024 12:04:17 +0800 Subject: [PATCH 07/13] remove customized category (#59) --- .../ContentSafety/models.tsp | 104 +--- .../ContentSafety/routes.tsp | 48 -- .../2023-10-30-preview/contentsafety.json | 529 ++---------------- 3 files changed, 52 insertions(+), 629 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index 6a57774db27e..a6afea1aa0bf 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -102,20 +102,6 @@ model AnalyzeTextOptions { @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The incidents to detect.") incidents?: IncidentOptions; - - @added(ContentSafety.Versions.v2023_10_30_Preview) - @doc("The customized categories will be analyzed. If they are not assigned, the analysis results for all available customized categories will be returned.") - customizedCategories?: CustomizedCategory[]; -} - -@added(ContentSafety.Versions.v2023_10_30_Preview) -@doc("Customized category for inference.") -model CustomizedCategory { - @doc("Category name") - categoryName: string; - - @doc("Model ID for the category. If not provided, the latest available model will be used.") - modelId: string; } @added(ContentSafety.Versions.v2023_10_30_Preview) @@ -143,29 +129,6 @@ model AnalyzeTextResult { @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("Chunks in the original text detected as harmful content. Analysis result and scores are caused by these.") citation?: string[]; - - @added(ContentSafety.Versions.v2023_10_30_Preview) - @doc("Analysis result for customized categories.") - customizedCategoriesAnalysis: TextCustomizedCategoryAnalysis[]; -} - -@added(ContentSafety.Versions.v2023_10_30_Preview) -@doc("Text customized category analysis result.") -model TextCustomizedCategoryAnalysis { - @doc("Customized category name") - categoryName: string; - - @doc("customized category analysis") - customizedCategoriesAnalysis: TextCustomizedCategoryClassResult[]; -} - -@added(ContentSafety.Versions.v2023_10_30_Preview) -@doc("customized category analysis result") -model TextCustomizedCategoryClassResult { - id: int32; - - @renamedFrom(Versions.v2023_10_30_Preview, "name") - className: string; } @doc("The result of blocklist match.") @@ -611,13 +574,9 @@ model PreDefinedConcept { @added(Versions.v2023_10_30_Preview) @doc("Label definition.") -@renamedFrom(Versions.v2023_10_30_Preview, "SubCategory") -model Class { +model SubCategory { id: int32; - - @renamedFrom(Versions.v2023_10_30_Preview, "name") - className: string; - + name: string; statements: string[]; } @@ -632,55 +591,12 @@ model TextCustomizedCategory { @maxLength(64) categoryName: string; - @doc("A predefined concept with its definition can be used directly in the subcategories.") - @added(Versions.v2023_10_30_Preview) - @removed(Versions.v2023_10_30_Preview) preDefinedConcepts?: PreDefinedConcept[]; - - @doc("Subcategories are detailed classes of the category. It is required there is a class 'safe' with id=0.") - @renamedFrom(Versions.v2023_10_30_Preview, "subCategories") - classes: Class[]; - - @added(Versions.v2023_10_30_Preview) - @removed(Versions.v2023_10_30_Preview) + subCategories: SubCategory[]; emphases?: string[]; - - @doc("Blob that stores the examples.") exampleBlobUrl?: url; } -@added(ContentSafety.Versions.v2023_10_30_Preview) -@doc("The response for async training triggering.") -model SubmitModelTrainingResponse { - ...AcceptedResponse; - - @header("operation-location") - @doc("The location of the status API for monitoring the triggered model.") - modelUrl: string; -} - -@added(ContentSafety.Versions.v2023_10_30_Preview) -model AsyncJobWarning { - code: string; - messgae: string; -} - -@added(ContentSafety.Versions.v2023_10_30_Preview) -@resource("text/generatePromptTasks") -model GeneratePromptTaskDetail { - @doc("The id of image batch analysis task.") - @key("taskId") - @visibility("read") - @maxLength(64) - taskId: string; - - @doc("The status of the batch image analysis task.") - status: GeneratePromptStatus; - - @doc("Return error detail when the task failed.") - error?: Azure.Core.Foundations.Error; -} - #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("ImageWithText analyze category.") @@ -691,20 +607,6 @@ enum ImageWithTextCategory { Violence, } -@added(ContentSafety.Versions.v2023_10_30_Preview) -@parentResource(TextCustomizedCategory) -@resource("models") -model TextTrainedModel { - @key - modelId: string; - - status: ModelStatus; - createdTime: utcDateTime; - lastUpdateTime: utcDateTime; - warnings?: AsyncJobWarning[]; - errors?: string[]; -} - @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The analysis request of the image with text.") model AnalyzeImageWithTextOptions { diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 0bfd27537200..668834065965 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -338,54 +338,6 @@ interface TextCategoryCustomization { TextCustomizedCategory, ListQueryParametersTrait >; - - @added(Versions.v2023_10_30_Preview) - @action("trainModel") - trainModel is CategoryOps.ResourceAction< - TextCustomizedCategory, - {}, - SubmitModelTrainingResponse - >; - - @added(ContentSafety.Versions.v2023_10_30_Preview) - @route("/text/categories/{categoryName}:generatePrompt") - @post - @summary("Trigger prompt generation") - @doc("An asynchronous API to generate prompt from customized category.") - generateCustomizedCategoryPrompt is ContentSafetyLongRunningRpcOperation< - { - @path - @doc("The customized category name.") - categoryName: string; - }, - GeneratePromptTaskDetail - >; - - @added(ContentSafety.Versions.v2023_10_30_Preview) - @summary("Get Generate Prompt Task Status") - @doc("Check the status of a generate prompt task.") - getGeneratePromptTaskStatus is Azure.Core.ResourceRead; -} - -interface TextCustomizedMdoelOps - extends Azure.Core.ResourceOperations {} - -@added(Versions.v2023_10_30_Preview) -interface TextCustomizedModelOperations { - @summary("List all existing models") - @doc("List existing models.") - listTextCustomizedModels is TextCustomizedMdoelOps.ResourceList< - TextTrainedModel, - ListQueryParametersTrait - >; - - @doc("Get a model that is not deleted.") - getTextCustomizedModels is TextCustomizedMdoelOps.ResourceRead; - - @doc("If the model is training, the training process will be cancelled and the model will also be deleted.") - deleteCustomizedModel is TextCustomizedMdoelOps.ResourceDelete; } @added(Versions.v2023_10_30_Preview) 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 9d266dce6be0..2a64da856833 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 @@ -1230,268 +1230,6 @@ } } }, - "/text/categories/{categoryName}:trainModel": { - "post": { - "operationId": "TextCategoryCustomization_TrainModel", - "description": "Resource action operation template.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "Text customizedCategories name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^Customized_[0-9A-Za-z._~-]+$" - } - ], - "responses": { - "202": { - "description": "The request has been accepted for processing, but processing has not yet completed.", - "headers": { - "operation-location": { - "type": "string", - "description": "The location of the status API for monitoring the triggered model." - } - } - }, - "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/categories/{categoryName}:generatePrompt": { - "post": { - "operationId": "TextCategoryCustomization_GenerateCustomizedCategoryPrompt", - "summary": "Trigger prompt generation", - "description": "An asynchronous API to generate prompt from customized category.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "The customized category name.", - "required": true, - "type": "string" - } - ], - "responses": { - "202": { - "description": "The request has been accepted for processing, but processing has not yet completed.", - "schema": { - "$ref": "#/definitions/GeneratePromptTaskDetail" - } - }, - "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/categories/{categoryName}/models": { - "get": { - "operationId": "TextCustomizedModelOperations_ListTextCustomizedModels", - "summary": "List all existing models", - "description": "List existing models.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "Text customizedCategories name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^Customized_[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/PagedTextTrainedModel" - } - }, - "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-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/text/categories/{categoryName}/models/{modelId}": { - "get": { - "operationId": "TextCustomizedModelOperations_GetTextCustomizedModels", - "description": "Get a model that is not deleted.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "Text customizedCategories name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^Customized_[0-9A-Za-z._~-]+$" - }, - { - "name": "modelId", - "in": "path", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/TextTrainedModel" - } - }, - "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." - } - } - } - } - }, - "delete": { - "operationId": "TextCustomizedModelOperations_DeleteCustomizedModel", - "description": "If the model is training, the training process will be cancelled and the model will also be deleted.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "categoryName", - "in": "path", - "description": "Text customizedCategories name.", - "required": true, - "type": "string", - "maxLength": 64, - "pattern": "^Customized_[0-9A-Za-z._~-]+$" - }, - { - "name": "modelId", - "in": "path", - "required": true, - "type": "string" - } - ], - "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." - } - } - } - } - } - }, - "/text/generatePromptTasks/{taskId}": { - "get": { - "operationId": "TextCategoryCustomization_GetGeneratePromptTaskStatus", - "summary": "Get Generate Prompt Task Status", - "description": "Check the status of a generate prompt task.", - "parameters": [ - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "taskId", - "in": "path", - "description": "The id of image batch analysis task.", - "required": true, - "type": "string", - "maxLength": 64 - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/GeneratePromptTaskDetail" - } - }, - "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/incidents": { "get": { "operationId": "TextIncidents_ListIncidents", @@ -2362,14 +2100,6 @@ "incidents": { "$ref": "#/definitions/IncidentOptions", "description": "The incidents to detect." - }, - "customizedCategories": { - "type": "array", - "description": "The customized categories will be analyzed. If they are not assigned, the analysis results for all available customized categories will be returned.", - "items": { - "$ref": "#/definitions/CustomizedCategory" - }, - "x-ms-identifiers": [] } }, "required": [ @@ -2461,19 +2191,10 @@ "items": { "type": "string" } - }, - "customizedCategoriesAnalysis": { - "type": "array", - "description": "Analysis result for customized categories.", - "items": { - "$ref": "#/definitions/TextCustomizedCategoryAnalysis" - }, - "x-ms-identifiers": [] } }, "required": [ - "categoriesAnalysis", - "customizedCategoriesAnalysis" + "categoriesAnalysis" ] }, "AnnotateTextOptions": { @@ -2518,21 +2239,6 @@ "name" ] }, - "AsyncJobWarning": { - "type": "object", - "properties": { - "code": { - "type": "string" - }, - "messgae": { - "type": "string" - } - }, - "required": [ - "code", - "messgae" - ] - }, "Azure.Core.Foundations.Error": { "type": "object", "description": "The error object.", @@ -2744,48 +2450,6 @@ ] } }, - "Class": { - "type": "object", - "description": "Label definition.", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "className": { - "type": "string" - }, - "statements": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "id", - "className", - "statements" - ] - }, - "CustomizedCategory": { - "type": "object", - "description": "Customized category for inference.", - "properties": { - "categoryName": { - "type": "string", - "description": "Category name" - }, - "modelId": { - "type": "string", - "description": "Model ID for the category. If not provided, the latest available model will be used." - } - }, - "required": [ - "categoryName", - "modelId" - ] - }, "DetectUngroundednessOptions": { "type": "object", "description": "The request of ungroundedness detection.", @@ -2873,41 +2537,6 @@ "modelAsString": true } }, - "GeneratePromptStatus": { - "type": "string", - "enum": [ - "Running", - "Ready", - "Failed" - ], - "x-ms-enum": { - "name": "GeneratePromptStatus", - "modelAsString": true - } - }, - "GeneratePromptTaskDetail": { - "type": "object", - "properties": { - "taskId": { - "type": "string", - "description": "The id of image batch analysis task.", - "maxLength": 64, - "readOnly": true - }, - "status": { - "$ref": "#/definitions/GeneratePromptStatus", - "description": "The status of the batch image analysis task." - }, - "error": { - "$ref": "#/definitions/Azure.Core.Foundations.Error", - "description": "Return error detail when the task failed." - } - }, - "required": [ - "taskId", - "status" - ] - }, "GptResource": { "type": "object", "description": "Connection details for the GPT resource.", @@ -3226,19 +2855,6 @@ "incidentSampleId" ] }, - "ModelStatus": { - "type": "string", - "enum": [ - "Created", - "Training", - "Ready", - "Failed" - ], - "x-ms-enum": { - "name": "ModelStatus", - "modelAsString": true - } - }, "PagedImageBatchTaskDetail": { "type": "object", "description": "Paged collection of ImageBatchTaskDetail items", @@ -3414,26 +3030,20 @@ "value" ] }, - "PagedTextTrainedModel": { + "PreDefinedConcept": { "type": "object", - "description": "Paged collection of TextTrainedModel items", + "description": "Pre-defined concept.", "properties": { - "value": { - "type": "array", - "description": "The TextTrainedModel items on this page", - "items": { - "$ref": "#/definitions/TextTrainedModel" - }, - "x-ms-identifiers": [] + "concept": { + "type": "string" }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" + "description": { + "type": "string" } }, "required": [ - "value" + "concept", + "description" ] }, "ProtectedMaterialAnalysisResult": { @@ -3497,6 +3107,30 @@ "incidentSampleIds" ] }, + "SubCategory": { + "type": "object", + "description": "Label definition.", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "statements": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "id", + "name", + "statements" + ] + }, "Task": { "type": "string", "description": "Task type.", @@ -3652,60 +3286,33 @@ "create" ] }, - "classes": { + "preDefinedConcepts": { "type": "array", - "description": "Subcategories are detailed classes of the category. It is required there is a class 'safe' with id=0.", "items": { - "$ref": "#/definitions/Class" - } + "$ref": "#/definitions/PreDefinedConcept" + }, + "x-ms-identifiers": [] }, - "exampleBlobUrl": { - "type": "string", - "format": "uri", - "description": "Blob that stores the examples." - } - }, - "required": [ - "categoryName", - "classes" - ] - }, - "TextCustomizedCategoryAnalysis": { - "type": "object", - "description": "Text customized category analysis result.", - "properties": { - "categoryName": { - "type": "string", - "description": "Customized category name" + "subCategories": { + "type": "array", + "items": { + "$ref": "#/definitions/SubCategory" + } }, - "customizedCategoriesAnalysis": { + "emphases": { "type": "array", - "description": "customized category analysis", "items": { - "$ref": "#/definitions/TextCustomizedCategoryClassResult" + "type": "string" } - } - }, - "required": [ - "categoryName", - "customizedCategoriesAnalysis" - ] - }, - "TextCustomizedCategoryClassResult": { - "type": "object", - "description": "customized category analysis result", - "properties": { - "id": { - "type": "integer", - "format": "int32" }, - "className": { - "type": "string" + "exampleBlobUrl": { + "type": "string", + "format": "uri" } }, "required": [ - "id", - "className" + "categoryName", + "subCategories" ] }, "TextIncident": { @@ -3791,44 +3398,6 @@ "incidentSampleId" ] }, - "TextTrainedModel": { - "type": "object", - "properties": { - "modelId": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/ModelStatus" - }, - "createdTime": { - "type": "string", - "format": "date-time" - }, - "lastUpdateTime": { - "type": "string", - "format": "date-time" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/definitions/AsyncJobWarning" - }, - "x-ms-identifiers": [] - }, - "errors": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "modelId", - "status", - "createdTime", - "lastUpdateTime" - ] - }, "UngroundedDetails": { "type": "object", "description": "The detailed information about a text identified as ungrounded.", From 9a375d467455b64d2d68c3cf5368451eb863f2fc Mon Sep 17 00:00:00 2001 From: MinjueWu <597922968@qq.com> Date: Mon, 5 Feb 2024 20:47:09 +0800 Subject: [PATCH 08/13] Update batch image API contract (#60) --- .../ContentSafety/models.tsp | 19 ++++++--- .../ContentSafety/routes.tsp | 12 +----- .../2023-10-30-preview/contentsafety.json | 41 ++++++++++++------- 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index a6afea1aa0bf..98072ea4cdf3 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -274,17 +274,24 @@ model ImageBatchTaskDetail { @doc("The status of the batch image analysis task.") status: BatchTaskStatus; + @doc("Batch task result.") + result: ImageBatchTaskResult; + + @doc("Return error detail when the task failed.") + error?: Azure.Core.Foundations.Error; +} + +@added(ContentSafety.Versions.v2023_10_30_Preview) +@doc("Image batch task result.") +model ImageBatchTaskResult { @doc("The timestamp of when batch image analysis task was created.") createdTime: utcDateTime; - @doc("The blob parameters of result files.") - analysisResults: BatchAnalyzeImagesResults; - @doc("The progress of the batch image analysis task, represented as a percentage (0-100).") progressPercentage: float32; - - @doc("Return error detail when the task failed.") - error?: Azure.Core.Foundations.Error; + + @doc("The blob parameters of result files.") + analysisResults: BatchAnalyzeImagesResults; } @doc("Text Blocklist.") diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 668834065965..5f2214596a08 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -87,7 +87,7 @@ interface ImageBatchOperations { @doc("An asynchronous API for the batch analysis of potentially harmful image content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.") @route("/image/batchAnalyses") @put - batchAnalyzeImage is ContentSafetyLongRunningRpcOperation< + batchAnalyzeImage is Azure.Core.RpcOperation< { @path @doc("The unique operation id.") @@ -114,16 +114,6 @@ interface ImageBatchOperations { >; } -@doc("Long running RPC operation template") -op ContentSafetyLongRunningRpcOperation< - TParams extends TypeSpec.Reflection.Model, - TResponse extends TypeSpec.Reflection.Model -> is Azure.Core.Foundations.Operation< - TParams, - Azure.Core.Foundations.AcceptedResponse & TResponse, - Azure.Core.Foundations.ErrorResponse ->; - interface BatchOps extends Azure.Core.ResourceOperations Date: Mon, 5 Feb 2024 20:49:22 +0800 Subject: [PATCH 09/13] Mengai/0130 private fix (#61) * remove customized category * remove useless definition --- .../cognitiveservices/ContentSafety/models.tsp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index 98072ea4cdf3..d75661231eb0 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -66,21 +66,6 @@ enum BatchTaskStatus { Succeeded, } -@added(ContentSafety.Versions.v2023_10_30_Preview) -enum ModelStatus { - Created, - Training, - Ready, - Failed, -} - -@added(ContentSafety.Versions.v2023_10_30_Preview) -enum GeneratePromptStatus { - Running, - Ready, - Failed, -} - @doc("The text analysis request.") model AnalyzeTextOptions { @doc("The text needs to be analyzed. We support a maximum of 10k Unicode characters (Unicode code points) in the text of one request.") From 12d34b1e647297c12fdcbfe7c6fd6317072d3967 Mon Sep 17 00:00:00 2001 From: mengaims <50131889+mengaims@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:40:37 +0800 Subject: [PATCH 10/13] Mengai/0130 private fix (#62) * remove customized category * remove useless definition * change progressPercentage to int32 --- specification/cognitiveservices/ContentSafety/models.tsp | 4 ++-- .../preview/2023-10-30-preview/contentsafety.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index d75661231eb0..723a63e3ead7 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -273,8 +273,8 @@ model ImageBatchTaskResult { createdTime: utcDateTime; @doc("The progress of the batch image analysis task, represented as a percentage (0-100).") - progressPercentage: float32; - + progressPercentage: int32; + @doc("The blob parameters of result files.") analysisResults: BatchAnalyzeImagesResults; } 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 61649344fdd0..edb8a2b184a6 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 @@ -2602,8 +2602,8 @@ "description": "The timestamp of when batch image analysis task was created." }, "progressPercentage": { - "type": "number", - "format": "float", + "type": "integer", + "format": "int32", "description": "The progress of the batch image analysis task, represented as a percentage (0-100)." }, "analysisResults": { From 967700a250de90632b5457ebee1048cdcde6b05f Mon Sep 17 00:00:00 2001 From: mengaims Date: Tue, 6 Feb 2024 20:40:09 +0800 Subject: [PATCH 11/13] Resolve warnings --- .../ContentSafety/models.tsp | 13 +++++++++++++ .../ContentSafety/routes.tsp | 6 +----- .../2023-10-30-preview/contentsafety.json | 19 ++++++++++++++----- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index 723a63e3ead7..5622b6892df6 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -560,15 +560,20 @@ model AnnotateTextResult { @added(Versions.v2023_10_30_Preview) @doc("Pre-defined concept.") model PreDefinedConcept { + @doc("The concept name.") concept: string; + @doc("The concept description.") description: string; } @added(Versions.v2023_10_30_Preview) @doc("Label definition.") model SubCategory { + @doc("The id of subcategory.") id: int32; + @doc("The name of subcategory.") name: string; + @doc("The description of subcategory.") statements: string[]; } @@ -583,9 +588,16 @@ model TextCustomizedCategory { @maxLength(64) categoryName: string; + @doc("Some pre defined concepts used in definition.") preDefinedConcepts?: PreDefinedConcept[]; + + @doc("Subcategories in the customized category.") subCategories: SubCategory[]; + + @doc("Text customizedCategories emphases.") emphases?: string[]; + + @doc("Text url of example jsonl blob.") exampleBlobUrl?: url; } @@ -649,6 +661,7 @@ enum Task { QnA, } +#suppress "@azure-tools/typespec-azure-core/casing-style" "MUST fix in next update" @added(Versions.v2023_10_30_Preview) @doc("Connection details for the GPT resource.") model GptResource { diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 5f2214596a08..9717ac575159 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -82,6 +82,7 @@ interface ImageOperations { } interface ImageBatchOperations { + #suppress "@azure-tools/typespec-azure-core/no-rpc-path-params" "MUST fix in next update" @added(ContentSafety.Versions.v2023_10_30_Preview) @summary("Start Batch Analyze Images") @doc("An asynchronous API for the batch analysis of potentially harmful image content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.") @@ -114,11 +115,6 @@ interface ImageBatchOperations { >; } -interface BatchOps - extends Azure.Core.ResourceOperations {} - interface BlockOps extends Azure.Core.ResourceOperations Date: Tue, 6 Feb 2024 21:21:19 +0800 Subject: [PATCH 12/13] Suppress spell check --- cSpell.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cSpell.json b/cSpell.json index 53edfde971f0..6425797918ff 100644 --- a/cSpell.json +++ b/cSpell.json @@ -966,7 +966,16 @@ "words": [ "throughputpool" ] - } + }, + { + "filename": "**/specification/cognitiveservices/data-plane/ContentSafety/**/*.json", + "words": [ + "Ungroundedness", + "ungroundedness", + "Selfharm", + "Withtext" + ] + } ], "enableFiletypes": [ "cadl" From e54dd6efb59574eaa60af9ec1d4060711a823258 Mon Sep 17 00:00:00 2001 From: mengaims Date: Thu, 8 Feb 2024 21:29:33 +0800 Subject: [PATCH 13/13] Renaming --- .../ContentSafety/models.tsp | 15 ++++++++----- .../2023-10-30-preview/contentsafety.json | 22 +++++++++---------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index 5622b6892df6..0b240407f367 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -202,7 +202,7 @@ model BatchAnalyzeImagesOptions { images: BatchAnalyzeImages; @doc("The blob parameters of result files.") - analysisResults: BatchAnalyzeImagesResults; + resultsBlob: BatchAnalyzeImagesResultsBlob; @doc("The storage mode for the batch task results, either 'CollectiveResultFile' or 'IndividualResultFiles'.") resultsStorageMode?: BatchResultsStorageMode = BatchResultsStorageMode.CollectiveResultFile; @@ -235,7 +235,7 @@ model BatchAnalyzeImages { @added(ContentSafety.Versions.v2023_10_30_Preview) @doc("The image batch analysis output.") -model BatchAnalyzeImagesResults { +model BatchAnalyzeImagesResultsBlob { @doc("The URL to a blob prefix which represents a directory. The analysis result file(s) will be written to this directory.") blobPrefixLocation: url; @@ -276,7 +276,7 @@ model ImageBatchTaskResult { progressPercentage: int32; @doc("The blob parameters of result files.") - analysisResults: BatchAnalyzeImagesResults; + resultsBlob: BatchAnalyzeImagesResultsBlob; } @doc("Text Blocklist.") @@ -562,18 +562,21 @@ model AnnotateTextResult { model PreDefinedConcept { @doc("The concept name.") concept: string; + @doc("The concept description.") description: string; } @added(Versions.v2023_10_30_Preview) @doc("Label definition.") -model SubCategory { +model Subcategory { @doc("The id of subcategory.") id: int32; + @doc("The name of subcategory.") name: string; - @doc("The description of subcategory.") + + @doc("The description of subcategory.") statements: string[]; } @@ -592,7 +595,7 @@ model TextCustomizedCategory { preDefinedConcepts?: PreDefinedConcept[]; @doc("Subcategories in the customized category.") - subCategories: SubCategory[]; + subcategories: Subcategory[]; @doc("Text customizedCategories emphases.") emphases?: string[]; 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 b38107059e5a..b613a90c48ce 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 @@ -2340,8 +2340,8 @@ "$ref": "#/definitions/BatchAnalyzeImages", "description": "The blob parameters of images to be analyzed." }, - "analysisResults": { - "$ref": "#/definitions/BatchAnalyzeImagesResults", + "resultsBlob": { + "$ref": "#/definitions/BatchAnalyzeImagesResultsBlob", "description": "The blob parameters of result files." }, "resultsStorageMode": { @@ -2368,10 +2368,10 @@ }, "required": [ "images", - "analysisResults" + "resultsBlob" ] }, - "BatchAnalyzeImagesResults": { + "BatchAnalyzeImagesResultsBlob": { "type": "object", "description": "The image batch analysis output.", "properties": { @@ -2606,15 +2606,15 @@ "format": "int32", "description": "The progress of the batch image analysis task, represented as a percentage (0-100)." }, - "analysisResults": { - "$ref": "#/definitions/BatchAnalyzeImagesResults", + "resultsBlob": { + "$ref": "#/definitions/BatchAnalyzeImagesResultsBlob", "description": "The blob parameters of result files." } }, "required": [ "createdTime", "progressPercentage", - "analysisResults" + "resultsBlob" ] }, "ImageCategoriesAnalysis": { @@ -3122,7 +3122,7 @@ "incidentSampleIds" ] }, - "SubCategory": { + "Subcategory": { "type": "object", "description": "Label definition.", "properties": { @@ -3312,11 +3312,11 @@ }, "x-ms-identifiers": [] }, - "subCategories": { + "subcategories": { "type": "array", "description": "Subcategories in the customized category.", "items": { - "$ref": "#/definitions/SubCategory" + "$ref": "#/definitions/Subcategory" } }, "emphases": { @@ -3334,7 +3334,7 @@ }, "required": [ "categoryName", - "subCategories" + "subcategories" ] }, "TextIncident": {