From 472892b0addc164993e68f48fb2629c664c08065 Mon Sep 17 00:00:00 2001 From: Abigail Hartman Date: Thu, 17 Mar 2022 15:24:38 -0700 Subject: [PATCH] Language API for TA (2022-03-01-preview) (#17281) * Add blockchain to latest profile * Add additional types * WIP for language api spec for TA * Updated preview version number; finished up async definitions * Finished first draft of full spec * Finished first draft of full spec, minus FHIR structuring in HC output * Removed features not included in 2021-11-01 preview * Update custom text tasks TODOs * Moved common definitions to TA-specific definitions * Added custom text tasks to JobManifest * Addressing feedback from PR comments and internal review * Addressed some PR comments * Updated some remaining references to documents * PR comments * Updated a previous change * Reverted references to 'records' back to 'documents' * A few small updates to examples; removed base Task type to simplify structure * PR comments * Addressed TODO items; removed LD-related objects (will be added in another preview) * Fixed anonymous types * Removed required field for body in POST request * Fix prettier check * Added a few more details; experimental change for documents property * Ran prettier * Correction to AnalysisInput object * Merged changes from 2021-11-01-preview and moved new changes to 2022-02-01 * PR comments * Updates to the design for tasks * Added custom entities task to examples * Updates * Finished implementation of discriminator pattern and added some exmaples * Updates * Prettier * Fixed semantic validation errors * Fixed model validation * Another model validation fix * Debugging model validation errors * Using a different discriminator enum for output schemas * Fixed some missing discriminator updates * More semantic validation fixes * Fixed model validation errors; updated sample names * Fixed linting errors and addressed some warnings in the linter output * Ran prettier on examples * PR comments and some minor restructuring * Ran prettier * Removed a duplicate schema from CustomEntitiesTaskParameters * PR comments * PR comments * PR comments * Added missing job task status 'partiallySucceeded' * Added preview folder for 2022-03-01-preview * Added delete and cancel operations for jobs * Added some examples for delete and cancel; updated samples for new preview * Incorporating feedback from the API review * fix naming consistency (#1) * naming updates * fix typo * Fixed one last merge conflict * naming fix (#2) * Fixed a ref * Ran prettier on all files Co-authored-by: Mark Cowlishaw Co-authored-by: Abigail Hartman Co-authored-by: Kareem Yousef Co-authored-by: Abby Hartman Co-authored-by: Mohamed Shaban --- ...uccessfulAnalyzeTextJobsCancelRequest.json | 15 ++++ .../2022-03-01-preview/textanalytics.json | 87 +++++++++++++------ 2 files changed, 77 insertions(+), 25 deletions(-) create mode 100644 specification/cognitiveservices/data-plane/Language/preview/2022-03-01-preview/examples/SuccessfulAnalyzeTextJobsCancelRequest.json diff --git a/specification/cognitiveservices/data-plane/Language/preview/2022-03-01-preview/examples/SuccessfulAnalyzeTextJobsCancelRequest.json b/specification/cognitiveservices/data-plane/Language/preview/2022-03-01-preview/examples/SuccessfulAnalyzeTextJobsCancelRequest.json new file mode 100644 index 000000000000..06b3dbf3eaf6 --- /dev/null +++ b/specification/cognitiveservices/data-plane/Language/preview/2022-03-01-preview/examples/SuccessfulAnalyzeTextJobsCancelRequest.json @@ -0,0 +1,15 @@ +{ + "parameters": { + "Ocp-Apim-Subscription-Key": "{API key}", + "ApiVersion": "2022-03-01-preview", + "Endpoint": "{Endpoint}", + "jobId": "c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18" + }, + "responses": { + "202": { + "headers": { + "Operation-Location": "{Endpoint}/language/analyze-text/jobs/{jobId}?api-version=2022-03-01-preview" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/Language/preview/2022-03-01-preview/textanalytics.json b/specification/cognitiveservices/data-plane/Language/preview/2022-03-01-preview/textanalytics.json index 45ef9f7079a9..ffab80a53342 100644 --- a/specification/cognitiveservices/data-plane/Language/preview/2022-03-01-preview/textanalytics.json +++ b/specification/cognitiveservices/data-plane/Language/preview/2022-03-01-preview/textanalytics.json @@ -186,6 +186,43 @@ } } } + }, + "/analyze-text/jobs/{jobId}:cancel": { + "post": { + "produces": [ + "application/json" + ], + "description": "Cancel a long-running Text Analysis job.", + "operationId": "AnalyzeText_CancelJob", + "summary": "Cancel a long-running Text Analysis job", + "parameters": [ + { + "$ref": "#/parameters/JobId" + } + ], + "responses": { + "202": { + "description": "Cancel Job request has been received.", + "headers": { + "Operation-Location": { + "type": "string" + } + } + }, + "default": { + "description": "Unexpected error", + "schema": { + "$ref": "common.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful Job Delete Request": { + "$ref": ".//examples//SuccessfulAnalyzeTextJobsCancelRequest.json" + } + }, + "x-ms-long-running-operation": true + } } }, "definitions": { @@ -217,8 +254,8 @@ "Healthcare", "ExtractiveSummarization", "CustomEntityRecognition", - "CustomSingleClassification", - "CustomMultiClassification" + "CustomSingleLabelClassification", + "CustomMultiLabelClassification" ], "x-ms-enum": { "name": "AnalyzeTextLROTaskKind", @@ -253,8 +290,8 @@ "HealthcareLROResults", "ExtractiveSummarizationLROResults", "CustomEntityRecognitionLROResults", - "CustomSingleClassificationLROResults", - "CustomMultiClassificationLROResults" + "CustomSingleLabelClassificationLROResults", + "CustomMultiLabelClassificationLROResults" ], "x-ms-enum": { "name": "AnalyzeTextLROResultsKind", @@ -594,7 +631,7 @@ "documents" ] }, - "CustomSingleClassificationTaskParameters": { + "CustomSingleLabelClassificationTaskParameters": { "type": "object", "description": "Supported parameters for a Custom Single Classification task.", "allOf": [ @@ -603,12 +640,12 @@ } ] }, - "CustomSingleClassificationLROTask": { + "CustomSingleLabelClassificationLROTask": { "type": "object", "description": "Use custom models to classify text into single label taxonomy", "properties": { "parameters": { - "$ref": "#/definitions/CustomSingleClassificationTaskParameters" + "$ref": "#/definitions/CustomSingleLabelClassificationTaskParameters" } }, "allOf": [ @@ -616,9 +653,9 @@ "$ref": "#/definitions/AnalyzeTextLROTask" } ], - "x-ms-discriminator-value": "CustomSingleClassification" + "x-ms-discriminator-value": "CustomSingleLabelClassification" }, - "CustomSingleClassificationResult": { + "CustomSingleLabelClassificationResult": { "type": "object", "properties": { "documents": { @@ -645,7 +682,7 @@ "SingleClassificationDocumentResult": { "type": "object", "properties": { - "classification": { + "class": { "$ref": "#/definitions/ClassificationResult" } }, @@ -655,7 +692,7 @@ } ], "required": [ - "classification" + "class" ] }, "ClassificationResult": { @@ -672,11 +709,11 @@ "confidenceScore": { "type": "number", "format": "double", - "description": "Confidence score between 0 and 1 of the recognized classification." + "description": "Confidence score between 0 and 1 of the recognized class." } } }, - "CustomMultiClassificationTaskParameters": { + "CustomMultiLabelClassificationTaskParameters": { "type": "object", "description": "Supported parameters for a Custom Multi Classification task.", "allOf": [ @@ -685,12 +722,12 @@ } ] }, - "CustomMultiClassificationLROTask": { + "CustomMultiLabelClassificationLROTask": { "type": "object", "description": "Use custom models to classify text into multi label taxonomy", "properties": { "parameters": { - "$ref": "#/definitions/CustomMultiClassificationTaskParameters" + "$ref": "#/definitions/CustomMultiLabelClassificationTaskParameters" } }, "allOf": [ @@ -698,9 +735,9 @@ "$ref": "#/definitions/AnalyzeTextLROTask" } ], - "x-ms-discriminator-value": "CustomMultiClassification" + "x-ms-discriminator-value": "CustomMultiLabelClassification" }, - "CustomMultiClassificationResult": { + "CustomMultiLabelClassificationResult": { "type": "object", "properties": { "documents": { @@ -727,7 +764,7 @@ "MultiClassificationDocumentResult": { "type": "object", "properties": { - "classifications": { + "class": { "type": "array", "items": { "$ref": "#/definitions/ClassificationResult" @@ -740,7 +777,7 @@ } ], "required": [ - "classifications" + "class" ] }, "HealthcareTaskParameters": { @@ -2524,11 +2561,11 @@ ], "x-ms-discriminator-value": "CustomEntityRecognitionLROResults" }, - "CustomSingleClassificationLROResult": { + "CustomSingleLabelClassificationLROResult": { "type": "object", "properties": { "results": { - "$ref": "#/definitions/CustomSingleClassificationResult" + "$ref": "#/definitions/CustomSingleLabelClassificationResult" } }, "allOf": [ @@ -2539,13 +2576,13 @@ "required": [ "results" ], - "x-ms-discriminator-value": "CustomSingleClassificationLROResults" + "x-ms-discriminator-value": "CustomSingleLabelClassificationLROResults" }, - "CustomMultiClassificationLROResult": { + "CustomMultiLabelClassificationLROResult": { "type": "object", "properties": { "results": { - "$ref": "#/definitions/CustomMultiClassificationResult" + "$ref": "#/definitions/CustomMultiLabelClassificationResult" } }, "allOf": [ @@ -2556,7 +2593,7 @@ "required": [ "results" ], - "x-ms-discriminator-value": "CustomMultiClassificationLROResults" + "x-ms-discriminator-value": "CustomMultiLabelClassificationLROResults" }, "EntityLinkingLROResult": { "type": "object",