forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QuestionAnswering Preview.1 APIs (Azure#15304) (Azure#15717)
* QuestionAnswering Preview.1 APIs * fix build
- Loading branch information
Showing
25 changed files
with
3,007 additions
and
0 deletions.
There are no files selected for viewing
206 changes: 206 additions & 0 deletions
206
specification/cognitiveservices/data-plane/Language/preview/2021-05-01-preview/common.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"title": "Microsoft Cognitive Language Service", | ||
"description": "The language service API is a suite of natural language processing (NLP) skills built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction, language detection and question answering. Further documentation can be found in <a href=\"https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview\">https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview</a>.", | ||
"version": "2021-05-01-preview" | ||
}, | ||
"paths": {}, | ||
"definitions": { | ||
"ErrorResponse": { | ||
"type": "object", | ||
"description": "Error response.", | ||
"additionalProperties": false, | ||
"properties": { | ||
"error": { | ||
"description": "The error object.", | ||
"$ref": "#/definitions/Error" | ||
} | ||
} | ||
}, | ||
"Error": { | ||
"type": "object", | ||
"description": "The error object.", | ||
"additionalProperties": false, | ||
"required": [ | ||
"code", | ||
"message" | ||
], | ||
"properties": { | ||
"code": { | ||
"description": "One of a server-defined set of error codes.", | ||
"$ref": "#/definitions/ErrorCode" | ||
}, | ||
"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/Error" | ||
} | ||
}, | ||
"innererror": { | ||
"description": "An object containing more specific information than the current object about the error.", | ||
"$ref": "#/definitions/InnerErrorModel" | ||
} | ||
} | ||
}, | ||
"InnerErrorModel": { | ||
"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.", | ||
"additionalProperties": false, | ||
"required": [ | ||
"code", | ||
"message" | ||
], | ||
"properties": { | ||
"code": { | ||
"description": "One of a server-defined set of error codes.", | ||
"$ref": "#/definitions/InnerErrorCode" | ||
}, | ||
"message": { | ||
"type": "string", | ||
"description": "Error message." | ||
}, | ||
"details": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
}, | ||
"description": "Error details." | ||
}, | ||
"target": { | ||
"type": "string", | ||
"description": "Error target." | ||
}, | ||
"innererror": { | ||
"description": "An object containing more specific information than the current object about the error.", | ||
"$ref": "#/definitions/InnerErrorModel" | ||
} | ||
} | ||
}, | ||
"ErrorCode": { | ||
"type": "string", | ||
"description": "Human-readable error code.", | ||
"x-ms-enum": { | ||
"name": "ErrorCode", | ||
"modelAsString": true | ||
}, | ||
"enum": [ | ||
"InvalidRequest", | ||
"InvalidArgument", | ||
"Unauthorized", | ||
"Forbidden", | ||
"NotFound", | ||
"TooManyRequests", | ||
"InternalServerError", | ||
"ServiceUnavailable" | ||
] | ||
}, | ||
"InnerErrorCode": { | ||
"type": "string", | ||
"description": "Human-readable error code.", | ||
"x-ms-enum": { | ||
"name": "InnerErrorCode", | ||
"modelAsString": true | ||
}, | ||
"enum": [ | ||
"InvalidRequest", | ||
"InvalidParameterValue", | ||
"KnowledgeBaseNotFound", | ||
"AzureCognitiveSearchNotFound", | ||
"AzureCognitiveSearchThrottling", | ||
"ExtractionFailure" | ||
] | ||
}, | ||
"Language": { | ||
"type": "string", | ||
"description": "Language of the text records. This is BCP-47 representation of a language. For example, use \"en\" for English; \"es\" for Spanish etc. If not set, use \"en\" for English as default." | ||
}, | ||
"StringIndexType": { | ||
"type": "string", | ||
"description": "Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets.", | ||
"default": "TextElements_v8", | ||
"enum": [ | ||
"TextElements_v8", | ||
"UnicodeCodePoint", | ||
"Utf16CodeUnit" | ||
], | ||
"x-ms-enum": { | ||
"name": "StringIndexType", | ||
"modelAsString": true, | ||
"values": [ | ||
{ | ||
"value": "TextElements_v8", | ||
"description": "Returned offset and length values will correspond to TextElements (Graphemes and Grapheme clusters) confirming to the Unicode 8.0.0 standard. Use this option if your application is written in .Net Framework or .Net Core and you will be using StringInfo." | ||
}, | ||
{ | ||
"value": "UnicodeCodePoint", | ||
"description": "Returned offset and length values will correspond to Unicode code points. Use this option if your application is written in a language that support Unicode, for example Python." | ||
}, | ||
{ | ||
"value": "Utf16CodeUnit", | ||
"description": "Returned offset and length values will correspond to UTF-16 code units. Use this option if your application is written in a language that support Unicode, for example Java, JavaScript." | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"parameters": { | ||
"Endpoint": { | ||
"name": "Endpoint", | ||
"description": "Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com).", | ||
"x-ms-parameter-location": "client", | ||
"required": true, | ||
"type": "string", | ||
"in": "path", | ||
"x-ms-skip-url-encoding": true | ||
}, | ||
"ProjectNameQueryParameter": { | ||
"name": "projectName", | ||
"in": "query", | ||
"required": true, | ||
"type": "string", | ||
"description": "The name of the project to use.", | ||
"x-ms-parameter-location": "method" | ||
}, | ||
"ProjectNamePathParameter": { | ||
"name": "projectName", | ||
"in": "path", | ||
"required": true, | ||
"type": "string", | ||
"description": "The name of the project to use.", | ||
"x-ms-parameter-location": "method" | ||
}, | ||
"DeploymentNameQueryParameter": { | ||
"name": "deploymentName", | ||
"in": "query", | ||
"required": false, | ||
"type": "string", | ||
"description": "The name of the specific deployment of the project to use.", | ||
"x-ms-parameter-location": "method" | ||
}, | ||
"DeploymentNamePathParameter": { | ||
"name": "deploymentName", | ||
"in": "path", | ||
"required": true, | ||
"type": "string", | ||
"description": "The name of the specific deployment of the project to use.", | ||
"x-ms-parameter-location": "method" | ||
}, | ||
"ApiVersionParameter": { | ||
"name": "api-version", | ||
"in": "query", | ||
"required": true, | ||
"type": "string", | ||
"description": "Client API version." | ||
} | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
.../preview/2021-05-01-preview/examples/questionanswering/SuccessfulQueryKnowledgebases.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"parameters": { | ||
"Endpoint": "{Endpoint}", | ||
"Ocp-Apim-Subscription-Key": "{API key}", | ||
"Content-Type": "application/json", | ||
"api-version": "2021-05-01-preview", | ||
"projectName": "proj1", | ||
"deploymentName": "production", | ||
"knowledgeBaseQueryOptions": { | ||
"question": "how long it takes to charge surface?", | ||
"top": 3, | ||
"userId": "sd53lsY=", | ||
"confidenceScoreThreshold": 0.20, | ||
"context": { | ||
"previousQnaId": 9, | ||
"previousUserQuery": "Where are QnA Maker quickstarts?" | ||
}, | ||
"rankerType": "Default", | ||
"strictFilters": { | ||
"metadataFilter": { | ||
"metadata": { | ||
"category": "api", | ||
"editorial": "chitchat" | ||
}, | ||
"compoundOperation": "AND" | ||
}, | ||
"sourceFilter": [ | ||
"filename1.pdf", | ||
"https://www.wikipedia.org/microsoft" | ||
], | ||
"compoundOperation": "AND" | ||
}, | ||
"answerSpanRequest": { | ||
"enable": true, | ||
"confidenceScoreThreshold": 0.20, | ||
"topAnswersWithSpan": 1 | ||
}, | ||
"includeUnstructuredSources": true | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"headers": {}, | ||
"body": { | ||
"answers": [ | ||
{ | ||
"questions": [ | ||
"Power and charging" | ||
], | ||
"answer": "Power and charging**\n\nIt takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you’re using your Surface for power-intensive activities like gaming or video streaming while you’re charging it.\n\nYou can use the USB port on your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB port on your Surface.", | ||
"confidenceScore": 0.65, | ||
"id": 20, | ||
"source": "surface-pro-4-user-guide-EN.pdf", | ||
"metadata": { | ||
"category": "api", | ||
"editorial": "chitchat" | ||
}, | ||
"dialog": { | ||
"isContextOnly": false, | ||
"prompts": [ | ||
{ | ||
"displayOrder": 1, | ||
"qnaId": 23, | ||
"displayText": "prompt1" | ||
}, | ||
{ | ||
"displayOrder": 2, | ||
"qnaId": 36, | ||
"displayText": "prompt2" | ||
} | ||
] | ||
}, | ||
"answerSpan": { | ||
"text": "two to four hours", | ||
"confidenceScore": 0.30, | ||
"offset": 33, | ||
"length": 50 | ||
} | ||
}, | ||
{ | ||
"questions": [ | ||
"Charge your Surface Pro 4" | ||
], | ||
"answer": "**Charge your Surface Pro 4**\n\n1. Connect the two parts of the power cord.\n\n2. Connect the power cord securely to the charging port.\n\n3. Plug the power supply into an electrical outlet.", | ||
"confidenceScore": 0.32, | ||
"id": 13, | ||
"source": "surface-pro-4-user-guide-EN.pdf" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...e/Language/preview/2021-05-01-preview/examples/questionanswering/SuccessfulQueryText.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"parameters": { | ||
"Endpoint": "{Endpoint}", | ||
"Ocp-Apim-Subscription-Key": "{API key}", | ||
"Content-Type": "application/json", | ||
"api-version": "2021-05-01-preview", | ||
"stringIndexType": "TextElements_v8", | ||
"textQueryOptions": { | ||
"question": "how long it takes to charge surface?", | ||
"records": [ | ||
{ | ||
"id": "1", | ||
"text": "Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you’re using your Surface for power-intensive activities like gaming or video streaming while you’re charging it." | ||
}, | ||
{ | ||
"id": "2", | ||
"text": "You can use the USB port on your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB port on your Surface." | ||
} | ||
], | ||
"language": "en" | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"headers": {}, | ||
"body": { | ||
"answers": [ | ||
{ | ||
"answer": "Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you’re using your Surface for power-intensive activities like gaming or video streaming while you’re charging it.", | ||
"confidenceScore": 0.93, | ||
"id": "1", | ||
"answerSpan": { | ||
"text": "two to four hours", | ||
"confidenceScore": 0, | ||
"offset": 28, | ||
"length": 45 | ||
}, | ||
"offset": 0, | ||
"length": 224 | ||
}, | ||
{ | ||
"answer": "It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you’re using your Surface for power-intensive activities like gaming or video streaming while you’re charging it.", | ||
"confidenceScore": 0.92, | ||
"id": "1", | ||
"answerSpan": { | ||
"text": "two to four hours", | ||
"confidenceScore": 0, | ||
"offset": 8, | ||
"length": 25 | ||
}, | ||
"offset": 20, | ||
"length": 224 | ||
}, | ||
{ | ||
"answer": "It can take longer if you’re using your Surface for power-intensive activities like gaming or video streaming while you’re charging it.", | ||
"confidenceScore": 0.05, | ||
"id": "1", | ||
"answerSpan": null, | ||
"offset": 110, | ||
"length": 244 | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.