From 744b4761c31359643a8c88293e2cb0904397ac73 Mon Sep 17 00:00:00 2001 From: Mohamed Abbas Date: Mon, 29 Apr 2019 21:03:48 +0200 Subject: [PATCH 1/5] Update LUIS SDK to support APIs v3.0-preview --- .../Language/LUIS/Runtime.Tests/BaseTest.cs | 2 +- .../Runtime.Tests/Luis/PredictionTests.cs | 210 +++++++- ...n_AppNotFound_ThrowsAPIErrorException.json | 66 +++ ...on_InvalidKey_ThrowsAPIErrorException.json | 51 -- ..._NullQuery_ThrowsValidationException.json} | 0 .../Prediction_Post.json | 60 --- .../Prediction_Slot.json | 66 +++ .../Prediction_Version.json | 66 +++ .../Prediction_WithSpellCheck.json | 63 --- .../Runtime/Generated/ILUISRuntimeClient.cs | 4 +- .../LUIS/Runtime/Generated/IPrediction.cs | 70 --- .../Generated/IPredictionOperations.cs | 104 ++++ .../Runtime/Generated/LUISRuntimeClient.cs | 8 +- ...CompositeEntityModel.cs => DynamicList.cs} | 59 +-- .../Runtime/Generated/Models/EntityModel.cs | 110 ---- .../Generated/Models/EntityWithResolution.cs | 76 --- .../Generated/Models/EntityWithScore.cs | 80 --- .../Models/{APIError.cs => Error.cs} | 42 +- .../{CompositeChildModel.cs => ErrorBody.cs} | 40 +- ...APIErrorException.cs => ErrorException.cs} | 18 +- .../Generated/Models/ExternalEntity.cs | 93 ++++ .../Models/{IntentModel.cs => Intent.cs} | 44 +- .../Runtime/Generated/Models/LuisResult.cs | 157 ------ .../Runtime/Generated/Models/Prediction.cs | 140 ++++++ .../Generated/Models/PredictionRequest.cs | 114 +++++ .../Models/PredictionRequestOptions.cs | 64 +++ .../Generated/Models/PredictionResponse.cs | 82 +++ .../Runtime/Generated/Models/RequestList.cs | 84 ++++ .../Runtime/Generated/Models/Sentiment.cs | 35 +- .../LUIS/Runtime/Generated/Prediction.cs | 278 ----------- .../Runtime/Generated/PredictionExtensions.cs | 65 --- .../Runtime/Generated/PredictionOperations.cs | 468 ++++++++++++++++++ .../PredictionOperationsExtensions.cs | 97 ++++ .../Generated/SdkInfo_LUISRuntimeClient.cs | 13 +- .../Language/LUIS/Runtime/generate.ps1 | 2 +- ...nitiveservices_data-plane_LUIS_Runtime.txt | 6 +- 36 files changed, 1775 insertions(+), 1162 deletions(-) create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_AppNotFound_ThrowsAPIErrorException.json delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_InvalidKey_ThrowsAPIErrorException.json rename src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/{Prediction_QueryTooLong_ThrowsValidationException.json => Prediction_NullQuery_ThrowsValidationException.json} (100%) delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Post.json create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Slot.json create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Version.json delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_WithSpellCheck.json delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPrediction.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPredictionOperations.cs rename src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/{CompositeEntityModel.cs => DynamicList.cs} (52%) delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityModel.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityWithResolution.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityWithScore.cs rename src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/{APIError.cs => Error.cs} (51%) rename src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/{CompositeChildModel.cs => ErrorBody.cs} (61%) rename src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/{APIErrorException.cs => ErrorException.cs} (71%) create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/ExternalEntity.cs rename src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/{IntentModel.cs => Intent.cs} (53%) delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/LuisResult.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Prediction.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionRequest.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionRequestOptions.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionResponse.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/RequestList.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Prediction.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionExtensions.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionOperations.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionOperationsExtensions.cs diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/BaseTest.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/BaseTest.cs index bcada61f9fb2..e59bc5d456b9 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/BaseTest.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/BaseTest.cs @@ -13,7 +13,7 @@ public abstract class BaseTest { private const HttpRecorderMode mode = HttpRecorderMode.Playback; - protected const string appId = "86226c53-b7a6-416f-876b-226b2b5ab07b"; + protected const string appId = "0894d430-8f00-4bcd-8153-45e06a1feca1"; protected const string subscriptionKey = "00000000000000000000000000000000"; private string ClassName => GetType().FullName; diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/Luis/PredictionTests.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/Luis/PredictionTests.cs index ded0813b0af0..5fcbb13ac1ea 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/Luis/PredictionTests.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/Luis/PredictionTests.cs @@ -1,68 +1,238 @@ namespace LUIS.Runtime.Tests { - using System.Collections.Generic; + using System; + using System.Linq; using Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime; using Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models; using Microsoft.Rest; + using Newtonsoft.Json.Linq; using Xunit; public class PredictionTests : BaseTest { [Fact] - public void Prediction_Post() + public void Prediction_Slot() { UseClientFor(async client => { - var utterance = "this is a test with post"; - var result = await client.Prediction.ResolveAsync(System.Guid.Parse(appId), utterance); + var utterance = "today this is a test with post"; + var slotName = "production"; - Assert.Equal("None", result.TopScoringIntent.Intent); + var requestOptions = new PredictionRequestOptions + { + DatetimeReference = DateTime.Parse("2019-01-01"), + OverridePredictions = true + }; + + var externalResolution = JObject.FromObject(new { text = "post", external = true }); + var externalEntities = new[] + { + new ExternalEntity + { + EntityName = "simple", + StartIndex = 26, + EntityLength = 4, + Resolution = externalResolution + } + }; + + var dynamicLists = new[] + { + new DynamicList + { + ListEntityName = "list", + RequestLists = new[] + { + new RequestList + { + Name = "test", + CanonicalForm = "testing", + Synonyms = new[] { "this" } + } + } + } + }; + + var predictionRequest = new PredictionRequest + { + Query = utterance, + Options = requestOptions, + ExternalEntities = externalEntities, + DynamicLists = dynamicLists + }; + + var result = await client.Prediction.GetSlotPredictionAsync( + Guid.Parse(appId), + slotName, + predictionRequest, + verbose: true, + showAllIntents: true); + + var prediction = result.Prediction; Assert.Equal(utterance, result.Query); + Assert.Equal(utterance, prediction.NormalizedQuery); + Assert.Equal("intent", prediction.TopIntent); + Assert.Equal(2, prediction.Intents.Count); + Assert.Equal(4, prediction.Entities.Count); + Assert.Contains("datetimeV2", prediction.Entities.Keys); + Assert.Contains("simple", prediction.Entities.Keys); + Assert.Contains("list", prediction.Entities.Keys); + Assert.Contains("$instance", prediction.Entities.Keys); + + // Test external resolution + var actualResolution = (prediction.Entities["simple"] as JArray).Single(); + Assert.True(JToken.DeepEquals(externalResolution, actualResolution)); + + var topIntent = prediction.Intents[prediction.TopIntent]; + Assert.True(topIntent.Score > 0.5); + + Assert.Equal("positive", prediction.Sentiment.Label); + Assert.True(prediction.Sentiment.Score > 0.5); + + // dispatch + var child = topIntent.ChildApp; + Assert.Equal(utterance, child.NormalizedQuery); + Assert.Equal("None", child.TopIntent); + Assert.Equal(1, child.Intents.Count); + Assert.Equal(2, child.Entities.Count); + Assert.Contains("datetimeV2", child.Entities.Keys); + Assert.Contains("$instance", child.Entities.Keys); + + var dispatchTopIntent = child.Intents[child.TopIntent]; + Assert.True(dispatchTopIntent.Score > 0.5); + + Assert.Equal("positive", child.Sentiment.Label); + Assert.True(child.Sentiment.Score > 0.5); }); } [Fact] - public void Prediction_WithSpellCheck() + public void Prediction_Version() { UseClientFor(async client => { - var utterance = "helo, what dai is todey?"; - var result = await client.Prediction.ResolveAsync(System.Guid.Parse(appId), utterance, spellCheck: true, bingSpellCheckSubscriptionKey: "00000000000000000000000000000000"); + var utterance = "today this is a test with post"; + var versionId = "0.1"; - Assert.True(!string.IsNullOrWhiteSpace(result.AlteredQuery)); - Assert.Equal("hello, what day is today?", result.AlteredQuery); + var requestOptions = new PredictionRequestOptions + { + DatetimeReference = DateTime.Parse("2019-01-01"), + OverridePredictions = true + }; + + var externalResolution = JObject.FromObject(new { text = "post", external = true }); + var externalEntities = new[] + { + new ExternalEntity + { + EntityName = "simple", + StartIndex = 26, + EntityLength = 4, + Resolution = externalResolution + } + }; + + var dynamicLists = new[] + { + new DynamicList + { + ListEntityName = "list", + RequestLists = new[] + { + new RequestList + { + Name = "test", + CanonicalForm = "testing", + Synonyms = new[] { "this" } + } + } + } + }; + + var predictionRequest = new PredictionRequest + { + Query = utterance, + Options = requestOptions, + ExternalEntities = externalEntities, + DynamicLists = dynamicLists + }; + + var result = await client.Prediction.GetVersionPredictionAsync( + Guid.Parse(appId), + versionId, + predictionRequest, + verbose: true, + showAllIntents: true); + + var prediction = result.Prediction; Assert.Equal(utterance, result.Query); + Assert.Equal(utterance, prediction.NormalizedQuery); + Assert.Equal("intent", prediction.TopIntent); + Assert.Equal(2, prediction.Intents.Count); + Assert.Equal(4, prediction.Entities.Count); + Assert.Contains("datetimeV2", prediction.Entities.Keys); + Assert.Contains("simple", prediction.Entities.Keys); + Assert.Contains("list", prediction.Entities.Keys); + Assert.Contains("$instance", prediction.Entities.Keys); + + // Test external resolution + var actualResolution = (prediction.Entities["simple"] as JArray).Single(); + Assert.True(JToken.DeepEquals(externalResolution, actualResolution)); + + var topIntent = prediction.Intents[prediction.TopIntent]; + Assert.True(topIntent.Score > 0.5); + + Assert.Equal("positive", prediction.Sentiment.Label); + Assert.True(prediction.Sentiment.Score > 0.5); + + // dispatch + var child = topIntent.ChildApp; + Assert.Equal(utterance, child.NormalizedQuery); + Assert.Equal("None", child.TopIntent); + Assert.Equal(1, child.Intents.Count); + Assert.Equal(2, child.Entities.Count); + Assert.Contains("datetimeV2", child.Entities.Keys); + Assert.Contains("$instance", child.Entities.Keys); + + var dispatchTopIntent = child.Intents[child.TopIntent]; + Assert.True(dispatchTopIntent.Score > 0.5); + + Assert.Equal("positive", child.Sentiment.Label); + Assert.True(child.Sentiment.Score > 0.5); }); } [Fact] - public void Prediction_InvalidKey_ThrowsAPIErrorException() + public void Prediction_AppNotFound_ThrowsAPIErrorException() { - var headers = new Dictionary> { ["Ocp-Apim-Subscription-Key"] = new List { "invalid-key" } }; - UseClientFor(async client => { - var ex = await Assert.ThrowsAsync(async () => + var ex = await Assert.ThrowsAsync(async () => { - await client.Prediction.ResolveWithHttpMessagesAsync(System.Guid.Parse(appId), "this is a test with post", customHeaders: headers); + await client.Prediction.GetSlotPredictionAsync( + Guid.Parse("7555b7c1-e69c-4580-9d95-1abd6dfa8291"), + "production", + new PredictionRequest + { + Query = "this is a test with post" + }); }); - Assert.Equal("401", ex.Body.StatusCode); + Assert.Equal("NotFound", ex.Body.ErrorProperty.Code); }); } [Fact] - public void Prediction_QueryTooLong_ThrowsValidationException() + public void Prediction_NullQuery_ThrowsValidationException() { UseClientFor(async client => { - var query = string.Empty.PadLeft(501, 'x'); var ex = await Assert.ThrowsAsync(async () => { - await client.Prediction.ResolveWithHttpMessagesAsync(System.Guid.Parse(appId), query); + await client.Prediction.GetSlotPredictionAsync(Guid.Parse(appId), "production", new PredictionRequest()); }); - Assert.Equal("query", ex.Target); + Assert.Equal("Query", ex.Target); }); } } diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_AppNotFound_ThrowsAPIErrorException.json b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_AppNotFound_ThrowsAPIErrorException.json new file mode 100644 index 000000000000..50831d180bdc --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_AppNotFound_ThrowsAPIErrorException.json @@ -0,0 +1,66 @@ +{ + "Entries": [ + { + "RequestUri": "/luis/v3.0-preview/apps/7555b7c1-e69c-4580-9d95-1abd6dfa8291/slots/production/predict", + "EncodedRequestUri": "L2x1aXMvdjMuMC1wcmV2aWV3L2FwcHMvNzU1NWI3YzEtZTY5Yy00NTgwLTlkOTUtMWFiZDZkZmE4MjkxL3Nsb3RzL3Byb2R1Y3Rpb24vcHJlZGljdA==", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"query\": \"this is a test with post\"\r\n}", + "RequestHeaders": { + "Ocp-Apim-Subscription-Key": [ + "00000000000000000000000000000000" + ], + "User-Agent": [ + "FxVersion/4.6.27414.06", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.17763.", + "Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.LUISRuntimeClient/2.1.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "43" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-store, proxy-revalidate, no-cache, max-age=0, private" + ], + "Pragma": [ + "no-cache" + ], + "Apim-Request-Id": [ + "f55e861b-c0b8-474a-a32a-f65a510de7bd" + ], + "Request-Id": [ + "f55e861b-c0b8-474a-a32a-f65a510de7bd" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains; preload" + ], + "Request-Context": [ + "appId=cid-v1:26a3540d-a02a-4998-a060-715488fd769b" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Date": [ + "Mon, 29 Apr 2019 18:53:23 GMT" + ], + "Content-Length": [ + "154" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"NotFound\",\r\n \"message\": \"The application 7555b7c1-e69c-4580-9d95-1abd6dfa8291 is not published or doesn't exist.\"\r\n }\r\n}", + "StatusCode": 404 + } + ], + "Names": {}, + "Variables": {} +} \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_InvalidKey_ThrowsAPIErrorException.json b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_InvalidKey_ThrowsAPIErrorException.json deleted file mode 100644 index 84ffc40881dd..000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_InvalidKey_ThrowsAPIErrorException.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "/luis/v2.0/apps/86226c53-b7a6-416f-876b-226b2b5ab07b", - "RequestMethod": "POST", - "RequestBody": "\"this is a test with post\"", - "RequestHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Content-Length": [ - "26" - ], - "Ocp-Apim-Subscription-Key": [ - "00000000000000000000000000000000" - ], - "User-Agent": [ - "FxVersion/4.6.25815.04", - "Microsoft.Azure.CognitiveServices.Language.LUIS.LuisRuntimeAPI/2.0.0.0" - ] - }, - "ResponseBody": "{\r\n \"statusCode\": 401,\r\n \"message\": \"Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.\"\r\n}", - "ResponseHeaders": { - "Content-Length": [ - "143" - ], - "Content-Type": [ - "application/json" - ], - "Date": [ - "Fri, 24 Nov 2017 18:03:59 GMT" - ], - "WWW-Authenticate": [ - "AzureApiManagementKey realm=\"https://westus.api.cognitive.microsoft.com/luis/v2.0/apps\",name=\"Ocp-Apim-Subscription-Key\",type=\"header\"" - ], - "apim-request-id": [ - "17372802-65f3-4358-8cb4-2d3fd59f1591" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains; preload" - ], - "x-content-type-options": [ - "nosniff" - ] - }, - "StatusCode": 401 - } - ], - "Names": {}, - "Variables": {} -} \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_QueryTooLong_ThrowsValidationException.json b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_NullQuery_ThrowsValidationException.json similarity index 100% rename from src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_QueryTooLong_ThrowsValidationException.json rename to src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_NullQuery_ThrowsValidationException.json diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Post.json b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Post.json deleted file mode 100644 index 90e85f49d6c7..000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Post.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "/luis/v2.0/apps/86226c53-b7a6-416f-876b-226b2b5ab07b", - "RequestMethod": "POST", - "RequestBody": "\"this is a test with post\"", - "RequestHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Content-Length": [ - "26" - ], - "Ocp-Apim-Subscription-Key": [ - "00000000000000000000000000000000" - ], - "User-Agent": [ - "FxVersion/4.6.25815.04", - "Microsoft.Azure.CognitiveServices.Language.LUIS.LuisRuntimeAPI/2.0.0.0" - ] - }, - "ResponseBody": "{\r\n \"query\": \"this is a test with post\",\r\n \"topScoringIntent\": {\r\n \"intent\": \"None\",\r\n \"score\": 0.470495373\r\n },\r\n \"entities\": []\r\n}", - "ResponseHeaders": { - "Content-Length": [ - "142" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Cache-Control": [ - "no-store, proxy-revalidate, no-cache, max-age=0, private" - ], - "Date": [ - "Fri, 24 Nov 2017 18:03:59 GMT" - ], - "Pragma": [ - "no-cache" - ], - "Apim-Request-Id": [ - "81fb65ad-436a-4969-8e11-3155e5c66db6" - ], - "Request-Id": [ - "81fb65ad-436a-4969-8e11-3155e5c66db6" - ], - "X-Powered-By": [ - "ASP.NET" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains; preload" - ], - "x-content-type-options": [ - "nosniff" - ] - }, - "StatusCode": 200 - } - ], - "Names": {}, - "Variables": {} -} \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Slot.json b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Slot.json new file mode 100644 index 000000000000..ab08d65118d7 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Slot.json @@ -0,0 +1,66 @@ +{ + "Entries": [ + { + "RequestUri": "/luis/v3.0-preview/apps/0894d430-8f00-4bcd-8153-45e06a1feca1/slots/production/predict?verbose=true&show-all-intents=true", + "EncodedRequestUri": "L2x1aXMvdjMuMC1wcmV2aWV3L2FwcHMvMDg5NGQ0MzAtOGYwMC00YmNkLTgxNTMtNDVlMDZhMWZlY2ExL3Nsb3RzL3Byb2R1Y3Rpb24vcHJlZGljdD92ZXJib3NlPXRydWUmc2hvdy1hbGwtaW50ZW50cz10cnVl", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"query\": \"today this is a test with post\",\r\n \"options\": {\r\n \"datetimeReference\": \"2019-01-01T00:00:00Z\",\r\n \"overridePredictions\": true\r\n },\r\n \"externalEntities\": [\r\n {\r\n \"entityName\": \"simple\",\r\n \"startIndex\": 26,\r\n \"entityLength\": 4,\r\n \"resolution\": {\r\n \"text\": \"post\",\r\n \"external\": true\r\n }\r\n }\r\n ],\r\n \"dynamicLists\": [\r\n {\r\n \"listEntityName\": \"list\",\r\n \"requestLists\": [\r\n {\r\n \"name\": \"test\",\r\n \"canonicalForm\": \"testing\",\r\n \"synonyms\": [\r\n \"this\"\r\n ]\r\n }\r\n ]\r\n }\r\n ]\r\n}", + "RequestHeaders": { + "Ocp-Apim-Subscription-Key": [ + "00000000000000000000000000000000" + ], + "User-Agent": [ + "FxVersion/4.6.27414.06", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.17763.", + "Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.LUISRuntimeClient/2.1.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "618" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-store, proxy-revalidate, no-cache, max-age=0, private" + ], + "Pragma": [ + "no-cache" + ], + "Apim-Request-Id": [ + "c63f7e0f-ba16-42e5-a4ef-a0ad6fc0e972" + ], + "Request-Id": [ + "c63f7e0f-ba16-42e5-a4ef-a0ad6fc0e972" + ], + "CSP-Billing-Usage": [ + "CognitiveServices.LUIS.Transaction|2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains; preload" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Date": [ + "Mon, 29 Apr 2019 18:48:50 GMT" + ], + "Content-Length": [ + "1403" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ] + }, + "ResponseBody": "{\r\n \"query\": \"today this is a test with post\",\r\n \"prediction\": {\r\n \"normalizedQuery\": \"today this is a test with post\",\r\n \"topIntent\": \"intent\",\r\n \"intents\": {\r\n \"intent\": {\r\n \"score\": 0.9487228,\r\n \"childApp\": {\r\n \"normalizedQuery\": \"today this is a test with post\",\r\n \"topIntent\": \"None\",\r\n \"intents\": {\r\n \"None\": {\r\n \"score\": 0.8448954\r\n }\r\n },\r\n \"entities\": {\r\n \"datetimeV2\": [\r\n {\r\n \"type\": \"date\",\r\n \"values\": [\r\n {\r\n \"timex\": \"2019-01-01\",\r\n \"value\": \"2019-01-01\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"$instance\": {\r\n \"datetimeV2\": [\r\n {\r\n \"type\": \"builtin.datetimeV2.date\",\r\n \"text\": \"today\",\r\n \"startIndex\": 0,\r\n \"length\": 5,\r\n \"modelTypeId\": 2,\r\n \"modelType\": \"Prebuilt Entity Extractor\",\r\n \"recognitionSources\": [\r\n \"model\"\r\n ]\r\n }\r\n ]\r\n }\r\n },\r\n \"sentiment\": {\r\n \"label\": \"positive\",\r\n \"score\": 0.7840382\r\n }\r\n }\r\n },\r\n \"None\": {\r\n \"score\": 0.0313083045\r\n }\r\n },\r\n \"entities\": {\r\n \"datetimeV2\": [\r\n {\r\n \"type\": \"date\",\r\n \"values\": [\r\n {\r\n \"timex\": \"2019-01-01\",\r\n \"value\": \"2019-01-01\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"list\": [\r\n [\r\n \"testing\"\r\n ]\r\n ],\r\n \"simple\": [\r\n {\r\n \"text\": \"post\",\r\n \"external\": true\r\n }\r\n ],\r\n \"$instance\": {\r\n \"datetimeV2\": [\r\n {\r\n \"type\": \"builtin.datetimeV2.date\",\r\n \"text\": \"today\",\r\n \"startIndex\": 0,\r\n \"length\": 5,\r\n \"modelTypeId\": 2,\r\n \"modelType\": \"Prebuilt Entity Extractor\",\r\n \"recognitionSources\": [\r\n \"model\"\r\n ]\r\n }\r\n ],\r\n \"list\": [\r\n {\r\n \"type\": \"list\",\r\n \"text\": \"this\",\r\n \"startIndex\": 6,\r\n \"length\": 4,\r\n \"modelTypeId\": 5,\r\n \"modelType\": \"List Entity Extractor\",\r\n \"recognitionSources\": [\r\n \"model\"\r\n ]\r\n }\r\n ],\r\n \"simple\": [\r\n {\r\n \"type\": \"simple\",\r\n \"text\": \"post\",\r\n \"startIndex\": 26,\r\n \"length\": 4,\r\n \"score\": 0.9613106,\r\n \"modelTypeId\": 1,\r\n \"modelType\": \"Entity Extractor\",\r\n \"recognitionSources\": [\r\n \"model\",\r\n \"externalEntities\"\r\n ]\r\n }\r\n ]\r\n }\r\n },\r\n \"sentiment\": {\r\n \"label\": \"positive\",\r\n \"score\": 0.7840382\r\n }\r\n }\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": {} +} \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Version.json b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Version.json new file mode 100644 index 000000000000..4dd342c368c0 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_Version.json @@ -0,0 +1,66 @@ +{ + "Entries": [ + { + "RequestUri": "/luis/v3.0-preview/apps/0894d430-8f00-4bcd-8153-45e06a1feca1/versions/0.1/predict?verbose=true&show-all-intents=true", + "EncodedRequestUri": "L2x1aXMvdjMuMC1wcmV2aWV3L2FwcHMvMDg5NGQ0MzAtOGYwMC00YmNkLTgxNTMtNDVlMDZhMWZlY2ExL3ZlcnNpb25zLzAuMS9wcmVkaWN0P3ZlcmJvc2U9dHJ1ZSZzaG93LWFsbC1pbnRlbnRzPXRydWU=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"query\": \"today this is a test with post\",\r\n \"options\": {\r\n \"datetimeReference\": \"2019-01-01T00:00:00Z\",\r\n \"overridePredictions\": true\r\n },\r\n \"externalEntities\": [\r\n {\r\n \"entityName\": \"simple\",\r\n \"startIndex\": 26,\r\n \"entityLength\": 4,\r\n \"resolution\": {\r\n \"text\": \"post\",\r\n \"external\": true\r\n }\r\n }\r\n ],\r\n \"dynamicLists\": [\r\n {\r\n \"listEntityName\": \"list\",\r\n \"requestLists\": [\r\n {\r\n \"name\": \"test\",\r\n \"canonicalForm\": \"testing\",\r\n \"synonyms\": [\r\n \"this\"\r\n ]\r\n }\r\n ]\r\n }\r\n ]\r\n}", + "RequestHeaders": { + "Ocp-Apim-Subscription-Key": [ + "00000000000000000000000000000000" + ], + "User-Agent": [ + "FxVersion/4.6.27414.06", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.17763.", + "Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.LUISRuntimeClient/2.1.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "618" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-store, proxy-revalidate, no-cache, max-age=0, private" + ], + "Pragma": [ + "no-cache" + ], + "Apim-Request-Id": [ + "0e01d1f9-28cb-441c-af34-5c776cf23a95" + ], + "Request-Id": [ + "0e01d1f9-28cb-441c-af34-5c776cf23a95" + ], + "CSP-Billing-Usage": [ + "CognitiveServices.LUIS.Transaction|2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains; preload" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Date": [ + "Mon, 29 Apr 2019 18:48:51 GMT" + ], + "Content-Length": [ + "1403" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ] + }, + "ResponseBody": "{\r\n \"query\": \"today this is a test with post\",\r\n \"prediction\": {\r\n \"normalizedQuery\": \"today this is a test with post\",\r\n \"topIntent\": \"intent\",\r\n \"intents\": {\r\n \"intent\": {\r\n \"score\": 0.9487228,\r\n \"childApp\": {\r\n \"normalizedQuery\": \"today this is a test with post\",\r\n \"topIntent\": \"None\",\r\n \"intents\": {\r\n \"None\": {\r\n \"score\": 0.8448954\r\n }\r\n },\r\n \"entities\": {\r\n \"datetimeV2\": [\r\n {\r\n \"type\": \"date\",\r\n \"values\": [\r\n {\r\n \"timex\": \"2019-01-01\",\r\n \"value\": \"2019-01-01\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"$instance\": {\r\n \"datetimeV2\": [\r\n {\r\n \"type\": \"builtin.datetimeV2.date\",\r\n \"text\": \"today\",\r\n \"startIndex\": 0,\r\n \"length\": 5,\r\n \"modelTypeId\": 2,\r\n \"modelType\": \"Prebuilt Entity Extractor\",\r\n \"recognitionSources\": [\r\n \"model\"\r\n ]\r\n }\r\n ]\r\n }\r\n },\r\n \"sentiment\": {\r\n \"label\": \"positive\",\r\n \"score\": 0.7840382\r\n }\r\n }\r\n },\r\n \"None\": {\r\n \"score\": 0.0313083045\r\n }\r\n },\r\n \"entities\": {\r\n \"datetimeV2\": [\r\n {\r\n \"type\": \"date\",\r\n \"values\": [\r\n {\r\n \"timex\": \"2019-01-01\",\r\n \"value\": \"2019-01-01\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"list\": [\r\n [\r\n \"testing\"\r\n ]\r\n ],\r\n \"simple\": [\r\n {\r\n \"text\": \"post\",\r\n \"external\": true\r\n }\r\n ],\r\n \"$instance\": {\r\n \"datetimeV2\": [\r\n {\r\n \"type\": \"builtin.datetimeV2.date\",\r\n \"text\": \"today\",\r\n \"startIndex\": 0,\r\n \"length\": 5,\r\n \"modelTypeId\": 2,\r\n \"modelType\": \"Prebuilt Entity Extractor\",\r\n \"recognitionSources\": [\r\n \"model\"\r\n ]\r\n }\r\n ],\r\n \"list\": [\r\n {\r\n \"type\": \"list\",\r\n \"text\": \"this\",\r\n \"startIndex\": 6,\r\n \"length\": 4,\r\n \"modelTypeId\": 5,\r\n \"modelType\": \"List Entity Extractor\",\r\n \"recognitionSources\": [\r\n \"model\"\r\n ]\r\n }\r\n ],\r\n \"simple\": [\r\n {\r\n \"type\": \"simple\",\r\n \"text\": \"post\",\r\n \"startIndex\": 26,\r\n \"length\": 4,\r\n \"score\": 0.9613106,\r\n \"modelTypeId\": 1,\r\n \"modelType\": \"Entity Extractor\",\r\n \"recognitionSources\": [\r\n \"model\",\r\n \"externalEntities\"\r\n ]\r\n }\r\n ]\r\n }\r\n },\r\n \"sentiment\": {\r\n \"label\": \"positive\",\r\n \"score\": 0.7840382\r\n }\r\n }\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": {} +} \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_WithSpellCheck.json b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_WithSpellCheck.json deleted file mode 100644 index 2de7e755342a..000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime.Tests/SessionRecords/LUIS.Runtime.Tests.PredictionTests/Prediction_WithSpellCheck.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "/luis/v2.0/apps/86226c53-b7a6-416f-876b-226b2b5ab07b?spellCheck=true&bing-spell-check-subscription-key=00000000000000000000000000000000", - "RequestMethod": "POST", - "RequestBody": "\"helo, what dai is todey?\"", - "RequestHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Content-Length": [ - "26" - ], - "Ocp-Apim-Subscription-Key": [ - "00000000000000000000000000000000" - ], - "User-Agent": [ - "FxVersion/4.6.25815.04", - "Microsoft.Azure.CognitiveServices.Language.LUIS.LuisRuntimeAPI/2.0.0.0" - ] - }, - "ResponseBody": "{\r\n \"query\": \"helo, what dai is todey?\",\r\n \"alteredQuery\": \"hello, what day is today?\",\r\n \"topScoringIntent\": {\r\n \"intent\": \"None\",\r\n \"score\": 0.06220497\r\n },\r\n \"entities\": [\r\n {\r\n \"entity\": \"today\",\r\n \"type\": \"builtin.datetime.date\",\r\n \"startIndex\": 19,\r\n \"endIndex\": 23,\r\n \"resolution\": {\r\n \"date\": \"2017-12-04\"\r\n }\r\n }\r\n ]\r\n}", - "ResponseHeaders": { - "Content-Length": [ - "383" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Cache-Control": [ - "no-store, proxy-revalidate, no-cache, max-age=0, private" - ], - "Date": [ - "Mon, 04 Dec 2017 15:42:16 GMT" - ], - "Pragma": [ - "no-cache" - ], - "Apim-Request-Id": [ - "1698cb79-a545-4a09-9459-8bff31ee8d96" - ], - "Request-Id": [ - "1698cb79-a545-4a09-9459-8bff31ee8d96" - ], - "Request-Context": [ - "appId=cid-v1:26a3540d-a02a-4998-a060-715488fd769b" - ], - "X-Powered-By": [ - "ASP.NET" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains; preload" - ], - "x-content-type-options": [ - "nosniff" - ] - }, - "StatusCode": 200 - } - ], - "Names": {}, - "Variables": {} -} \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/ILUISRuntimeClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/ILUISRuntimeClient.cs index 98ee3c0d7806..daa9feb8a1e2 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/ILUISRuntimeClient.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/ILUISRuntimeClient.cs @@ -46,9 +46,9 @@ public partial interface ILUISRuntimeClient : System.IDisposable /// - /// Gets the IPrediction. + /// Gets the IPredictionOperations. /// - IPrediction Prediction { get; } + IPredictionOperations Prediction { get; } } } diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPrediction.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPrediction.cs deleted file mode 100644 index 2210ef103283..000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPrediction.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Prediction operations. - /// - public partial interface IPrediction - { - /// - /// Gets predictions for a given utterance, in the form of intents and - /// entities. The current maximum query size is 500 characters. - /// - /// - /// The LUIS application ID (Guid). - /// - /// - /// The utterance to predict. - /// - /// - /// The timezone offset for the location of the request. - /// - /// - /// If true, return all intents instead of just the top scoring intent. - /// - /// - /// Use the staging endpoint slot. - /// - /// - /// Enable spell checking. - /// - /// - /// The subscription key to use when enabling Bing spell check - /// - /// - /// Log query (default is true) - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> ResolveWithHttpMessagesAsync(System.Guid appId, string query, double? timezoneOffset = default(double?), bool? verbose = default(bool?), bool? staging = default(bool?), bool? spellCheck = default(bool?), string bingSpellCheckSubscriptionKey = default(string), bool? log = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPredictionOperations.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPredictionOperations.cs new file mode 100644 index 000000000000..b4ae468218b4 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/IPredictionOperations.cs @@ -0,0 +1,104 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PredictionOperations operations. + /// + public partial interface IPredictionOperations + { + /// + /// Gets the predictions for an application version. + /// + /// + /// The application ID. + /// + /// + /// The application version ID. + /// + /// + /// The prediction request parameters. + /// + /// + /// Indicates whether to get extra metadata for the entities + /// predictions or not. + /// + /// + /// Indicates whether to return all the intents in the response or just + /// the top intent. + /// + /// + /// Indicates whether to log the endpoint query or not. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetVersionPredictionWithHttpMessagesAsync(System.Guid appId, string versionId, PredictionRequest predictionRequest, bool? verbose = default(bool?), bool? showAllIntents = default(bool?), bool? log = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the predictions for an application slot. + /// + /// + /// The application ID. + /// + /// + /// The application slot name. + /// + /// + /// The prediction request parameters. + /// + /// + /// Indicates whether to get extra metadata for the entities + /// predictions or not. + /// + /// + /// Indicates whether to return all the intents in the response or just + /// the top intent. + /// + /// + /// Indicates whether to log the endpoint query or not. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetSlotPredictionWithHttpMessagesAsync(System.Guid appId, string slotName, PredictionRequest predictionRequest, bool? verbose = default(bool?), bool? showAllIntents = default(bool?), bool? log = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/LUISRuntimeClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/LUISRuntimeClient.cs index ba6c82eacffd..f0cb9750dbea 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/LUISRuntimeClient.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/LUISRuntimeClient.cs @@ -48,9 +48,9 @@ public partial class LUISRuntimeClient : ServiceClient, ILUIS public ServiceClientCredentials Credentials { get; private set; } /// - /// Gets the IPrediction. + /// Gets the IPredictionOperations. /// - public virtual IPrediction Prediction { get; private set; } + public virtual IPredictionOperations Prediction { get; private set; } /// /// Initializes a new instance of the LUISRuntimeClient class. @@ -179,8 +179,8 @@ public LUISRuntimeClient(ServiceClientCredentials credentials, HttpClientHandler /// private void Initialize() { - Prediction = new Prediction(this); - BaseUri = "{Endpoint}/luis/v2.0"; + Prediction = new PredictionOperations(this); + BaseUri = "{Endpoint}/luis/v3.0-preview"; SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/CompositeEntityModel.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/DynamicList.cs similarity index 52% rename from src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/CompositeEntityModel.cs rename to src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/DynamicList.cs index e321b0319f45..055d3d9e8cec 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/CompositeEntityModel.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/DynamicList.cs @@ -17,30 +17,29 @@ namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models using System.Linq; /// - /// LUIS Composite Entity. + /// Defines an extension for a list entity. /// - public partial class CompositeEntityModel + public partial class DynamicList { /// - /// Initializes a new instance of the CompositeEntityModel class. + /// Initializes a new instance of the DynamicList class. /// - public CompositeEntityModel() + public DynamicList() { CustomInit(); } /// - /// Initializes a new instance of the CompositeEntityModel class. + /// Initializes a new instance of the DynamicList class. /// - /// Type/name of parent entity. - /// Value for composite entity extracted by - /// LUIS. - /// Child entities. - public CompositeEntityModel(string parentType, string value, IList children) + /// The name of the list entity to + /// extend. + /// The lists to append on the extended list + /// entity. + public DynamicList(string listEntityName, IList requestLists) { - ParentType = parentType; - Value = value; - Children = children; + ListEntityName = listEntityName; + RequestLists = requestLists; CustomInit(); } @@ -50,22 +49,16 @@ public CompositeEntityModel(string parentType, string value, IList - /// Gets or sets type/name of parent entity. + /// Gets or sets the name of the list entity to extend. /// - [JsonProperty(PropertyName = "parentType")] - public string ParentType { get; set; } + [JsonProperty(PropertyName = "listEntityName")] + public string ListEntityName { get; set; } /// - /// Gets or sets value for composite entity extracted by LUIS. + /// Gets or sets the lists to append on the extended list entity. /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Gets or sets child entities. - /// - [JsonProperty(PropertyName = "children")] - public IList Children { get; set; } + [JsonProperty(PropertyName = "requestLists")] + public IList RequestLists { get; set; } /// /// Validate the object. @@ -75,21 +68,17 @@ public CompositeEntityModel(string parentType, string value, IList public virtual void Validate() { - if (ParentType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ParentType"); - } - if (Value == null) + if (ListEntityName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + throw new ValidationException(ValidationRules.CannotBeNull, "ListEntityName"); } - if (Children == null) + if (RequestLists == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Children"); + throw new ValidationException(ValidationRules.CannotBeNull, "RequestLists"); } - if (Children != null) + if (RequestLists != null) { - foreach (var element in Children) + foreach (var element in RequestLists) { if (element != null) { diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityModel.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityModel.cs deleted file mode 100644 index b1b0649a90f3..000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityModel.cs +++ /dev/null @@ -1,110 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An entity extracted from the utterance. - /// - public partial class EntityModel - { - /// - /// Initializes a new instance of the EntityModel class. - /// - public EntityModel() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EntityModel class. - /// - /// Name of the entity, as defined in - /// LUIS. - /// Type of the entity, as defined in LUIS. - /// The position of the first character of the - /// matched entity within the utterance. - /// The position of the last character of the - /// matched entity within the utterance. - /// Unmatched properties from the - /// message are deserialized this collection - public EntityModel(string entity, string type, int startIndex, int endIndex, IDictionary additionalProperties = default(IDictionary)) - { - AdditionalProperties = additionalProperties; - Entity = entity; - Type = type; - StartIndex = startIndex; - EndIndex = endIndex; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets or sets name of the entity, as defined in LUIS. - /// - [JsonProperty(PropertyName = "entity")] - public string Entity { get; set; } - - /// - /// Gets or sets type of the entity, as defined in LUIS. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the position of the first character of the matched - /// entity within the utterance. - /// - [JsonProperty(PropertyName = "startIndex")] - public int StartIndex { get; set; } - - /// - /// Gets or sets the position of the last character of the matched - /// entity within the utterance. - /// - [JsonProperty(PropertyName = "endIndex")] - public int EndIndex { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Entity == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Entity"); - } - if (Type == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Type"); - } - } - } -} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityWithResolution.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityWithResolution.cs deleted file mode 100644 index c74d84f2a09e..000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityWithResolution.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class EntityWithResolution : EntityModel - { - /// - /// Initializes a new instance of the EntityWithResolution class. - /// - public EntityWithResolution() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EntityWithResolution class. - /// - /// Name of the entity, as defined in - /// LUIS. - /// Type of the entity, as defined in LUIS. - /// The position of the first character of the - /// matched entity within the utterance. - /// The position of the last character of the - /// matched entity within the utterance. - /// Resolution values for pre-built LUIS - /// entities. - /// Unmatched properties from the - /// message are deserialized this collection - public EntityWithResolution(string entity, string type, int startIndex, int endIndex, object resolution, IDictionary additionalProperties = default(IDictionary)) - : base(entity, type, startIndex, endIndex, additionalProperties) - { - Resolution = resolution; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resolution values for pre-built LUIS entities. - /// - [JsonProperty(PropertyName = "resolution")] - public object Resolution { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (Resolution == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Resolution"); - } - } - } -} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityWithScore.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityWithScore.cs deleted file mode 100644 index 74000ad01040..000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/EntityWithScore.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class EntityWithScore : EntityModel - { - /// - /// Initializes a new instance of the EntityWithScore class. - /// - public EntityWithScore() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EntityWithScore class. - /// - /// Name of the entity, as defined in - /// LUIS. - /// Type of the entity, as defined in LUIS. - /// The position of the first character of the - /// matched entity within the utterance. - /// The position of the last character of the - /// matched entity within the utterance. - /// Associated prediction score for the intent - /// (float). - /// Unmatched properties from the - /// message are deserialized this collection - public EntityWithScore(string entity, string type, int startIndex, int endIndex, double score, IDictionary additionalProperties = default(IDictionary)) - : base(entity, type, startIndex, endIndex, additionalProperties) - { - Score = score; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets associated prediction score for the intent (float). - /// - [JsonProperty(PropertyName = "score")] - public double Score { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (Score > 1) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Score", 1); - } - if (Score < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Score", 0); - } - } - } -} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/APIError.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Error.cs similarity index 51% rename from src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/APIError.cs rename to src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Error.cs index 756c598cfeb4..080625fde057 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/APIError.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Error.cs @@ -10,31 +10,29 @@ namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; /// - /// Error information returned by the API + /// Represents the error that occurred. /// - public partial class APIError + public partial class Error { /// - /// Initializes a new instance of the APIError class. + /// Initializes a new instance of the Error class. /// - public APIError() + public Error() { CustomInit(); } /// - /// Initializes a new instance of the APIError class. + /// Initializes a new instance of the Error class. /// - /// HTTP Status code - /// Cause of the error. - public APIError(string statusCode = default(string), string message = default(string)) + public Error(ErrorBody errorProperty) { - StatusCode = statusCode; - Message = message; + ErrorProperty = errorProperty; CustomInit(); } @@ -44,16 +42,26 @@ public APIError() partial void CustomInit(); /// - /// Gets or sets HTTP Status code /// - [JsonProperty(PropertyName = "statusCode")] - public string StatusCode { get; set; } + [JsonProperty(PropertyName = "error")] + public ErrorBody ErrorProperty { get; set; } /// - /// Gets or sets cause of the error. + /// Validate the object. /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ErrorProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ErrorProperty"); + } + if (ErrorProperty != null) + { + ErrorProperty.Validate(); + } + } } } diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/CompositeChildModel.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/ErrorBody.cs similarity index 61% rename from src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/CompositeChildModel.cs rename to src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/ErrorBody.cs index 51a2e9e51ae1..4fd7732945eb 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/CompositeChildModel.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/ErrorBody.cs @@ -15,27 +15,27 @@ namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models using System.Linq; /// - /// Child entity in a LUIS Composite Entity. + /// Represents the definition of the error that occurred. /// - public partial class CompositeChildModel + public partial class ErrorBody { /// - /// Initializes a new instance of the CompositeChildModel class. + /// Initializes a new instance of the ErrorBody class. /// - public CompositeChildModel() + public ErrorBody() { CustomInit(); } /// - /// Initializes a new instance of the CompositeChildModel class. + /// Initializes a new instance of the ErrorBody class. /// - /// Type of child entity. - /// Value extracted by LUIS. - public CompositeChildModel(string type, string value) + /// The error code. + /// The error message. + public ErrorBody(string code, string message) { - Type = type; - Value = value; + Code = code; + Message = message; CustomInit(); } @@ -45,16 +45,16 @@ public CompositeChildModel(string type, string value) partial void CustomInit(); /// - /// Gets or sets type of child entity. + /// Gets or sets the error code. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } /// - /// Gets or sets value extracted by LUIS. + /// Gets or sets the error message. /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } /// /// Validate the object. @@ -64,13 +64,13 @@ public CompositeChildModel(string type, string value) /// public virtual void Validate() { - if (Type == null) + if (Code == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + throw new ValidationException(ValidationRules.CannotBeNull, "Code"); } - if (Value == null) + if (Message == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + throw new ValidationException(ValidationRules.CannotBeNull, "Message"); } } } diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/APIErrorException.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/ErrorException.cs similarity index 71% rename from src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/APIErrorException.cs rename to src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/ErrorException.cs index 62d4cc50d14e..d2190339ae3b 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/APIErrorException.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/ErrorException.cs @@ -13,9 +13,9 @@ namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models using Microsoft.Rest; /// - /// Exception thrown for an invalid response with APIError information. + /// Exception thrown for an invalid response with Error information. /// - public partial class APIErrorException : RestException + public partial class ErrorException : RestException { /// /// Gets information about the associated HTTP request. @@ -30,30 +30,30 @@ public partial class APIErrorException : RestException /// /// Gets or sets the body object. /// - public APIError Body { get; set; } + public Error Body { get; set; } /// - /// Initializes a new instance of the APIErrorException class. + /// Initializes a new instance of the ErrorException class. /// - public APIErrorException() + public ErrorException() { } /// - /// Initializes a new instance of the APIErrorException class. + /// Initializes a new instance of the ErrorException class. /// /// The exception message. - public APIErrorException(string message) + public ErrorException(string message) : this(message, null) { } /// - /// Initializes a new instance of the APIErrorException class. + /// Initializes a new instance of the ErrorException class. /// /// The exception message. /// Inner exception. - public APIErrorException(string message, System.Exception innerException) + public ErrorException(string message, System.Exception innerException) : base(message, innerException) { } diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/ExternalEntity.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/ExternalEntity.cs new file mode 100644 index 000000000000..3fd3776311af --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/ExternalEntity.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines a user perdicted entity that extends an already existing one. + /// + public partial class ExternalEntity + { + /// + /// Initializes a new instance of the ExternalEntity class. + /// + public ExternalEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExternalEntity class. + /// + /// The name of the entity to extend. + /// The start character index of the predicted + /// entity. + /// The length of the predicted + /// entity. + /// A user supplied custom resolution to + /// return as the entity's prediction. + public ExternalEntity(string entityName, int startIndex, int entityLength, object resolution = default(object)) + { + EntityName = entityName; + StartIndex = startIndex; + EntityLength = entityLength; + Resolution = resolution; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the entity to extend. + /// + [JsonProperty(PropertyName = "entityName")] + public string EntityName { get; set; } + + /// + /// Gets or sets the start character index of the predicted entity. + /// + [JsonProperty(PropertyName = "startIndex")] + public int StartIndex { get; set; } + + /// + /// Gets or sets the length of the predicted entity. + /// + [JsonProperty(PropertyName = "entityLength")] + public int EntityLength { get; set; } + + /// + /// Gets or sets a user supplied custom resolution to return as the + /// entity's prediction. + /// + [JsonProperty(PropertyName = "resolution")] + public object Resolution { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EntityName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EntityName"); + } + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/IntentModel.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Intent.cs similarity index 53% rename from src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/IntentModel.cs rename to src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Intent.cs index 19d37e9edbe0..2d9756462cc3 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/IntentModel.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Intent.cs @@ -10,34 +10,32 @@ namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; /// - /// An intent detected from the utterance. + /// Represents an intent prediction. /// - public partial class IntentModel + public partial class Intent { /// - /// Initializes a new instance of the IntentModel class. + /// Initializes a new instance of the Intent class. /// - public IntentModel() + public Intent() { CustomInit(); } /// - /// Initializes a new instance of the IntentModel class. + /// Initializes a new instance of the Intent class. /// - /// Name of the intent, as defined in - /// LUIS. - /// Associated prediction score for the intent - /// (float). - public IntentModel(string intent = default(string), double? score = default(double?)) + /// The score of the fired intent. + /// The prediction of the dispatched + /// application. + public Intent(double? score = default(double?), Prediction childApp = default(Prediction)) { - Intent = intent; Score = score; + ChildApp = childApp; CustomInit(); } @@ -47,32 +45,28 @@ public IntentModel() partial void CustomInit(); /// - /// Gets or sets name of the intent, as defined in LUIS. + /// Gets or sets the score of the fired intent. /// - [JsonProperty(PropertyName = "intent")] - public string Intent { get; set; } + [JsonProperty(PropertyName = "score")] + public double? Score { get; set; } /// - /// Gets or sets associated prediction score for the intent (float). + /// Gets or sets the prediction of the dispatched application. /// - [JsonProperty(PropertyName = "score")] - public double? Score { get; set; } + [JsonProperty(PropertyName = "childApp")] + public Prediction ChildApp { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Score > 1) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Score", 1); - } - if (Score < 0) + if (ChildApp != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Score", 0); + ChildApp.Validate(); } } } diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/LuisResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/LuisResult.cs deleted file mode 100644 index afc0915de607..000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/LuisResult.cs +++ /dev/null @@ -1,157 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Prediction, based on the input query, containing intent(s) and - /// entities. - /// - public partial class LuisResult - { - /// - /// Initializes a new instance of the LuisResult class. - /// - public LuisResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LuisResult class. - /// - /// The input utterance that was analyzed. - /// The corrected utterance (when spell - /// checking was enabled). - /// All the intents (and their score) that were - /// detected from utterance. - /// The entities extracted from the - /// utterance. - /// The composite entities extracted - /// from the utterance. - public LuisResult(string query = default(string), string alteredQuery = default(string), IntentModel topScoringIntent = default(IntentModel), IList intents = default(IList), IList entities = default(IList), IList compositeEntities = default(IList), Sentiment sentimentAnalysis = default(Sentiment), LuisResult connectedServiceResult = default(LuisResult)) - { - Query = query; - AlteredQuery = alteredQuery; - TopScoringIntent = topScoringIntent; - Intents = intents; - Entities = entities; - CompositeEntities = compositeEntities; - SentimentAnalysis = sentimentAnalysis; - ConnectedServiceResult = connectedServiceResult; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the input utterance that was analyzed. - /// - [JsonProperty(PropertyName = "query")] - public string Query { get; set; } - - /// - /// Gets or sets the corrected utterance (when spell checking was - /// enabled). - /// - [JsonProperty(PropertyName = "alteredQuery")] - public string AlteredQuery { get; set; } - - /// - /// - [JsonProperty(PropertyName = "topScoringIntent")] - public IntentModel TopScoringIntent { get; set; } - - /// - /// Gets or sets all the intents (and their score) that were detected - /// from utterance. - /// - [JsonProperty(PropertyName = "intents")] - public IList Intents { get; set; } - - /// - /// Gets or sets the entities extracted from the utterance. - /// - [JsonProperty(PropertyName = "entities")] - public IList Entities { get; set; } - - /// - /// Gets or sets the composite entities extracted from the utterance. - /// - [JsonProperty(PropertyName = "compositeEntities")] - public IList CompositeEntities { get; set; } - - /// - /// - [JsonProperty(PropertyName = "sentimentAnalysis")] - public Sentiment SentimentAnalysis { get; set; } - - /// - /// - [JsonProperty(PropertyName = "connectedServiceResult")] - public LuisResult ConnectedServiceResult { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (TopScoringIntent != null) - { - TopScoringIntent.Validate(); - } - if (Intents != null) - { - foreach (var element in Intents) - { - if (element != null) - { - element.Validate(); - } - } - } - if (Entities != null) - { - foreach (var element1 in Entities) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (CompositeEntities != null) - { - foreach (var element2 in CompositeEntities) - { - if (element2 != null) - { - element2.Validate(); - } - } - } - if (ConnectedServiceResult != null) - { - ConnectedServiceResult.Validate(); - } - } - } -} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Prediction.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Prediction.cs new file mode 100644 index 000000000000..bfe8577b86cf --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Prediction.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents the prediction of a query. + /// + public partial class Prediction + { + /// + /// Initializes a new instance of the Prediction class. + /// + public Prediction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Prediction class. + /// + /// The query after pre-processing and + /// normalization. + /// The name of the top scoring intent. + /// A dictionary representing the intents that + /// fired. + /// The dictionary representing the entities + /// that fired. + /// The query after spell checking. Only set + /// if spell check was enabled and a spelling mistake was + /// found. + /// The result of the sentiment + /// analysis. + public Prediction(string normalizedQuery, string topIntent, IDictionary intents, IDictionary entities, string alteredQuery = default(string), Sentiment sentiment = default(Sentiment)) + { + NormalizedQuery = normalizedQuery; + AlteredQuery = alteredQuery; + TopIntent = topIntent; + Intents = intents; + Entities = entities; + Sentiment = sentiment; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the query after pre-processing and normalization. + /// + [JsonProperty(PropertyName = "normalizedQuery")] + public string NormalizedQuery { get; set; } + + /// + /// Gets or sets the query after spell checking. Only set if spell + /// check was enabled and a spelling mistake was found. + /// + [JsonProperty(PropertyName = "alteredQuery")] + public string AlteredQuery { get; set; } + + /// + /// Gets or sets the name of the top scoring intent. + /// + [JsonProperty(PropertyName = "topIntent")] + public string TopIntent { get; set; } + + /// + /// Gets or sets a dictionary representing the intents that fired. + /// + [JsonProperty(PropertyName = "intents")] + public IDictionary Intents { get; set; } + + /// + /// Gets or sets the dictionary representing the entities that fired. + /// + [JsonProperty(PropertyName = "entities")] + public IDictionary Entities { get; set; } + + /// + /// Gets or sets the result of the sentiment analysis. + /// + [JsonProperty(PropertyName = "sentiment")] + public Sentiment Sentiment { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (NormalizedQuery == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "NormalizedQuery"); + } + if (TopIntent == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TopIntent"); + } + if (Intents == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Intents"); + } + if (Entities == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Entities"); + } + if (Intents != null) + { + foreach (var valueElement in Intents.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (Sentiment != null) + { + Sentiment.Validate(); + } + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionRequest.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionRequest.cs new file mode 100644 index 000000000000..369e4bc04717 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionRequest.cs @@ -0,0 +1,114 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents the prediction request parameters. + /// + public partial class PredictionRequest + { + /// + /// Initializes a new instance of the PredictionRequest class. + /// + public PredictionRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PredictionRequest class. + /// + /// The query to predict + /// The custom options defined for this + /// request. + /// The externally predicted entities + /// for this request + /// The dynamically created list entities + /// for this request + public PredictionRequest(string query, PredictionRequestOptions options = default(PredictionRequestOptions), IList externalEntities = default(IList), IList dynamicLists = default(IList)) + { + Query = query; + Options = options; + ExternalEntities = externalEntities; + DynamicLists = dynamicLists; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the query to predict + /// + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + + /// + /// Gets or sets the custom options defined for this request. + /// + [JsonProperty(PropertyName = "options")] + public PredictionRequestOptions Options { get; set; } + + /// + /// Gets or sets the externally predicted entities for this request + /// + [JsonProperty(PropertyName = "externalEntities")] + public IList ExternalEntities { get; set; } + + /// + /// Gets or sets the dynamically created list entities for this request + /// + [JsonProperty(PropertyName = "dynamicLists")] + public IList DynamicLists { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Query"); + } + if (ExternalEntities != null) + { + foreach (var element in ExternalEntities) + { + if (element != null) + { + element.Validate(); + } + } + } + if (DynamicLists != null) + { + foreach (var element1 in DynamicLists) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionRequestOptions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionRequestOptions.cs new file mode 100644 index 000000000000..967844d64cfb --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionRequestOptions.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The custom options for the prediction request. + /// + public partial class PredictionRequestOptions + { + /// + /// Initializes a new instance of the PredictionRequestOptions class. + /// + public PredictionRequestOptions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PredictionRequestOptions class. + /// + /// The reference DateTime used for + /// predicting datetime entities. + /// Whether to make the external + /// entities resolution override the predictions if an overlap + /// occurs. + public PredictionRequestOptions(System.DateTime? datetimeReference = default(System.DateTime?), bool? overridePredictions = default(bool?)) + { + DatetimeReference = datetimeReference; + OverridePredictions = overridePredictions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the reference DateTime used for predicting datetime + /// entities. + /// + [JsonProperty(PropertyName = "datetimeReference")] + public System.DateTime? DatetimeReference { get; set; } + + /// + /// Gets or sets whether to make the external entities resolution + /// override the predictions if an overlap occurs. + /// + [JsonProperty(PropertyName = "overridePredictions")] + public bool? OverridePredictions { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionResponse.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionResponse.cs new file mode 100644 index 000000000000..fa44df39b3ed --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/PredictionResponse.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents the prediction response. + /// + public partial class PredictionResponse + { + /// + /// Initializes a new instance of the PredictionResponse class. + /// + public PredictionResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PredictionResponse class. + /// + /// The query used in the prediction. + /// The prediction of the requested + /// query. + public PredictionResponse(string query, Prediction prediction) + { + Query = query; + Prediction = prediction; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the query used in the prediction. + /// + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + + /// + /// Gets or sets the prediction of the requested query. + /// + [JsonProperty(PropertyName = "prediction")] + public Prediction Prediction { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Query"); + } + if (Prediction == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Prediction"); + } + if (Prediction != null) + { + Prediction.Validate(); + } + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/RequestList.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/RequestList.cs new file mode 100644 index 000000000000..80927882b05a --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/RequestList.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines a sub-list to append to an existing list entity. + /// + public partial class RequestList + { + /// + /// Initializes a new instance of the RequestList class. + /// + public RequestList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RequestList class. + /// + /// The canonical form of the + /// sub-list. + /// The name of the sub-list. + /// The synonyms of the canonical form. + public RequestList(string canonicalForm, string name = default(string), IList synonyms = default(IList)) + { + Name = name; + CanonicalForm = canonicalForm; + Synonyms = synonyms; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the sub-list. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the canonical form of the sub-list. + /// + [JsonProperty(PropertyName = "canonicalForm")] + public string CanonicalForm { get; set; } + + /// + /// Gets or sets the synonyms of the canonical form. + /// + [JsonProperty(PropertyName = "synonyms")] + public IList Synonyms { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CanonicalForm == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CanonicalForm"); + } + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Sentiment.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Sentiment.cs index 52c2fad41efb..b4257ca4a472 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Sentiment.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Models/Sentiment.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models using System.Linq; /// - /// Sentiment of the input utterance. + /// The result of the sentiment analaysis. /// public partial class Sentiment { @@ -29,14 +29,13 @@ public Sentiment() /// /// Initializes a new instance of the Sentiment class. /// - /// The polarity of the sentiment, can be positive, - /// neutral or negative. - /// Score of the sentiment, ranges from 0 (most - /// negative) to 1 (most positive). - public Sentiment(string label = default(string), double? score = default(double?)) + /// The sentiment score of the query. + /// The label of the sentiment analysis + /// result. + public Sentiment(double score, string label = default(string)) { - Label = label; Score = score; + Label = label; CustomInit(); } @@ -46,18 +45,26 @@ public Sentiment() partial void CustomInit(); /// - /// Gets or sets the polarity of the sentiment, can be positive, - /// neutral or negative. + /// Gets or sets the sentiment score of the query. + /// + [JsonProperty(PropertyName = "score")] + public double Score { get; set; } + + /// + /// Gets or sets the label of the sentiment analysis result. /// [JsonProperty(PropertyName = "label")] public string Label { get; set; } /// - /// Gets or sets score of the sentiment, ranges from 0 (most negative) - /// to 1 (most positive). + /// Validate the object. /// - [JsonProperty(PropertyName = "score")] - public double? Score { get; set; } - + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } } } diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Prediction.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Prediction.cs deleted file mode 100644 index 93195fa685bd..000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/Prediction.cs +++ /dev/null @@ -1,278 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Prediction operations. - /// - public partial class Prediction : IServiceOperations, IPrediction - { - /// - /// Initializes a new instance of the Prediction class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public Prediction(LUISRuntimeClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the LUISRuntimeClient - /// - public LUISRuntimeClient Client { get; private set; } - - /// - /// Gets predictions for a given utterance, in the form of intents and - /// entities. The current maximum query size is 500 characters. - /// - /// - /// The LUIS application ID (Guid). - /// - /// - /// The utterance to predict. - /// - /// - /// The timezone offset for the location of the request. - /// - /// - /// If true, return all intents instead of just the top scoring intent. - /// - /// - /// Use the staging endpoint slot. - /// - /// - /// Enable spell checking. - /// - /// - /// The subscription key to use when enabling Bing spell check - /// - /// - /// Log query (default is true) - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ResolveWithHttpMessagesAsync(System.Guid appId, string query, double? timezoneOffset = default(double?), bool? verbose = default(bool?), bool? staging = default(bool?), bool? spellCheck = default(bool?), string bingSpellCheckSubscriptionKey = default(string), bool? log = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (query == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "query"); - } - if (query != null) - { - if (query.Length > 500) - { - throw new ValidationException(ValidationRules.MaxLength, "query", 500); - } - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("query", query); - tracingParameters.Add("timezoneOffset", timezoneOffset); - tracingParameters.Add("verbose", verbose); - tracingParameters.Add("staging", staging); - tracingParameters.Add("spellCheck", spellCheck); - tracingParameters.Add("bingSpellCheckSubscriptionKey", bingSpellCheckSubscriptionKey); - tracingParameters.Add("log", log); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Resolve", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "apps/{appId}"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(appId, Client.SerializationSettings).Trim('"'))); - List _queryParameters = new List(); - if (timezoneOffset != null) - { - _queryParameters.Add(string.Format("timezoneOffset={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(timezoneOffset, Client.SerializationSettings).Trim('"')))); - } - if (verbose != null) - { - _queryParameters.Add(string.Format("verbose={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(verbose, Client.SerializationSettings).Trim('"')))); - } - if (staging != null) - { - _queryParameters.Add(string.Format("staging={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(staging, Client.SerializationSettings).Trim('"')))); - } - if (spellCheck != null) - { - _queryParameters.Add(string.Format("spellCheck={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(spellCheck, Client.SerializationSettings).Trim('"')))); - } - if (bingSpellCheckSubscriptionKey != null) - { - _queryParameters.Add(string.Format("bing-spell-check-subscription-key={0}", System.Uri.EscapeDataString(bingSpellCheckSubscriptionKey))); - } - if (log != null) - { - _queryParameters.Add(string.Format("log={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(log, Client.SerializationSettings).Trim('"')))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(query != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(query, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - APIError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionExtensions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionExtensions.cs deleted file mode 100644 index 352df2929603..000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionExtensions.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime -{ - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for Prediction. - /// - public static partial class PredictionExtensions - { - /// - /// Gets predictions for a given utterance, in the form of intents and - /// entities. The current maximum query size is 500 characters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The LUIS application ID (Guid). - /// - /// - /// The utterance to predict. - /// - /// - /// The timezone offset for the location of the request. - /// - /// - /// If true, return all intents instead of just the top scoring intent. - /// - /// - /// Use the staging endpoint slot. - /// - /// - /// Enable spell checking. - /// - /// - /// The subscription key to use when enabling Bing spell check - /// - /// - /// Log query (default is true) - /// - /// - /// The cancellation token. - /// - public static async Task ResolveAsync(this IPrediction operations, System.Guid appId, string query, double? timezoneOffset = default(double?), bool? verbose = default(bool?), bool? staging = default(bool?), bool? spellCheck = default(bool?), string bingSpellCheckSubscriptionKey = default(string), bool? log = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ResolveWithHttpMessagesAsync(appId, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, log, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionOperations.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionOperations.cs new file mode 100644 index 000000000000..63d9f2e3bdf0 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionOperations.cs @@ -0,0 +1,468 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PredictionOperations operations. + /// + public partial class PredictionOperations : IServiceOperations, IPredictionOperations + { + /// + /// Initializes a new instance of the PredictionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public PredictionOperations(LUISRuntimeClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the LUISRuntimeClient + /// + public LUISRuntimeClient Client { get; private set; } + + /// + /// Gets the predictions for an application version. + /// + /// + /// The application ID. + /// + /// + /// The application version ID. + /// + /// + /// The prediction request parameters. + /// + /// + /// Indicates whether to get extra metadata for the entities predictions or + /// not. + /// + /// + /// Indicates whether to return all the intents in the response or just the top + /// intent. + /// + /// + /// Indicates whether to log the endpoint query or not. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetVersionPredictionWithHttpMessagesAsync(System.Guid appId, string versionId, PredictionRequest predictionRequest, bool? verbose = default(bool?), bool? showAllIntents = default(bool?), bool? log = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (versionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "versionId"); + } + if (predictionRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "predictionRequest"); + } + if (predictionRequest != null) + { + predictionRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("appId", appId); + tracingParameters.Add("versionId", versionId); + tracingParameters.Add("verbose", verbose); + tracingParameters.Add("showAllIntents", showAllIntents); + tracingParameters.Add("log", log); + tracingParameters.Add("predictionRequest", predictionRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetVersionPrediction", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "apps/{appId}/versions/{versionId}/predict"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + _url = _url.Replace("{appId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(appId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{versionId}", System.Uri.EscapeDataString(versionId)); + List _queryParameters = new List(); + if (verbose != null) + { + _queryParameters.Add(string.Format("verbose={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(verbose, Client.SerializationSettings).Trim('"')))); + } + if (showAllIntents != null) + { + _queryParameters.Add(string.Format("show-all-intents={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(showAllIntents, Client.SerializationSettings).Trim('"')))); + } + if (log != null) + { + _queryParameters.Add(string.Format("log={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(log, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(predictionRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(predictionRequest, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the predictions for an application slot. + /// + /// + /// The application ID. + /// + /// + /// The application slot name. + /// + /// + /// The prediction request parameters. + /// + /// + /// Indicates whether to get extra metadata for the entities predictions or + /// not. + /// + /// + /// Indicates whether to return all the intents in the response or just the top + /// intent. + /// + /// + /// Indicates whether to log the endpoint query or not. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetSlotPredictionWithHttpMessagesAsync(System.Guid appId, string slotName, PredictionRequest predictionRequest, bool? verbose = default(bool?), bool? showAllIntents = default(bool?), bool? log = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (slotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "slotName"); + } + if (predictionRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "predictionRequest"); + } + if (predictionRequest != null) + { + predictionRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("appId", appId); + tracingParameters.Add("slotName", slotName); + tracingParameters.Add("verbose", verbose); + tracingParameters.Add("showAllIntents", showAllIntents); + tracingParameters.Add("log", log); + tracingParameters.Add("predictionRequest", predictionRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetSlotPrediction", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "apps/{appId}/slots/{slotName}/predict"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + _url = _url.Replace("{appId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(appId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{slotName}", System.Uri.EscapeDataString(slotName)); + List _queryParameters = new List(); + if (verbose != null) + { + _queryParameters.Add(string.Format("verbose={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(verbose, Client.SerializationSettings).Trim('"')))); + } + if (showAllIntents != null) + { + _queryParameters.Add(string.Format("show-all-intents={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(showAllIntents, Client.SerializationSettings).Trim('"')))); + } + if (log != null) + { + _queryParameters.Add(string.Format("log={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(log, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(predictionRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(predictionRequest, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionOperationsExtensions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionOperationsExtensions.cs new file mode 100644 index 000000000000..a35897547422 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/PredictionOperationsExtensions.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PredictionOperations. + /// + public static partial class PredictionOperationsExtensions + { + /// + /// Gets the predictions for an application version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The application ID. + /// + /// + /// The application version ID. + /// + /// + /// The prediction request parameters. + /// + /// + /// Indicates whether to get extra metadata for the entities predictions or + /// not. + /// + /// + /// Indicates whether to return all the intents in the response or just the top + /// intent. + /// + /// + /// Indicates whether to log the endpoint query or not. + /// + /// + /// The cancellation token. + /// + public static async Task GetVersionPredictionAsync(this IPredictionOperations operations, System.Guid appId, string versionId, PredictionRequest predictionRequest, bool? verbose = default(bool?), bool? showAllIntents = default(bool?), bool? log = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetVersionPredictionWithHttpMessagesAsync(appId, versionId, predictionRequest, verbose, showAllIntents, log, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the predictions for an application slot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The application ID. + /// + /// + /// The application slot name. + /// + /// + /// The prediction request parameters. + /// + /// + /// Indicates whether to get extra metadata for the entities predictions or + /// not. + /// + /// + /// Indicates whether to return all the intents in the response or just the top + /// intent. + /// + /// + /// Indicates whether to log the endpoint query or not. + /// + /// + /// The cancellation token. + /// + public static async Task GetSlotPredictionAsync(this IPredictionOperations operations, System.Guid appId, string slotName, PredictionRequest predictionRequest, bool? verbose = default(bool?), bool? showAllIntents = default(bool?), bool? log = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetSlotPredictionWithHttpMessagesAsync(appId, slotName, predictionRequest, verbose, showAllIntents, log, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs index 53b934b8c443..6bf95b860e66 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs @@ -19,9 +19,20 @@ public static IEnumerable> ApiInfo_LUISRuntimeClie { return new Tuple[] { - new Tuple("LUISRuntimeClient", "Prediction", "2.0"), + new Tuple("LUISRuntimeClient", "Prediction", "3.0-preview"), }.AsEnumerable(); } } + // BEGIN: Code Generation Metadata Section + public static readonly String AutoRestVersion = "latest"; + public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; + public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md --csharp --version=latest --reflect-api-versions --tag=runtime_3_0_preview --csharp-sdks-folder=D:\\Work\\Github\\azure-sdk-for-net\\src\\SDKs"; + public static readonly String GithubForkName = "Azure"; + public static readonly String GithubBranchName = "master"; + public static readonly String GithubCommidId = "03a7910b132cb28019d1730a1daaad91ee461910"; + public static readonly String CodeGenerationErrors = ""; + public static readonly String GithubRepoName = "azure-rest-api-specs"; + // END: Code Generation Metadata Section } } + diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/generate.ps1 b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/generate.ps1 index c3df18acb4f8..c4ad7226a91f 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/generate.ps1 +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/generate.ps1 @@ -1 +1 @@ -Start-AutoRestCodeGeneration -ResourceProvider "cognitiveservices/data-plane/LUIS/Runtime" -AutoRestVersion "latest" \ No newline at end of file +Start-AutoRestCodeGeneration -ResourceProvider "cognitiveservices/data-plane/LUIS/Runtime" -AutoRestVersion "latest" -ConfigFileTag "runtime_3_0_preview" \ No newline at end of file diff --git a/src/SDKs/_metadata/cognitiveservices_data-plane_LUIS_Runtime.txt b/src/SDKs/_metadata/cognitiveservices_data-plane_LUIS_Runtime.txt index 4cf260674980..66a65a8fc4f7 100644 --- a/src/SDKs/_metadata/cognitiveservices_data-plane_LUIS_Runtime.txt +++ b/src/SDKs/_metadata/cognitiveservices_data-plane_LUIS_Runtime.txt @@ -3,12 +3,12 @@ AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\Work\azure-sdk-for-net-fork\src\SDKs -2019-02-05 18:29:53 UTC +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md --csharp --version=latest --reflect-api-versions --tag=runtime_3_0_preview --csharp-sdks-folder=D:\Work\Github\azure-sdk-for-net\src\SDKs +2019-04-29 17:34:00 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 9da47072c2a912065239412c13125e3242d7a8f7 +Commit: 03a7910b132cb28019d1730a1daaad91ee461910 AutoRest information Requested version: latest Bootstrapper version: autorest@2.0.4283 From 9633fa0028694b66b67e7e0557791ec6ced8c3fa Mon Sep 17 00:00:00 2001 From: Mohamed Abbas Date: Mon, 29 Apr 2019 22:22:24 +0200 Subject: [PATCH 2/5] Update the Nuget package version to 2.8.0-preview --- .../Microsoft.Azure.CognitiveServices.LUIS.Runtime.csproj | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Microsoft.Azure.CognitiveServices.LUIS.Runtime.csproj b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Microsoft.Azure.CognitiveServices.LUIS.Runtime.csproj index 3ca1ea0dc011..534ff3607d6b 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Microsoft.Azure.CognitiveServices.LUIS.Runtime.csproj +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Microsoft.Azure.CognitiveServices.LUIS.Runtime.csproj @@ -6,15 +6,14 @@ Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime Provides API functions for consuming the Microsoft Azure Cognitive Services LUIS Runtime API. - 2.1.0 + 2.8.0-preview Microsoft.Azure.CognitiveServices.Language.LUIS Microsoft Cognitive Services;Cognitive Services;Cognitive Services SDK;LUIS;Language Understanding Intelligent Service;Language Understanding;REST HTTP client false From 13a5aa4bee380541444ce17fb23de37b02696f06 Mon Sep 17 00:00:00 2001 From: Mohamed Abbas Date: Tue, 30 Apr 2019 00:07:59 +0200 Subject: [PATCH 3/5] Update the AssemblyVersion and the package release notes --- .../Microsoft.Azure.CognitiveServices.LUIS.Runtime.csproj | 3 ++- .../Language/LUIS/Runtime/Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Microsoft.Azure.CognitiveServices.LUIS.Runtime.csproj b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Microsoft.Azure.CognitiveServices.LUIS.Runtime.csproj index 534ff3607d6b..06fadb0437b2 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Microsoft.Azure.CognitiveServices.LUIS.Runtime.csproj +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Microsoft.Azure.CognitiveServices.LUIS.Runtime.csproj @@ -13,7 +13,8 @@ false diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Properties/AssemblyInfo.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Properties/AssemblyInfo.cs index a952b7d95b4f..a2f84fc58d9c 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Properties/AssemblyInfo.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ [assembly: AssemblyTitle("Microsoft Azure Cognitive Services Language LUIS")] [assembly: AssemblyDescription("Provides API functions for consuming the Microsoft Azure Cognitive Services LUIS Runtime API.")] -[assembly: AssemblyVersion("2.0.0.0")] -[assembly: AssemblyFileVersion("2.1.0.0")] +[assembly: AssemblyVersion("2.8.0.0")] +[assembly: AssemblyFileVersion("2.8.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] From 9079ef4718343d172a9726f2e3bef34978eb528b Mon Sep 17 00:00:00 2001 From: Mohamed Abbas Date: Tue, 30 Apr 2019 01:45:24 +0200 Subject: [PATCH 4/5] Generate the SDK using the default specs --- .../LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs | 4 ++-- .../dataPlane/Language/LUIS/Runtime/generate.ps1 | 2 +- .../_metadata/cognitiveservices_data-plane_LUIS_Runtime.txt | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs index 6bf95b860e66..2558a3346460 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Generated/SdkInfo_LUISRuntimeClient.cs @@ -26,10 +26,10 @@ public static IEnumerable> ApiInfo_LUISRuntimeClie // BEGIN: Code Generation Metadata Section public static readonly String AutoRestVersion = "latest"; public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md --csharp --version=latest --reflect-api-versions --tag=runtime_3_0_preview --csharp-sdks-folder=D:\\Work\\Github\\azure-sdk-for-net\\src\\SDKs"; + public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\Work\\Github\\azure-sdk-for-net\\src\\SDKs"; public static readonly String GithubForkName = "Azure"; public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "03a7910b132cb28019d1730a1daaad91ee461910"; + public static readonly String GithubCommidId = "d032d5ee22c98f6152fc9c34f7d03717ebf6f994"; public static readonly String CodeGenerationErrors = ""; public static readonly String GithubRepoName = "azure-rest-api-specs"; // END: Code Generation Metadata Section diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/generate.ps1 b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/generate.ps1 index c4ad7226a91f..c3df18acb4f8 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/generate.ps1 +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/generate.ps1 @@ -1 +1 @@ -Start-AutoRestCodeGeneration -ResourceProvider "cognitiveservices/data-plane/LUIS/Runtime" -AutoRestVersion "latest" -ConfigFileTag "runtime_3_0_preview" \ No newline at end of file +Start-AutoRestCodeGeneration -ResourceProvider "cognitiveservices/data-plane/LUIS/Runtime" -AutoRestVersion "latest" \ No newline at end of file diff --git a/src/SDKs/_metadata/cognitiveservices_data-plane_LUIS_Runtime.txt b/src/SDKs/_metadata/cognitiveservices_data-plane_LUIS_Runtime.txt index 66a65a8fc4f7..df5775c54f89 100644 --- a/src/SDKs/_metadata/cognitiveservices_data-plane_LUIS_Runtime.txt +++ b/src/SDKs/_metadata/cognitiveservices_data-plane_LUIS_Runtime.txt @@ -3,12 +3,12 @@ AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md --csharp --version=latest --reflect-api-versions --tag=runtime_3_0_preview --csharp-sdks-folder=D:\Work\Github\azure-sdk-for-net\src\SDKs -2019-04-29 17:34:00 UTC +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/LUIS/Runtime/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\Work\Github\azure-sdk-for-net\src\SDKs +2019-04-29 23:40:42 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 03a7910b132cb28019d1730a1daaad91ee461910 +Commit: d032d5ee22c98f6152fc9c34f7d03717ebf6f994 AutoRest information Requested version: latest Bootstrapper version: autorest@2.0.4283 From 69c703d07c3a854048b99064c9d947212d734ab8 Mon Sep 17 00:00:00 2001 From: Mohamed Abbas Date: Tue, 30 Apr 2019 18:14:03 +0200 Subject: [PATCH 5/5] Revert AssemblyVersion update --- .../dataPlane/Language/LUIS/Runtime/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Properties/AssemblyInfo.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Properties/AssemblyInfo.cs index a2f84fc58d9c..90db274838bb 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Properties/AssemblyInfo.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Runtime/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ [assembly: AssemblyTitle("Microsoft Azure Cognitive Services Language LUIS")] [assembly: AssemblyDescription("Provides API functions for consuming the Microsoft Azure Cognitive Services LUIS Runtime API.")] -[assembly: AssemblyVersion("2.8.0.0")] +[assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.8.0.0")] [assembly: AssemblyConfiguration("")]