diff --git a/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/LUIS-Runtime.json b/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/LUIS-Runtime.json new file mode 100644 index 000000000000..7b4aff08332b --- /dev/null +++ b/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/LUIS-Runtime.json @@ -0,0 +1,531 @@ +{ + "swagger": "2.0", + "info": { + "version": "3.0-preview", + "title": "LUIS Runtime Client" + }, + "x-ms-parameterized-host": { + "hostTemplate": "{Endpoint}/luis/v3.0-preview", + "useSchemePrefix": false, + "parameters": [ + { + "$ref": "#/parameters/Endpoint" + } + ] + }, + "securityDefinitions": { + "apiKeyHeader": { + "type": "apiKey", + "name": "Ocp-Apim-Subscription-Key", + "in": "header" + } + }, + "security": [ + { + "apiKeyHeader": [] + } + ], + "paths": { + "/apps/{appId}/versions/{versionId}/predict": { + "get": { + "description": "Gets the predictions for an application version.", + "operationId": "Prediction_GetVersionPredictionGET", + "parameters": [ + { + "$ref": "#/parameters/AppIdInPath" + }, + { + "$ref": "#/parameters/VersionIdInPath" + }, + { + "$ref": "#/parameters/Query" + }, + { + "$ref": "#/parameters/Verbose" + }, + { + "$ref": "#/parameters/ShowAllIntents" + }, + { + "$ref": "#/parameters/Log" + } + ], + "responses": { + "200": { + "description": "The prediction for the supplied query", + "schema": { + "$ref": "#/definitions/PredictionResponse" + } + }, + "default": { + "description": "unexpected error", + "schema": { + "$ref": "#/definitions/Error" + } + } + }, + "produces": [ + "application/json" + ], + "x-ms-examples": { + "Successful Get Version Predictions From Endpoint Via Get request": { + "$ref": "./examples/prediction/SuccessfulGetVersionPredictionsFromEndpointViaGetRequest.json" + } + } + }, + "post": { + "description": "Gets the predictions for an application version.", + "operationId": "Prediction_GetVersionPrediction", + "parameters": [ + { + "$ref": "#/parameters/AppIdInPath" + }, + { + "$ref": "#/parameters/VersionIdInPath" + }, + { + "$ref": "#/parameters/Verbose" + }, + { + "$ref": "#/parameters/ShowAllIntents" + }, + { + "$ref": "#/parameters/Log" + }, + { + "$ref": "#/parameters/PredictionRequest" + } + ], + "responses": { + "200": { + "description": "The prediction for the supplied query", + "schema": { + "$ref": "#/definitions/PredictionResponse" + } + }, + "default": { + "description": "unexpected error", + "schema": { + "$ref": "#/definitions/Error" + } + } + }, + "produces": [ + "application/json" + ], + "x-ms-examples": { + "Successful Get Version Predictions From Endpoint Via Post request": { + "$ref": "./examples/prediction/SuccessfulGetVersionPredictionsFromEndpointViaPostRequest.json" + } + } + } + }, + "/apps/{appId}/slots/{slotName}/predict": { + "get": { + "description": "Gets the predictions for an application slot.", + "operationId": "Prediction_GetSlotPredictionGET", + "parameters": [ + { + "$ref": "#/parameters/AppIdInPath" + }, + { + "$ref": "#/parameters/SlotNameInPath" + }, + { + "$ref": "#/parameters/Query" + }, + { + "$ref": "#/parameters/Verbose" + }, + { + "$ref": "#/parameters/ShowAllIntents" + }, + { + "$ref": "#/parameters/Log" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "The prediction for the supplied query", + "schema": { + "$ref": "#/definitions/PredictionResponse" + } + }, + "default": { + "description": "unexpected error", + "schema": { + "$ref": "#/definitions/Error" + } + } + }, + "x-ms-examples": { + "Successful Get Slot Predictions From Endpoint Via Get request": { + "$ref": "./examples/prediction/SuccessfulGetSlotPredictionsFromEndpointViaGetRequest.json" + } + } + }, + "post": { + "description": "Gets the predictions for an application slot.", + "operationId": "Prediction_GetSlotPrediction", + "parameters": [ + { + "$ref": "#/parameters/AppIdInPath" + }, + { + "$ref": "#/parameters/SlotNameInPath" + }, + { + "$ref": "#/parameters/Verbose" + }, + { + "$ref": "#/parameters/ShowAllIntents" + }, + { + "$ref": "#/parameters/Log" + }, + { + "$ref": "#/parameters/PredictionRequest" + } + ], + "responses": { + "200": { + "description": "The prediction for the supplied query", + "schema": { + "$ref": "#/definitions/PredictionResponse" + } + }, + "default": { + "description": "unexpected error", + "schema": { + "$ref": "#/definitions/Error" + } + } + }, + "produces": [ + "application/json" + ], + "x-ms-examples": { + "Successful Get Slot Predictions From Endpoint Via Post request": { + "$ref": "./examples/prediction/SuccessfulGetSlotPredictionsFromEndpointViaPostRequest.json" + } + } + } + } + }, + "definitions": { + "PredictionRequest": { + "type": "object", + "description": "Represents the prediction request parameters.", + "required": [ + "query" + ], + "properties": { + "query": { + "description": "The query to predict", + "type": "string" + }, + "options": { + "description": "The custom options defined for this request.", + "$ref": "#/definitions/PredictionRequestOptions" + }, + "externalEntities": { + "description": "The externally predicted entities for this request", + "type": "array", + "items": { + "$ref": "#/definitions/ExternalEntity" + } + }, + "dynamicLists": { + "description": "The dynamically created list entities for this request", + "type": "array", + "items": { + "$ref": "#/definitions/DynamicList" + } + } + } + }, + "PredictionRequestOptions": { + "type": "object", + "description": "The custom options for the prediction request.", + "properties": { + "datetimeReference": { + "type": "string", + "format": "date-time", + "description": "The reference DateTime used for predicting datetime entities." + }, + "overridePredictions": { + "type": "boolean", + "description": "Whether to make the external entities resolution override the predictions if an overlap occurs." + } + } + }, + "PredictionResponse": { + "type": "object", + "description": "Represents the prediction response.", + "required": [ + "query", + "prediction" + ], + "properties": { + "query": { + "type": "string", + "description": "The query used in the prediction." + }, + "prediction": { + "description": "The prediction of the requested query.", + "$ref": "#/definitions/Prediction" + } + } + }, + "Prediction": { + "type": "object", + "description": "Represents the prediction of a query.", + "required": [ + "normalizedQuery", + "topIntent", + "intents", + "entities" + ], + "properties": { + "normalizedQuery": { + "type": "string", + "description": "The query after pre-processing and normalization." + }, + "alteredQuery": { + "type": "string", + "description": "The query after spell checking. Only set if spell check was enabled and a spelling mistake was found." + }, + "topIntent": { + "type": "string", + "description": "The name of the top scoring intent." + }, + "intents": { + "type": "object", + "description": "A dictionary representing the intents that fired.", + "additionalProperties": { + "$ref": "#/definitions/Intent" + } + }, + "entities": { + "type": "object", + "description": "The dictionary representing the entities that fired.", + "additionalProperties": {} + }, + "sentiment": { + "description": "The result of the sentiment analysis.", + "$ref": "#/definitions/Sentiment" + } + } + }, + "Intent": { + "type": "object", + "description": "Represents an intent prediction.", + "properties": { + "score": { + "type": "number", + "description": "The score of the fired intent." + }, + "childApp": { + "description": "The prediction of the dispatched application.", + "$ref": "#/definitions/Prediction" + } + } + }, + "Sentiment": { + "type": "object", + "description": "The result of the sentiment analaysis.", + "required": [ + "score" + ], + "properties": { + "score": { + "type": "number", + "description": "The sentiment score of the query." + }, + "label": { + "type": "string", + "description": "The label of the sentiment analysis result." + } + } + }, + "ExternalEntity": { + "type": "object", + "description": "Defines a user perdicted entity that extends an already existing one.", + "required": [ + "entityName", + "startIndex", + "entityLength" + ], + "properties": { + "entityName": { + "type": "string", + "description": "The name of the entity to extend." + }, + "startIndex": { + "type": "integer", + "description": "The start character index of the predicted entity." + }, + "entityLength": { + "type": "integer", + "description": "The length of the predicted entity." + }, + "resolution": { + "description": "A user supplied custom resolution to return as the entity's prediction." + } + } + }, + "DynamicList": { + "type": "object", + "description": "Defines an extension for a list entity.", + "required": [ + "listEntityName", + "requestLists" + ], + "properties": { + "listEntityName": { + "type": "string", + "description": "The name of the list entity to extend." + }, + "requestLists": { + "type": "array", + "description": "The lists to append on the extended list entity.", + "items": { + "$ref": "#/definitions/RequestList" + } + } + } + }, + "RequestList": { + "type": "object", + "description": "Defines a sub-list to append to an existing list entity.", + "required": [ + "canonicalForm" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the sub-list." + }, + "canonicalForm": { + "type": "string", + "description": "The canonical form of the sub-list." + }, + "synonyms": { + "type": "array", + "description": "The synonyms of the canonical form.", + "items": { + "type": "string" + } + } + } + }, + "Error": { + "type": "object", + "description": "Represents the error that occurred.", + "required": [ + "error" + ], + "properties": { + "error": { + "$ref": "#/definitions/ErrorBody" + } + } + }, + "ErrorBody": { + "type": "object", + "description": "Represents the definition of the error that occurred.", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "string", + "description": "The error code." + }, + "message": { + "type": "string", + "description": "The error message." + } + } + } + }, + "parameters": { + "AppIdInPath": { + "name": "appId", + "in": "path", + "required": true, + "type": "string", + "format": "uuid", + "description": "The application ID.", + "x-ms-parameter-location": "method" + }, + "VersionIdInPath": { + "name": "versionId", + "in": "path", + "description": "The application version ID.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "SlotNameInPath": { + "name": "slotName", + "in": "path", + "description": "The application slot name.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "Query": { + "name": "query", + "in": "query", + "description": "The query to predict.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "Verbose": { + "name": "verbose", + "in": "query", + "description": "Indicates whether to get extra metadata for the entities predictions or not.", + "type": "boolean", + "x-ms-parameter-location": "method" + }, + "ShowAllIntents": { + "name": "show-all-intents", + "in": "query", + "description": "Indicates whether to return all the intents in the response or just the top intent.", + "type": "boolean", + "x-ms-parameter-location": "method" + }, + "Log": { + "name": "log", + "in": "query", + "description": "Indicates whether to log the endpoint query or not.", + "type": "boolean", + "x-ms-parameter-location": "method" + }, + "PredictionRequest": { + "name": "predictionRequest", + "in": "body", + "description": "The prediction request parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/PredictionRequest" + }, + "x-ms-parameter-location": "method" + }, + "Endpoint": { + "name": "Endpoint", + "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).", + "x-ms-parameter-location": "client", + "required": true, + "type": "string", + "in": "path", + "x-ms-skip-url-encoding": true + } + } +} \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetSlotPredictionsFromEndpointViaGetRequest.json b/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetSlotPredictionsFromEndpointViaGetRequest.json new file mode 100644 index 000000000000..3105ad869ad5 --- /dev/null +++ b/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetSlotPredictionsFromEndpointViaGetRequest.json @@ -0,0 +1,47 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Ocp-Apim-Subscription-Key": "{Subscription Key}", + "appId": "{Application Id}", + "slotName": "{Slot Name}", + "query": "forward to frank 30 dollars through HSBC" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "query": "forward to frank 30 dollars through HSBC", + "prediction": { + "normalizedQuery": "forward to frank 30 dollars through hsbc", + "topIntent": "give", + "intents": { + "give": { + "score": 0.943442 + } + }, + "entities": { + "frank": [ + "frank" + ], + "number": [ + 30 + ], + "money": [ + { + "unit": "Dollar", + "value": 30 + } + ], + "Bank": [ + "HSBC" + ] + }, + "sentiment": { + "label": "positive", + "score": 0.9163064 + } + } + } + } + } +} \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetSlotPredictionsFromEndpointViaPostRequest.json b/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetSlotPredictionsFromEndpointViaPostRequest.json new file mode 100644 index 000000000000..d9fe1dca2d4f --- /dev/null +++ b/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetSlotPredictionsFromEndpointViaPostRequest.json @@ -0,0 +1,76 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Ocp-Apim-Subscription-Key": "{Subscription Key}", + "appId": "{Application Id}", + "slotName": "{Slot Name}", + "predictionRequest": { + "query": "forward to frank 30 dollars through HSBC", + "options": { + "datetimeReference": "2015-02-13T13:15:00" + }, + "externalEntities": [ + { + "entityName": "Bank", + "startIndex": 36, + "entityLength": 4, + "resolution": { + "text": "International Bank" + } + } + ], + "dynamicLists": [ + { + "listEntityName": "Employees", + "requestLists": [ + { + "name": "Management", + "canonicalForm": "Frank", + "synonyms": [] + } + ] + } + ] + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "query": "forward to frank 30 dollars through HSBC", + "prediction": { + "normalizedQuery": "forward to frank 30 dollars through hsbc", + "topIntent": "give", + "intents": { + "give": { + "score": 0.943442 + } + }, + "entities": { + "Employees": [ + [ "frank" ] + ], + "number": [ + 30 + ], + "money": [ + { + "unit": "Dollar", + "value": 30 + } + ], + "Bank": [ + { + "text": "International Bank" + } + ] + }, + "sentiment": { + "label": "positive", + "score": 0.9163064 + } + } + } + } + } +} \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetVersionPredictionsFromEndpointViaGetRequest.json b/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetVersionPredictionsFromEndpointViaGetRequest.json new file mode 100644 index 000000000000..2a930ca9fa8f --- /dev/null +++ b/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetVersionPredictionsFromEndpointViaGetRequest.json @@ -0,0 +1,49 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Ocp-Apim-Subscription-Key": "{Subscription Key}", + "appId": "{Application Id}", + "versionId": "{Version Id}", + "query": "forward to frank 30 dollars through HSBC" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "query": "forward to frank 30 dollars through HSBC", + "prediction": { + "normalizedQuery": "forward to frank 30 dollars through hsbc", + "topIntent": "give", + "intents": { + "give": { + "score": 0.943442 + } + }, + "entities": { + "Employees": [ + [ "frank" ] + ], + "number": [ + 30 + ], + "money": [ + { + "unit": "Dollar", + "value": 30 + } + ], + "Bank": [ + { + "text": "International Bank" + } + ] + }, + "sentiment": { + "label": "positive", + "score": 0.9163064 + } + } + } + } + } +} \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetVersionPredictionsFromEndpointViaPostRequest.json b/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetVersionPredictionsFromEndpointViaPostRequest.json new file mode 100644 index 000000000000..4188b3e2345c --- /dev/null +++ b/specification/cognitiveservices/data-plane/LUIS/Runtime/preview/v3.0/examples/prediction/SuccessfulGetVersionPredictionsFromEndpointViaPostRequest.json @@ -0,0 +1,76 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Ocp-Apim-Subscription-Key": "{Subscription Key}", + "appId": "{Application Id}", + "versionId": "{Version Id}", + "predictionRequest": { + "query": "forward to frank 30 dollars through HSBC", + "options": { + "datetimeReference": "2015-02-13T13:15:00" + }, + "externalEntities": [ + { + "entityName": "Bank", + "startIndex": 36, + "entityLength": 4, + "resolution": { + "text": "International Bank" + } + } + ], + "dynamicLists": [ + { + "listEntityName": "Employees", + "requestLists": [ + { + "name": "Management", + "canonicalForm": "Frank", + "synonyms": [] + } + ] + } + ] + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "query": "forward to frank 30 dollars through HSBC", + "prediction": { + "normalizedQuery": "forward to frank 30 dollars through hsbc", + "topIntent": "give", + "intents": { + "give": { + "score": 0.943442 + } + }, + "entities": { + "Employees": [ + [ "frank" ] + ], + "number": [ + 30 + ], + "money": [ + { + "unit": "Dollar", + "value": 30 + } + ], + "Bank": [ + { + "text": "International Bank" + } + ] + }, + "sentiment": { + "label": "positive", + "score": 0.9163064 + } + } + } + } + } +} \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.go.md b/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.go.md index 810dbbba0f0b..ca2fd7b2b082 100644 --- a/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.go.md +++ b/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.go.md @@ -23,4 +23,13 @@ Please also specify `--go-sdk-folder=`. + +``` yaml $(tag) == 'runtime_3_0_preview' && $(go) +output-folder: $(go-sdk-folder)/services/cognitiveservices/v3.0-preview/luis/$(namespace) ``` \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md b/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md index 2ffe8859e39a..4e421b6bea24 100644 --- a/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md +++ b/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md @@ -25,6 +25,18 @@ directive: remove-operation: Prediction_Resolve2 ``` +## Runtime 3.0-preview +These settings apply only when `--tag=runtime_3_0_preview` is specified on the command line. + +``` yaml $(tag) == 'runtime_3_0_preview' +input-file: preview/v3.0/LUIS-Runtime.json + +# remove the GET APIs from code-generation (since the POST and GET operations are functionally identical) +directive: + - remove-operation: Prediction_GetSlotPredictionGET + - remove-operation: Prediction_GetVersionPredictionGET +``` + --- # Code Generation