From c9072dacc3289b59132c376a6ed57daa963dc200 Mon Sep 17 00:00:00 2001 From: John Huang Date: Thu, 9 Dec 2021 00:35:33 -0800 Subject: [PATCH 01/33] 12767912: Add isLocalInference in the public SDK --- .../src/Generated/MultiSlotClient.cs | 23 +++++++++++++++++++ .../src/Generated/RankClient.cs | 23 +++++++++++++++++++ .../src/Models/PersonalizerClient.cs | 23 +++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs index 87b0f06f7775..b00e3ded608a 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs @@ -19,6 +19,7 @@ internal partial class MultiSlotClient { private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; + private readonly bool _isLocalReference; internal MultiSlotRestClient RestClient { get; } /// Initializes a new instance of MultiSlotClient for mocking. @@ -48,6 +49,17 @@ public MultiSlotClient(string endpoint, TokenCredential credential, Personalizer RestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, endpoint); } + /// Initializes a new instance of PersonalizerClient. + /// Supported Cognitive Services endpoint. + /// A credential used to authenticate to an Azure Service. + /// A flag to determine whether to use local reference. + /// The options for configuring the client. + public MultiSlotClient(string endpoint, TokenCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + this(endpoint, credential, options) + { + _isLocalReference = isLocalReference; + } + /// Initializes a new instance of MultiSlotClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. @@ -69,6 +81,17 @@ public MultiSlotClient(string endpoint, AzureKeyCredential credential, Personali RestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, endpoint); } + /// Initializes a new instance of PersonalizerClient. + /// Supported Cognitive Services endpoint. + /// A credential used to authenticate to an Azure Service. + /// A flag to determine whether to use local reference. + /// The options for configuring the client. + public MultiSlotClient(string endpoint, AzureKeyCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + this(endpoint, credential, options) + { + _isLocalReference = isLocalReference; + } + /// Initializes a new instance of MultiSlotClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs index 956b7ff668de..89264139ad05 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs @@ -19,6 +19,7 @@ internal partial class RankClient { private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; + private readonly bool _isLocalReference; internal RankRestClient RestClient { get; } /// Initializes a new instance of RankClient for mocking. @@ -48,6 +49,17 @@ public RankClient(string endpoint, TokenCredential credential, PersonalizerClien RestClient = new RankRestClient(_clientDiagnostics, _pipeline, endpoint); } + /// Initializes a new instance of PersonalizerClient. + /// Supported Cognitive Services endpoint. + /// A credential used to authenticate to an Azure Service. + /// A flag to determine whether to use local reference. + /// The options for configuring the client. + public RankClient(string endpoint, TokenCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + this(endpoint, credential, options) + { + _isLocalReference = isLocalReference; + } + /// Initializes a new instance of RankClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. @@ -69,6 +81,17 @@ public RankClient(string endpoint, AzureKeyCredential credential, PersonalizerCl RestClient = new RankRestClient(_clientDiagnostics, _pipeline, endpoint); } + /// Initializes a new instance of PersonalizerClient. + /// Supported Cognitive Services endpoint. + /// A credential used to authenticate to an Azure Service. + /// A flag to determine whether to use local reference. + /// The options for configuring the client. + public RankClient(string endpoint, AzureKeyCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + this(endpoint, credential, options) + { + _isLocalReference = isLocalReference; + } + /// Initializes a new instance of RankClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index 94d1ad144b2c..45b25871bcd6 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -16,6 +16,7 @@ public class PersonalizerClient { private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; + private readonly bool _isLocalReference; internal RankRestClient RankRestClient { get; set; } internal EventsRestClient EventsRestClient { get; set; } internal MultiSlotRestClient MultiSlotRestClient { get; set; } @@ -52,6 +53,17 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer MultiSlotEventsRestClient = new MultiSlotEventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); } + /// Initializes a new instance of PersonalizerClient. + /// Supported Cognitive Services endpoint. + /// A credential used to authenticate to an Azure Service. + /// A flag to determine whether to use local reference. + /// The options for configuring the client. + public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + this(endpoint, credential, options) + { + _isLocalReference = isLocalReference; + } + /// Initializes a new instance of PersonalizerClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. @@ -82,6 +94,17 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali MultiSlotEventsRestClient = new MultiSlotEventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); } + /// Initializes a new instance of PersonalizerClient. + /// Supported Cognitive Services endpoint. + /// A credential used to authenticate to an Azure Service. + /// A flag to determine whether to use local reference. + /// The options for configuring the client. + public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + this(endpoint, credential, options) + { + _isLocalReference = isLocalReference; + } + /// Initializes a new instance of PersonalizerClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. From 2dc705ebc4a0f6373983a16a0d33f23cb8fb1c0e Mon Sep 17 00:00:00 2001 From: John Huang Date: Thu, 9 Dec 2021 15:01:30 -0800 Subject: [PATCH 02/33] Rename the variable --- .../src/Generated/MultiSlotClient.cs | 14 +++++++------- .../src/Generated/RankClient.cs | 14 +++++++------- .../src/Models/PersonalizerClient.cs | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs index b00e3ded608a..5691244d0075 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs @@ -19,7 +19,7 @@ internal partial class MultiSlotClient { private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; - private readonly bool _isLocalReference; + private readonly bool _isLocalInference; internal MultiSlotRestClient RestClient { get; } /// Initializes a new instance of MultiSlotClient for mocking. @@ -52,12 +52,12 @@ public MultiSlotClient(string endpoint, TokenCredential credential, Personalizer /// Initializes a new instance of PersonalizerClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local reference. + /// A flag to determine whether to use local inference. /// The options for configuring the client. - public MultiSlotClient(string endpoint, TokenCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + public MultiSlotClient(string endpoint, TokenCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { - _isLocalReference = isLocalReference; + _isLocalInference = isLocalInference; } /// Initializes a new instance of MultiSlotClient. @@ -84,12 +84,12 @@ public MultiSlotClient(string endpoint, AzureKeyCredential credential, Personali /// Initializes a new instance of PersonalizerClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local reference. + /// A flag to determine whether to use local inference. /// The options for configuring the client. - public MultiSlotClient(string endpoint, AzureKeyCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + public MultiSlotClient(string endpoint, AzureKeyCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { - _isLocalReference = isLocalReference; + _isLocalInference = isLocalInference; } /// Initializes a new instance of MultiSlotClient. diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs index 89264139ad05..d0473d9cf981 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs @@ -19,7 +19,7 @@ internal partial class RankClient { private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; - private readonly bool _isLocalReference; + private readonly bool _isLocalInference; internal RankRestClient RestClient { get; } /// Initializes a new instance of RankClient for mocking. @@ -52,12 +52,12 @@ public RankClient(string endpoint, TokenCredential credential, PersonalizerClien /// Initializes a new instance of PersonalizerClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local reference. + /// A flag to determine whether to use local inference. /// The options for configuring the client. - public RankClient(string endpoint, TokenCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + public RankClient(string endpoint, TokenCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { - _isLocalReference = isLocalReference; + _isLocalInference = isLocalInference; } /// Initializes a new instance of RankClient. @@ -84,12 +84,12 @@ public RankClient(string endpoint, AzureKeyCredential credential, PersonalizerCl /// Initializes a new instance of PersonalizerClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local reference. + /// A flag to determine whether to use local reference. /// The options for configuring the client. - public RankClient(string endpoint, AzureKeyCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + public RankClient(string endpoint, AzureKeyCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { - _isLocalReference = isLocalReference; + _isLocalInference = isLocalInference; } /// Initializes a new instance of RankClient. diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index 45b25871bcd6..f8f6c223eb18 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -16,7 +16,7 @@ public class PersonalizerClient { private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; - private readonly bool _isLocalReference; + private readonly bool _isLocalInference; internal RankRestClient RankRestClient { get; set; } internal EventsRestClient EventsRestClient { get; set; } internal MultiSlotRestClient MultiSlotRestClient { get; set; } @@ -56,12 +56,12 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer /// Initializes a new instance of PersonalizerClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local reference. + /// A flag to determine whether to use local inference. /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { - _isLocalReference = isLocalReference; + _isLocalInference = isLocalInference; } /// Initializes a new instance of PersonalizerClient. @@ -97,12 +97,12 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali /// Initializes a new instance of PersonalizerClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local reference. + /// A flag to determine whether to use local inference. /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalReference, PersonalizerClientOptions options = null) : + public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { - _isLocalReference = isLocalReference; + _isLocalInference = isLocalInference; } /// Initializes a new instance of PersonalizerClient. From 926c45002326a01edd0474a3e3d292f08636af50 Mon Sep 17 00:00:00 2001 From: johnhuang01 <90279783+johnhuang01@users.noreply.github.com> Date: Tue, 25 Jan 2022 14:12:38 -0800 Subject: [PATCH 03/33] Thick clent feature (#5) * 12767907: Add a package dependency on Microsoft.RL * Add RankProcessor * Remove unused file * Remove some key * Toggle commented codes so that most tests can pass * Getting the required config details for rankprocessor to enable livemode * Updating the wrong variable name * Cleanup * Revert "12767907: Add a package dependency on Microsoft.RL" This reverts commit c5869208c68ea592562e6d05278bfce26ac748de. * Revert "Add RankProcessor" This reverts commit 43967d3a10108da239119b6a06e889efcade6c75. * Revert "Remove unused file" This reverts commit 1e400a8db978fc13d32387b945ca295b193536fe. * Revert "Toggle commented codes so that most tests can pass" This reverts commit 7ec50ecb5aa202416da0d28f4950938824d392d8. * Delete DisposeHelper.cs * Revert "Revert "12767907: Add a package dependency on Microsoft.RL"" This reverts commit d6df6b5a86d302b624df2978b8629f330f145ea3. * Cleanup after reverting * generating client configuration using autorest * Revert "generating client configuration using autorest" This reverts commit 6b7569565cd7f64d754c81255f2b408283ba3afe. * Configuration details for livemodel * cleanup * cleanup * Added ToDo comments * correct the version in endpoints Co-authored-by: Tejaswi Paruchuri Co-authored-by: Tparuchuri <86433817+Tparuchuri@users.noreply.github.com> --- NuGet.Config | 1 + .../src/Azure.AI.Personalizer.csproj | 1 + .../src/Models/PersonalizerClient.cs | 84 +++++++++++++++++-- .../Infrastructure/PersonalizerTestBase.cs | 15 +++- 4 files changed, 91 insertions(+), 10 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index be103949f661..7b6da4adea45 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -10,6 +10,7 @@ Used for azure-sdk-tools repo until issue https://github.com/Azure/azure-sdk-tools/issues/1329 is addressed --> + diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj b/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj index 56be15a9d198..701ab2461555 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj @@ -32,6 +32,7 @@ + diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index f8f6c223eb18..f729f7305b83 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -3,10 +3,14 @@ using System; using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Net; using System.Threading; using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; +using Rl.Net; namespace Azure.AI.Personalizer { @@ -17,10 +21,17 @@ public class PersonalizerClient private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; private readonly bool _isLocalInference; + private string stringEndpoint; + private string apiKey; + internal RankRestClient RankRestClient { get; set; } internal EventsRestClient EventsRestClient { get; set; } internal MultiSlotRestClient MultiSlotRestClient { get; set; } internal MultiSlotEventsRestClient MultiSlotEventsRestClient { get; set; } + internal ServiceConfigurationRestClient ServiceConfigurationRestClient { get; set; } + internal PolicyRestClient PolicyRestClient { get; set; } + internal PersonalizerServiceProperties _personalizerServiceProperties { get; set; } + internal PersonalizerPolicy _personalizerPolicy { get; set; } /// Initializes a new instance of Personalizer Client for mocking. protected PersonalizerClient() @@ -46,11 +57,13 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer _clientDiagnostics = new ClientDiagnostics(options); string[] scopes = { "https://cognitiveservices.azure.com/.default" }; _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes)); - string stringEndpoint = endpoint.AbsoluteUri; + stringEndpoint = endpoint.AbsoluteUri; RankRestClient = new RankRestClient(_clientDiagnostics, _pipeline, stringEndpoint); EventsRestClient = new EventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); MultiSlotRestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, stringEndpoint); MultiSlotEventsRestClient = new MultiSlotEventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); + ServiceConfigurationRestClient = new ServiceConfigurationRestClient(_clientDiagnostics, _pipeline, stringEndpoint); + PolicyRestClient = new PolicyRestClient(_clientDiagnostics, _pipeline, stringEndpoint); } /// Initializes a new instance of PersonalizerClient. @@ -62,12 +75,18 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocal this(endpoint, credential, options) { _isLocalInference = isLocalInference; + if (isLocalInference) + { + //Intialize liveModel and call Rank processor + //ToDo:TASK 13057958: Working on changes to support token authentication in RLClient + //Configuration config = GetConfigurationForLiveModel("Token", "token"); + } } /// Initializes a new instance of PersonalizerClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. - public PersonalizerClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, null){ } + public PersonalizerClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, null) { } /// Initializes a new instance of PersonalizerClient. /// Supported Cognitive Services endpoint. @@ -83,15 +102,17 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali { throw new ArgumentNullException(nameof(credential)); } - + apiKey = credential.Key; options ??= new PersonalizerClientOptions(); _clientDiagnostics = new ClientDiagnostics(options); _pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key")); - string stringEndpoint = endpoint.AbsoluteUri; + stringEndpoint = endpoint.AbsoluteUri; RankRestClient = new RankRestClient(_clientDiagnostics, _pipeline, stringEndpoint); EventsRestClient = new EventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); MultiSlotRestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, stringEndpoint); MultiSlotEventsRestClient = new MultiSlotEventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); + ServiceConfigurationRestClient = new ServiceConfigurationRestClient(_clientDiagnostics, _pipeline, stringEndpoint); + PolicyRestClient = new PolicyRestClient(_clientDiagnostics, _pipeline, stringEndpoint); } /// Initializes a new instance of PersonalizerClient. @@ -103,12 +124,17 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLo this(endpoint, credential, options) { _isLocalInference = isLocalInference; + if (isLocalInference) + { + //Intialize liveModel and Rankprocessor + Configuration config = GetConfigurationForLiveModel("apiKey", apiKey); + } } /// Initializes a new instance of PersonalizerClient. /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. - public PersonalizerClient(Uri endpoint, AzureKeyCredential credential): this(endpoint, credential, null) { } + public PersonalizerClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, null) { } /// Initializes a new instance of MultiSlotEventsClient. /// The handler for diagnostic messaging in the client. @@ -134,7 +160,15 @@ public virtual async Task> RankAsync(Personaliz scope.Start(); try { - return await RankRestClient.RankAsync(options, cancellationToken).ConfigureAwait(false); + if (_isLocalInference) + { + //return RankProcessor result here + return null; + } + else + { + return await RankRestClient.RankAsync(options, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -177,7 +211,15 @@ public virtual Response Rank(PersonalizerRankOptions opt scope.Start(); try { - return RankRestClient.Rank(options, cancellationToken); + if (_isLocalInference) + { + //return RankProcessor result here + return null; + } + else + { + return RankRestClient.Rank(options, cancellationToken); + } } catch (Exception e) { @@ -482,5 +524,33 @@ public virtual Response ActivateMultiSlot(string eventId, CancellationToken canc throw; } } + + /// Gets the configuration details for the live model to use + internal Configuration GetConfigurationForLiveModel(string authType, string authValue) + { + _personalizerServiceProperties = ServiceConfigurationRestClient.Get(); + _personalizerPolicy = PolicyRestClient.Get(); + Configuration config = new Configuration(); + // set up the model + if (authType == "apiKey") + { + config["http.api.key"] = authValue; + } + else + { + //ToDo: TASK 13057958 Working on changes to support token authentication in RLClient + //config["http.token.key"] = authValue; + } + config["interaction.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.1/logs/interactions"; + config["observation.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.1/logs/observations"; + //ToDo: TASK 13057958 Working on changes to support model api in RL.Net + config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.1/model"; + config["vw.commandline"] = _personalizerPolicy.Arguments; + config["protocol.version"] = "2"; + config["initial_exploration.epsilon"] = Convert.ToString(_personalizerServiceProperties.ExplorationPercentage, CultureInfo.InvariantCulture); + config["rank.learning.mode"] = Convert.ToString(_personalizerServiceProperties.LearningMode, CultureInfo.InvariantCulture); + //return the config model + return config; + } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs index a27c34534ee9..d2604d28806f 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs @@ -11,14 +11,14 @@ public abstract class PersonalizerTestBase : RecordedTestBase GetPersonalizerClientAsync(bool isSingleSlot = false) + protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false, bool isLocalInference = false) { string endpoint = isSingleSlot ? TestEnvironment.SingleSlotEndpoint : TestEnvironment.MultiSlotEndpoint; string apiKey = isSingleSlot ? TestEnvironment.SingleSlotApiKey : TestEnvironment.MultiSlotApiKey; @@ -29,7 +29,16 @@ protected async Task GetPersonalizerClientAsync(bool isSingl } var credential = new AzureKeyCredential(apiKey); var options = InstrumentClientOptions(new PersonalizerClientOptions()); - PersonalizerClient personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, options); + PersonalizerClient personalizerClient = null; + if (isLocalInference) + { + personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options); + } + else + { + personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, options); + } + personalizerClient = InstrumentClient(personalizerClient); return personalizerClient; } From 526b2bbb9c88d215e301de17dc848b42968dfd0f Mon Sep 17 00:00:00 2001 From: johnhuang01 <90279783+johnhuang01@users.noreply.github.com> Date: Tue, 25 Jan 2022 16:16:28 -0800 Subject: [PATCH 04/33] 12768045: Add rank processor for single slot (#3) Add RankProcessor Remove unused file Remove some key Toggle commented codes so that most tests can pass RankProcessor is working. Still need to clean up the codes Add test json files only construct LiveModel when localInference is true Move rankprocessor to under model Add latest generated files from autorest Add autogenerated files from autorest Fix the setting in DecisionContext Remove wrong comment Revert unexpected auto-generated file changes Addressed a comment Move suppression to GlobalSuppressions.cs Remove the decoration in MultiSlotClient.cs Refactor rankProcessor so that the actions is not modified and restored; added a converter between sdk and Rl.Net; replace Newtonsoft.json with System.Text.Json Address comments Refactor RlObjuectConverter; remove some unneeded setters, etc. Added unit tests for RlObjectConverter, DecisionContext, JsonRawStringListConverter Remove unused using --- .../src/Azure.Core.TestFramework.csproj | 1 + .../src/TestRecording.cs | 2 + .../src/Azure.AI.Personalizer.csproj | 3 +- .../Generated/Models/PersonalizerErrorCode.cs | 2 +- .../Models/PersonalizerEvaluationJobStatus.cs | 2 +- .../Models/PersonalizerEvaluationType.cs | 2 +- .../Models/PersonalizerLearningMode.cs | 2 +- ...PersonalizerLogProperties.Serialization.cs | 16 ++ .../Models/PersonalizerPolicySource.cs | 2 +- .../Models/PersonalizerRankResult.cs | 6 +- .../Models/PersonalizerRankedAction.cs | 4 +- .../src/Generated/Models/ServiceStatus.cs | 3 + .../src/Generated/MultiSlotClient.cs | 21 +- .../src/Generated/RankClient.cs | 30 ++- .../src/Models/DecisionContext.cs | 49 ++++ .../src/Models/DecisionContextDocument.cs | 68 ++++++ .../Models/DecisionContextDocumentSource.cs | 19 ++ .../src/Models/JsonRawStringListConverter.cs | 39 +++ .../src/Models/PersonalizerClient.cs | 20 +- .../src/Models/PersonalizerRankableAction.cs | 5 + .../src/Models/RankProcessor.cs | 72 ++++++ .../src/Models/RlObjectConverter.cs | 91 +++++++ .../tests/Azure.AI.Personalizer.Tests.csproj | 4 + .../Personalizer/DecisionContextTests.cs | 33 +++ .../JsonRawStringListConverterTests.cs | 29 +++ .../tests/Personalizer/RankTests.cs | 12 + .../Personalizer/RlObjectConverterTests.cs | 45 ++++ .../SingleSlotRankLocalInferenceTests.json | 225 ++++++++++++++++++ ...ingleSlotRankLocalInferenceTestsAsync.json | 225 ++++++++++++++++++ 29 files changed, 1008 insertions(+), 24 deletions(-) create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerLogProperties.Serialization.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentSource.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/JsonRawStringListConverter.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/RankProcessor.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/JsonRawStringListConverterTests.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json diff --git a/sdk/core/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj b/sdk/core/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj index 24a3cd4bb1bf..a25ee8a75765 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj +++ b/sdk/core/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj @@ -1,6 +1,7 @@  $(RequiredTargetFrameworks);net47 + $(NoWarn);CS8032 true diff --git a/sdk/core/Azure.Core.TestFramework/src/TestRecording.cs b/sdk/core/Azure.Core.TestFramework/src/TestRecording.cs index 0776c070f0d7..d406fa419ac6 100644 --- a/sdk/core/Azure.Core.TestFramework/src/TestRecording.cs +++ b/sdk/core/Azure.Core.TestFramework/src/TestRecording.cs @@ -210,10 +210,12 @@ public TestRandom Random #if NET6_0_OR_GREATER var liveSeed = RandomNumberGenerator.GetInt32(int.MaxValue); #else +#pragma warning disable SYSLIB0023 var csp = new RNGCryptoServiceProvider(); var bytes = new byte[4]; csp.GetBytes(bytes); var liveSeed = BitConverter.ToInt32(bytes, 0); +#pragma warning restore SYSLIB0023 #endif _random = new TestRandom(Mode, liveSeed); break; diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj b/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj index 701ab2461555..3a4a5faa2a62 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj @@ -1,4 +1,4 @@ - + Microsoft Azure.AI.Personalizer client library 2.0.0-beta.2 @@ -33,6 +33,7 @@ + diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerErrorCode.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerErrorCode.cs index 8fa9cdc7fb79..f089ff68ef64 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerErrorCode.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerErrorCode.cs @@ -15,7 +15,7 @@ namespace Azure.AI.Personalizer.Models { private readonly string _value; - /// Determines if two values are the same. + /// Initializes a new instance of . /// is null. public PersonalizerErrorCode(string value) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerEvaluationJobStatus.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerEvaluationJobStatus.cs index 085e5f329912..389201f0f3dd 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerEvaluationJobStatus.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerEvaluationJobStatus.cs @@ -15,7 +15,7 @@ namespace Azure.AI.Personalizer { private readonly string _value; - /// Determines if two values are the same. + /// Initializes a new instance of . /// is null. public PersonalizerEvaluationJobStatus(string value) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerEvaluationType.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerEvaluationType.cs index 9a313a1f08e8..96785da12f5e 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerEvaluationType.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerEvaluationType.cs @@ -15,7 +15,7 @@ namespace Azure.AI.Personalizer { private readonly string _value; - /// Determines if two values are the same. + /// Initializes a new instance of . /// is null. public PersonalizerEvaluationType(string value) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerLearningMode.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerLearningMode.cs index 8a4b6c377704..94137b19b95c 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerLearningMode.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerLearningMode.cs @@ -15,7 +15,7 @@ namespace Azure.AI.Personalizer { private readonly string _value; - /// Determines if two values are the same. + /// Initializes a new instance of . /// is null. public PersonalizerLearningMode(string value) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerLogProperties.Serialization.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerLogProperties.Serialization.cs new file mode 100644 index 000000000000..8260d0d25584 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerLogProperties.Serialization.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Personalizer +{ + public partial class PersonalizerLogProperties + { + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerPolicySource.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerPolicySource.cs index 0c7d1f64f6f7..905b6286b041 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerPolicySource.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerPolicySource.cs @@ -15,7 +15,7 @@ namespace Azure.AI.Personalizer { private readonly string _value; - /// Determines if two values are the same. + /// Initializes a new instance of . /// is null. public PersonalizerPolicySource(string value) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs index e6e3b8dbf890..629d36afdcb0 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs @@ -35,14 +35,14 @@ internal PersonalizerRankResult(IReadOnlyList ranking, } /// The calculated ranking for the current request. - public IReadOnlyList Ranking { get; } + public IReadOnlyList Ranking { get; set; } /// The eventId for the round trip from request to response. - public string EventId { get; } + public string EventId { get; set; } /// /// The action chosen by the Personalizer service. /// This is the action your application should display, and for which to report the reward. /// This might not be the first found in 'ranking'. /// - public string RewardActionId { get; } + public string RewardActionId { get; set; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs index 9d55861dba4d..304775da49e6 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs @@ -25,8 +25,8 @@ internal PersonalizerRankedAction(string id, float? probability) } /// Id of the action. - public string Id { get; } + public string Id { get; set; } /// Probability of the action. - public float? Probability { get; } + public float? Probability { get; set; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/ServiceStatus.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/ServiceStatus.cs index 2e47a345afb4..bec504a098b8 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/ServiceStatus.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/ServiceStatus.cs @@ -15,8 +15,11 @@ internal ServiceStatus() { } + /// Gets the service. public string Service { get; } + /// Gets the api status. public string ApiStatus { get; } + /// Gets the api status message. public string ApiStatusMessage { get; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs index 5691244d0075..78699b565ae0 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Rl.Net; namespace Azure.AI.Personalizer { @@ -20,6 +21,8 @@ internal partial class MultiSlotClient private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; private readonly bool _isLocalInference; + private readonly RankProcessor _rankProcessor; + internal MultiSlotRestClient RestClient { get; } /// Initializes a new instance of MultiSlotClient for mocking. @@ -53,11 +56,18 @@ public MultiSlotClient(string endpoint, TokenCredential credential, Personalizer /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. + /// A configuration to use local reference. /// The options for configuring the client. - public MultiSlotClient(string endpoint, TokenCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : + public MultiSlotClient(string endpoint, TokenCredential credential, bool isLocalInference = false, Configuration configuration = null, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; + if (isLocalInference) + { + LiveModel liveModel = new LiveModel(configuration); + liveModel.Init(); + _rankProcessor = new RankProcessor(liveModel); + } } /// Initializes a new instance of MultiSlotClient. @@ -85,11 +95,18 @@ public MultiSlotClient(string endpoint, AzureKeyCredential credential, Personali /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. + /// A configuration to use local reference. /// The options for configuring the client. - public MultiSlotClient(string endpoint, AzureKeyCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : + public MultiSlotClient(string endpoint, AzureKeyCredential credential, bool isLocalInference = false, Configuration configuration = null, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; + if (isLocalInference) + { + LiveModel liveModel = new LiveModel(configuration); + liveModel.Init(); + _rankProcessor = new RankProcessor(liveModel); + } } /// Initializes a new instance of MultiSlotClient. diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs index d0473d9cf981..aceb36681241 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Rl.Net; namespace Azure.AI.Personalizer { @@ -20,6 +21,7 @@ internal partial class RankClient private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; private readonly bool _isLocalInference; + private readonly RankProcessor _rankProcessor; internal RankRestClient RestClient { get; } /// Initializes a new instance of RankClient for mocking. @@ -53,11 +55,18 @@ public RankClient(string endpoint, TokenCredential credential, PersonalizerClien /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. + /// A configuration to use local reference. /// The options for configuring the client. - public RankClient(string endpoint, TokenCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : + public RankClient(string endpoint, TokenCredential credential, bool isLocalInference = false, Configuration configuration = null, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; + if (isLocalInference) + { + LiveModel liveModel = new LiveModel(configuration); + liveModel.Init(); + _rankProcessor = new RankProcessor(liveModel); + } } /// Initializes a new instance of RankClient. @@ -85,11 +94,19 @@ public RankClient(string endpoint, AzureKeyCredential credential, PersonalizerCl /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local reference. + /// A configuration to use local reference. /// The options for configuring the client. - public RankClient(string endpoint, AzureKeyCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : + public RankClient(string endpoint, AzureKeyCredential credential, bool isLocalInference = false, Configuration configuration = null, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; + if (isLocalInference) + { + LiveModel liveModel = new LiveModel(configuration); + liveModel.Init(); + _rankProcessor = new RankProcessor(liveModel); + } + } /// Initializes a new instance of RankClient. @@ -112,7 +129,14 @@ public virtual async Task> RankAsync(Personaliz scope.Start(); try { - return await RestClient.RankAsync(rankRequest, cancellationToken).ConfigureAwait(false); + if (_isLocalInference) + { + return _rankProcessor.Rank(rankRequest); + } + else + { + return await RestClient.RankAsync(rankRequest, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs new file mode 100644 index 000000000000..158498cf988e --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Personalizer +{ + /// The Decision Context. + public class DecisionContext + { + /// The Decision Context used to serialize an object. + public DecisionContext() + { + } + + /// Initializes a new instance of DecisionContext. + /// The context feature + /// Rankable actions + public DecisionContext(IEnumerable contextFeatures, List rankableActions) + { + this.ContextFeatures = contextFeatures.Select(f => JsonSerializer.Serialize(f)).ToList(); + this.Documents = rankableActions + .Select(action => + { + List actionFeatures = action.Features.Select(f => JsonSerializer.Serialize(f)).ToList(); + + return new DecisionContextDocument(action.Id, actionFeatures); + }).ToArray(); + } + + /// Properties from url + [JsonPropertyName("FromUrl")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonConverter(typeof(JsonRawStringListConverter))] + public List ContextFeatures { get; } + + /// Properties of documents + [JsonPropertyName("_multi")] + public DecisionContextDocument[] Documents { get; set; } + + /// Properties of slots + [JsonPropertyName("_slots")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public DecisionContextDocument[] Slots { get; set; } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs new file mode 100644 index 000000000000..593e15c2b529 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; +using System.Collections.Generic; + +namespace Azure.AI.Personalizer +{ + /// The Decision Context Document. + public class DecisionContextDocument + { + /// Initializes a new instance of DecisionContextDocument. + /// Id of the decision context document + /// The json features + public DecisionContextDocument(string id, List Json) + { + ID = id; + JSON = Json; + } + /// + /// Supply _tag for online evaluation + /// + [JsonPropertyName("_tag")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string ID + { + get; + set; + } + + /// + /// Provide source set feature. + /// + [JsonPropertyName("s")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public DecisionContextDocumentSource Source { get; set; } + + /// + /// Generic json features. + /// + [JsonPropertyName("j")] + [JsonConverter(typeof(JsonRawStringListConverter))] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public List JSON { get; } + + /// + /// Keep as float[] arrays to improve marshalling speed. + /// + [JsonPropertyName("f")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public Dictionary FloatFeatures { get; } + + /// + /// Slot ID. + /// + [JsonPropertyName("_id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string SlotId { get; set; } + + /// + /// Generic slot json features. + /// + [JsonPropertyName("sj")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonConverter(typeof(JsonRawStringListConverter))] + public List SlotJson { get; } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentSource.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentSource.cs new file mode 100644 index 000000000000..b114f161426b --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentSource.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; + +namespace Azure.AI.Personalizer +{ + /// The Decision Context Document Source. + public class DecisionContextDocumentSource + { + /// The set. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string Set { get; set; } + + /// The parameter. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string Parameter { get; set; } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/JsonRawStringListConverter.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/JsonRawStringListConverter.cs new file mode 100644 index 000000000000..4af15c062737 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/JsonRawStringListConverter.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using System.Text.Json.Serialization; +using System; +using System.Collections.Generic; + +namespace Azure.AI.Personalizer +{ + /// Json raw string list converter + internal class JsonRawStringListConverter : JsonConverter> + { + /// + /// Not implemented. + /// + public override List Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + + /// + /// Outputs the string contents as JSON. + /// + public override void Write(Utf8JsonWriter writer, List value, JsonSerializerOptions options) + { + if (value != null) + { + writer.WriteStartArray(); + foreach (var str in value) + writer.WriteRawValue(str); + writer.WriteEndArray(); + return; + } + + JsonSerializer.Serialize(writer, value); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index f729f7305b83..668b8b25f645 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -4,8 +4,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.IO; -using System.Net; using System.Threading; using System.Threading.Tasks; using Azure.Core; @@ -24,6 +22,8 @@ public class PersonalizerClient private string stringEndpoint; private string apiKey; + private readonly RankProcessor _rankProcessor; + internal RankRestClient RankRestClient { get; set; } internal EventsRestClient EventsRestClient { get; set; } internal MultiSlotRestClient MultiSlotRestClient { get; set; } @@ -79,7 +79,10 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocal { //Intialize liveModel and call Rank processor //ToDo:TASK 13057958: Working on changes to support token authentication in RLClient - //Configuration config = GetConfigurationForLiveModel("Token", "token"); + Configuration configuration = GetConfigurationForLiveModel("Token", "token"); + LiveModel liveModel = new LiveModel(configuration); + liveModel.Init(); + _rankProcessor = new RankProcessor(liveModel); } } @@ -127,7 +130,10 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLo if (isLocalInference) { //Intialize liveModel and Rankprocessor - Configuration config = GetConfigurationForLiveModel("apiKey", apiKey); + Configuration configuration = GetConfigurationForLiveModel("apiKey", apiKey); + LiveModel liveModel = new LiveModel(configuration); + liveModel.Init(); + _rankProcessor = new RankProcessor(liveModel); } } @@ -162,8 +168,7 @@ public virtual async Task> RankAsync(Personaliz { if (_isLocalInference) { - //return RankProcessor result here - return null; + return _rankProcessor.Rank(options); } else { @@ -213,8 +218,7 @@ public virtual Response Rank(PersonalizerRankOptions opt { if (_isLocalInference) { - //return RankProcessor result here - return null; + return _rankProcessor.Rank(options); } else { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerRankableAction.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerRankableAction.cs index 939a97032509..b0dd9493f2c6 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerRankableAction.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerRankableAction.cs @@ -15,5 +15,10 @@ public partial class PersonalizerRankableAction /// Need to be JSON serializable. https://docs.microsoft.com/azure/cognitive-services/personalizer/concepts-features. /// public IList Features { get; } + + /// + /// The index of the action in the original request + /// + public int Index { get; set; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankProcessor.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankProcessor.cs new file mode 100644 index 000000000000..ca6c84111c65 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankProcessor.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using Rl.Net; + +namespace Azure.AI.Personalizer +{ + /// The Rank Processor. + internal class RankProcessor + { + private readonly LiveModel _liveModel; + internal PolicyRestClient RestClient { get; } + + /// Initializes a new instance of RankProcessor. + public RankProcessor(LiveModel liveModel) + { + this._liveModel = liveModel; + } + + /// Submit a Personalizer rank request. Receives a context and a list of actions. Returns which of the provided actions should be used by your application, in rewardActionId. + /// A Personalizer Rank request. + public Response Rank(PersonalizerRankOptions options) + { + string eventId = options.EventId; + if (String.IsNullOrEmpty(eventId)) + { + eventId = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); + } + + HashSet excludedSet = new HashSet(options.ExcludedActions); + + // Store the original action list + List originalActions = new List(); + List rankableActions = new List(); + List excludedActions = new List(); + int idx = 0; + foreach (var action in options.Actions) + { + PersonalizerRankableAction actionCopy = new PersonalizerRankableAction(action.Id, action.Features); + actionCopy.Index = idx; + originalActions.Add(actionCopy); + if (excludedSet.Contains(actionCopy.Id)) + { + excludedActions.Add(actionCopy); + } + else + { + rankableActions.Add(actionCopy); + } + ++idx; + } + + // Convert options to the compatible parameter for ChooseRank + var contextJson = RlObjectConverter.ConvertToContextJson(options.ContextFeatures, rankableActions); + ActionFlags flags = options.DeferActivation == true ? ActionFlags.Deferred : ActionFlags.Default; + + // Call ChooseRank of local RL.Net + RankingResponse rankingResponse = _liveModel.ChooseRank(eventId, contextJson, flags); + + // Convert response to PersonalizerRankResult + var value = RlObjectConverter.GenerateRankResult(originalActions, rankableActions, excludedActions, rankingResponse, options.EventId); + + return Response.FromValue(value, default); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs new file mode 100644 index 000000000000..1b99c1e3663d --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Rl.Net; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Personalizer +{ + /// The converter between objects for Rl.Net objects and the sdk + internal static class RlObjectConverter + { + /// + /// Convert PersonalizerRankOptions object to a json context string for Rl.Net + /// + public static string ConvertToContextJson(IEnumerable contextFeatures, List rankableActions) + { + DecisionContext decisionContext = new DecisionContext(contextFeatures, rankableActions); + return JsonSerializer.Serialize(decisionContext); + } + + /// + /// Create rank result based on Rl.Net response + /// + public static PersonalizerRankResult GenerateRankResult(List originalActions, + List rankableActions, List excludedActions, + RankingResponse rankingResponse, string eventId) + { + var rankedIndices = rankingResponse?.Select(actionProbability => ((int)actionProbability.ActionIndex + 1)).ToArray(); + + var rankingProbabilities = rankingResponse?.Select(actionProbability => + actionProbability.Probability).ToArray(); + + return GenerateRankResultInner(originalActions, rankableActions, excludedActions, rankedIndices, rankingProbabilities, eventId); + } + + private static PersonalizerRankResult GenerateRankResultInner(List originalActions, + List rankableActions, List excludedActions, int[] rankedIndices, float[] rankingProbabilities, string eventId, int multiSlotChosenActionIndex = -1) + { + // excluded actions are not passed into VW + // rankedIndices[0] is the index of the VW chosen action (1 based index) + // ccb response that is converted into a cb response: the chosen action index is a field in the vw response. + // multiSlotChosenActionIndex is part of the multi slot response (0 based index) + int chosenActionIndex = multiSlotChosenActionIndex == -1 ? rankedIndices[0] - 1 : multiSlotChosenActionIndex; + + // take care of actions that are excluded in their original positions + if (excludedActions != null && excludedActions.Count > 0) + { + var newRanking = new int[originalActions.Count]; + var probabilities = new float[originalActions.Count]; + + // at the original position + // point the original position of ranked item + for (int i = 0; i < rankableActions.Count; i++) + { + //RankableActions is Actions - ExcludedActions + newRanking[rankableActions[i].Index] = rankableActions[rankedIndices[i] - 1].Index + 1; + probabilities[rankableActions[i].Index] = rankingProbabilities[i]; + } + + // update excluded positions + foreach (var l in excludedActions) + newRanking[l.Index] = l.Index + 1; + + rankedIndices = newRanking; + rankingProbabilities = probabilities; + } + + var personalizerRankResult = new PersonalizerRankResult + { + EventId = eventId + }; + // finalize decision response ranking + personalizerRankResult.Ranking = rankedIndices?.Select((index, i) => + { + var action = originalActions[index - 1]; + return new PersonalizerRankedAction() + { + Id = action.Id, + Probability = rankingProbabilities[i] + }; + }).ToList(); + + //setting RewardActionId to be the VW chosen action. + personalizerRankResult.RewardActionId = originalActions.ElementAt(chosenActionIndex)?.Id; + + return personalizerRankResult; + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj index 67a686a2e33c..b39fb2167a97 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj @@ -4,7 +4,11 @@ $(NoWarn);CS1591 + $(NoWarn);CS8032 + + + diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs new file mode 100644 index 000000000000..88150d6e686e --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using NUnit.Framework; + +namespace Azure.AI.Personalizer.Tests +{ + public class DecisionContextTests + { + [Test] + public void DecisionContextConstructorTest() + { + IEnumerable contextFeatures = new List() { + new { Features = new { day = "Monday", time = "morning", weather = "sunny" } }, + }; + List actions = new List(); + actions.Add + (new PersonalizerRankableAction( + id: "Person", + features: + new List() { new { videoType = "documentary", videoLength = 35, director = "CarlSagan" }, new { mostWatchedByAge = "30-35" } } + )); + DecisionContext decisionContext = new DecisionContext(contextFeatures, actions); + Assert.AreEqual(decisionContext.ContextFeatures.Count, 1); + Assert.IsTrue(decisionContext.ContextFeatures[0].Equals("{\"Features\":{\"day\":\"Monday\",\"time\":\"morning\",\"weather\":\"sunny\"}}")); + Assert.AreEqual(decisionContext.Documents.Length, 1); + Assert.AreEqual(decisionContext.Documents[0].JSON.Count, 2); + Assert.IsTrue(decisionContext.Documents[0].JSON[0].Equals("{\"videoType\":\"documentary\",\"videoLength\":35,\"director\":\"CarlSagan\"}")); + Assert.IsTrue(decisionContext.Documents[0].JSON[1].Equals("{\"mostWatchedByAge\":\"30-35\"}")); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/JsonRawStringListConverterTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/JsonRawStringListConverterTests.cs new file mode 100644 index 000000000000..5c9e907c7ef5 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/JsonRawStringListConverterTests.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Text.Json; +using NUnit.Framework; + +namespace Azure.AI.Personalizer.Tests +{ + public class JsonRawStringListConverterTests + { + [Test] + public void WriteTest() + { + MemoryStream memStream = new MemoryStream(100); + Utf8JsonWriter writer = new Utf8JsonWriter(memStream); + JsonRawStringListConverter converter = new JsonRawStringListConverter(); + List value = new List(); + value.Add("{\"videoType\":\"documentary\"}"); + value.Add("{\"day\":\"Monday\"}"); + converter.Write(writer, value, new JsonSerializerOptions()); + writer.Flush(); + string json = Encoding.UTF8.GetString(memStream.ToArray()); + Assert.IsTrue(json.Equals("[{\"videoType\":\"documentary\"},{\"day\":\"Monday\"}]")); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs index 259d24e9cdcc..3759c42f6350 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs @@ -17,6 +17,18 @@ public RankTests(bool isAsync) : base(isAsync) public async Task SingleSlotRankTests() { PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true); + await SingleSlotRankTests(client); + } + + [Test] + public async Task SingleSlotRankLocalInferenceTests() + { + PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true); + await SingleSlotRankTests(client); + } + + private async Task SingleSlotRankTests(PersonalizerClient client) + { await RankNullParameters(client); await RankServerFeatures(client); await RankNullParameters(client); diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs new file mode 100644 index 000000000000..fcced91dc206 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using NUnit.Framework; + +namespace Azure.AI.Personalizer.Tests +{ + public class RlObjectConverterTests + { + [Test] + public void ConvertToContextJsonTest() + { + IEnumerable contextFeatures = new List() { + new { Features = new { day = "Monday", time = "morning", weather = "sunny" } }, + }; + List actions = new List(); + actions.Add + (new PersonalizerRankableAction( + id: "Person", + features: + new List() { new { videoType = "documentary", videoLength = 35, director = "CarlSagan" }, new { mostWatchedByAge = "30-35" } } + )); + string contextJson = RlObjectConverter.ConvertToContextJson(contextFeatures, actions); + string expectedJson = + "{\"FromUrl\":[{" + + "\"Features\":{" + + "\"day\":\"Monday\"," + + "\"time\":\"morning\"," + + "\"weather\":\"sunny\"}}]," + + "\"_multi\":[{" + + "\"_tag\":\"Person\"," + + "\"j\":[{" + + "\"videoType\":\"documentary\"," + + "\"videoLength\":35," + + "\"director\":\"CarlSagan\"" + + "}," + + "{\"mostWatchedByAge\":\"30-35\"}" + + "]" + + "}]" + + "}"; + Assert.IsTrue(contextJson.Equals(expectedJson)); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json new file mode 100644 index 000000000000..22e88a549dc5 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json @@ -0,0 +1,225 @@ +{ + "Entries": [ + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "139", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-8a2352f590c938419932183af7ad2039-475eb6f9bad6944a-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "72fe1c6ec5e1742467bce38ccf58b021", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "Person", + "features": [ + { + "videoType": "documentary", + "videoLength": 35, + "director": "CarlSagan" + }, + { + "mostWatchedByAge": "30-35" + } + ] + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "a7d4ebf4-e94b-4332-8066-a1936f394b5a", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "124", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 20:55:04 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "13492" + }, + "ResponseBody": { + "ranking": [ + { + "id": "Person", + "probability": 1.0 + } + ], + "eventId": "4e9af3e0604e4fc1af091c9e76c0c93d-8iJRK", + "rewardActionId": "Person" + } + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "527", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9eed4f0ce6b0c340802623beef2c0a21-5e9e395f17eb1343-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "f451845d717dfcfd636af66ed165bf61", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "contextFeatures": [ + { + "Features": { + "day": "tuesday", + "time": "night", + "weather": "rainy" + } + }, + { + "Features": { + "userId": "1234", + "payingUser": true, + "favoriteGenre": "documentary", + "hoursOnSite": 0.12, + "lastwatchedType": "movie" + } + } + ], + "actions": [ + { + "id": "Person1", + "features": [ + { + "videoType": "documentary", + "videoLength": 35, + "director": "CarlSagan" + }, + { + "mostWatchedByAge": "30-35" + } + ] + }, + { + "id": "Person2", + "features": [ + { + "videoType": "documentary", + "videoLength": 35, + "director": "CarlSagan" + }, + { + "mostWatchedByAge": "40-45" + } + ] + } + ], + "excludedActions": [ + "Person1" + ], + "eventId": "123456789" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "f4625cd9-6ee1-4f1a-b6de-af954ff2465e", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "132", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 20:55:19 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "15290" + }, + "ResponseBody": { + "ranking": [ + { + "id": "Person1", + "probability": 0.0 + }, + { + "id": "Person2", + "probability": 1.0 + } + ], + "eventId": "123456789", + "rewardActionId": "Person2" + } + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "139", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-cd2c7cfe73673242856c322a2fa711db-f43e2530c4f71446-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "66317083bf6f0fc05cfb3b5eae739abb", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "Person", + "features": [ + { + "videoType": "documentary", + "videoLength": 35, + "director": "CarlSagan" + }, + { + "mostWatchedByAge": "30-35" + } + ] + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "e4c82d6d-7ee8-4eef-85fe-d31735c47995", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "124", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 20:55:33 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "13443" + }, + "ResponseBody": { + "ranking": [ + { + "id": "Person", + "probability": 1.0 + } + ], + "eventId": "c638ab102e9f464dbc35f2f102f59f35-8iJSd", + "rewardActionId": "Person" + } + } + ], + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1112192962" + } +} \ No newline at end of file diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json new file mode 100644 index 000000000000..22e88a549dc5 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json @@ -0,0 +1,225 @@ +{ + "Entries": [ + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "139", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-8a2352f590c938419932183af7ad2039-475eb6f9bad6944a-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "72fe1c6ec5e1742467bce38ccf58b021", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "Person", + "features": [ + { + "videoType": "documentary", + "videoLength": 35, + "director": "CarlSagan" + }, + { + "mostWatchedByAge": "30-35" + } + ] + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "a7d4ebf4-e94b-4332-8066-a1936f394b5a", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "124", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 20:55:04 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "13492" + }, + "ResponseBody": { + "ranking": [ + { + "id": "Person", + "probability": 1.0 + } + ], + "eventId": "4e9af3e0604e4fc1af091c9e76c0c93d-8iJRK", + "rewardActionId": "Person" + } + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "527", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9eed4f0ce6b0c340802623beef2c0a21-5e9e395f17eb1343-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "f451845d717dfcfd636af66ed165bf61", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "contextFeatures": [ + { + "Features": { + "day": "tuesday", + "time": "night", + "weather": "rainy" + } + }, + { + "Features": { + "userId": "1234", + "payingUser": true, + "favoriteGenre": "documentary", + "hoursOnSite": 0.12, + "lastwatchedType": "movie" + } + } + ], + "actions": [ + { + "id": "Person1", + "features": [ + { + "videoType": "documentary", + "videoLength": 35, + "director": "CarlSagan" + }, + { + "mostWatchedByAge": "30-35" + } + ] + }, + { + "id": "Person2", + "features": [ + { + "videoType": "documentary", + "videoLength": 35, + "director": "CarlSagan" + }, + { + "mostWatchedByAge": "40-45" + } + ] + } + ], + "excludedActions": [ + "Person1" + ], + "eventId": "123456789" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "f4625cd9-6ee1-4f1a-b6de-af954ff2465e", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "132", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 20:55:19 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "15290" + }, + "ResponseBody": { + "ranking": [ + { + "id": "Person1", + "probability": 0.0 + }, + { + "id": "Person2", + "probability": 1.0 + } + ], + "eventId": "123456789", + "rewardActionId": "Person2" + } + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "139", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-cd2c7cfe73673242856c322a2fa711db-f43e2530c4f71446-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "66317083bf6f0fc05cfb3b5eae739abb", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "Person", + "features": [ + { + "videoType": "documentary", + "videoLength": 35, + "director": "CarlSagan" + }, + { + "mostWatchedByAge": "30-35" + } + ] + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "e4c82d6d-7ee8-4eef-85fe-d31735c47995", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "124", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 20:55:33 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "13443" + }, + "ResponseBody": { + "ranking": [ + { + "id": "Person", + "probability": 1.0 + } + ], + "eventId": "c638ab102e9f464dbc35f2f102f59f35-8iJSd", + "rewardActionId": "Person" + } + } + ], + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1112192962" + } +} \ No newline at end of file From 42847171474e645c78ec1faa2f4da67e1837e8f0 Mon Sep 17 00:00:00 2001 From: johnhuang01 <90279783+johnhuang01@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:42:54 -0800 Subject: [PATCH 05/33] 13009290: Create RankProcessor class to Azure Personalizer client library for .NET for multi slot (#7) * 13009290: Create RankProcessor class to Azure Personalizer client library for .NET for multi slot * Address comments --- .../src/GlobalSuppressions.cs | 2 + .../src/Models/DecisionContext.cs | 33 +- .../src/Models/DecisionContextDocument.cs | 38 +- .../src/Models/DecisionContextDocumentId.cs | 23 + .../src/Models/PersonalizerClient.cs | 22 +- .../src/Models/PersonalizerSlotOptions.cs | 2 +- .../src/Models/RankProcessor.cs | 34 +- .../src/Models/RlObjectConverter.cs | 50 ++ .../tests/Personalizer/MultiSlotTests.cs | 19 +- .../Personalizer/RlObjectConverterTests.cs | 45 ++ .../MultiSlotLocalInferenceTest.json | 620 ++++++++++++++++++ .../MultiSlotLocalInferenceTestAsync.json | 620 ++++++++++++++++++ 12 files changed, 1488 insertions(+), 20 deletions(-) create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentId.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs b/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs index 227726867313..1e1c96d25518 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs @@ -4,3 +4,5 @@ using System.Diagnostics.CodeAnalysis; [assembly: SuppressMessage("Usage", "AZC0016:Invalid ServiceVersion member name.", Justification = "Generated code: https://github.com/Azure/autorest.csharp/issues/1524", Scope = "type", Target = "~T:Azure.AI.Personalizer.PersonalizerClientOptions.ServiceVersion")] +[assembly: SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "", Scope = "member", Target = "~P:Azure.AI.Personalizer.DecisionContextDocument.SlotJson")] +[assembly: SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "", Scope = "member", Target = "~P:Azure.AI.Personalizer.PersonalizerSlotOptions.Features")] diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs index 158498cf988e..9607b94d182b 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs @@ -27,10 +27,30 @@ public DecisionContext(IEnumerable contextFeatures, List actionFeatures = action.Features.Select(f => JsonSerializer.Serialize(f)).ToList(); - return new DecisionContextDocument(action.Id, actionFeatures); + return new DecisionContextDocument(action.Id, actionFeatures, null, null); }).ToArray(); } + /// Initializes a new instance of DecisionContext. + /// Personalizer multi-slot rank options + /// A map from slot id to its features + public DecisionContext(PersonalizerRankMultiSlotOptions rankRequest, Dictionary> slotIdToFeatures) + { + this.ContextFeatures = rankRequest.ContextFeatures.Select(f => JsonSerializer.Serialize(f)).ToList(); + + this.Documents = rankRequest.Actions + .Select(action => + { + List actionFeatures = action.Features.Select(f => JsonSerializer.Serialize(f)).ToList(); + + return new DecisionContextDocument(action.Id, actionFeatures, null, null); + }).ToArray(); + this.Slots = rankRequest.Slots? + .Select( + slot => new DecisionContextDocument(null, null, slot.Id, serializeFeatures(slotIdToFeatures[slot.Id])) + ).ToArray(); + } + /// Properties from url [JsonPropertyName("FromUrl")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -45,5 +65,16 @@ public DecisionContext(IEnumerable contextFeatures, List serializeFeatures(IList features) + { + List result = new List(); + foreach (object feature in features) + { + result.Add(JsonSerializer.Serialize(feature)); + } + + return result; + } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs index 593e15c2b529..ed7ce55c0b65 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs @@ -11,23 +11,41 @@ public class DecisionContextDocument { /// Initializes a new instance of DecisionContextDocument. /// Id of the decision context document - /// The json features - public DecisionContextDocument(string id, List Json) + /// The json features + /// The slot Id + /// The slot json features + public DecisionContextDocument(string id, List json, string slotId, List slotJson) { ID = id; - JSON = Json; + JSON = json; + SlotId = slotId; + SlotJson = slotJson; } - /// - /// Supply _tag for online evaluation - /// - [JsonPropertyName("_tag")] + + /// + /// Supply _tag for online evaluation + /// + [JsonPropertyName("_tag")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string ID { - get; - set; + get { return this?.Marginal?.ID; } + set + { + this.Marginal = value == null ? null : new DecisionContextDocumentId + { + ID = value + }; + } } + /// + /// Provide feature for marginal feature based on document id. + /// + [JsonPropertyName("i")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public DecisionContextDocumentId Marginal { get; set; } + /// /// Provide source set feature. /// @@ -63,6 +81,6 @@ public string ID [JsonPropertyName("sj")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonConverter(typeof(JsonRawStringListConverter))] - public List SlotJson { get; } + public List SlotJson { get; set; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentId.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentId.cs new file mode 100644 index 000000000000..20880629e4dc --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentId.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; + +namespace Azure.AI.Personalizer +{ + /// The Decision Context Document. + public class DecisionContextDocumentId + { + /// + /// Required for --marginal + /// + [JsonPropertyName("constant")] + public int Constant { get; set; } = 1; + + /// + /// Included for offline analysis. + /// + [JsonPropertyName("id")] + public string ID { get; set; } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index 668b8b25f645..a129b654e0bd 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -266,7 +266,14 @@ public virtual async Task> RankMultiSl scope.Start(); try { - return await MultiSlotRestClient.RankAsync(options, cancellationToken).ConfigureAwait(false); + if (_isLocalInference) + { + return _rankProcessor.Rank(options); + } + else + { + return await MultiSlotRestClient.RankAsync(options, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -316,7 +323,14 @@ public virtual Response RankMultiSlot(Personali scope.Start(); try { - return MultiSlotRestClient.Rank(options, cancellationToken); + if (_isLocalInference) + { + return _rankProcessor.Rank(options); + } + else + { + return MultiSlotRestClient.Rank(options, cancellationToken); + } } catch (Exception e) { @@ -545,8 +559,8 @@ internal Configuration GetConfigurationForLiveModel(string authType, string auth //ToDo: TASK 13057958 Working on changes to support token authentication in RLClient //config["http.token.key"] = authValue; } - config["interaction.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.1/logs/interactions"; - config["observation.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.1/logs/observations"; + config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.1/logs/interactions"; + config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.1/logs/observations"; //ToDo: TASK 13057958 Working on changes to support model api in RL.Net config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.1/model"; config["vw.commandline"] = _personalizerPolicy.Arguments; diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs index 603f39a9950e..b169f40dc353 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs @@ -15,7 +15,7 @@ public partial class PersonalizerSlotOptions /// List of dictionaries containing slot features. /// Need to be JSON serializable. https://docs.microsoft.com/azure/cognitive-services/personalizer/concepts-features. /// - public IList Features { get; } + public IList Features { get; set; } /// /// Initializes a new instance of the RankRequest class. diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankProcessor.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankProcessor.cs index ca6c84111c65..d94ec102065b 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankProcessor.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankProcessor.cs @@ -6,7 +6,7 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; +using System.Text.Json; using Rl.Net; namespace Azure.AI.Personalizer @@ -68,5 +68,37 @@ public Response Rank(PersonalizerRankOptions options) return Response.FromValue(value, default); } + + /// Submit a Personalizer rank request. Receives a context and a list of actions. Returns which of the provided actions should be used by your application, in rewardActionId. + /// A Personalizer multi-slot Rank request. + public Response Rank(PersonalizerRankMultiSlotOptions options) + { + string eventId = options.EventId; + if (String.IsNullOrEmpty(eventId)) + { + eventId = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); + } + + Dictionary actionIdToActionIndex = RlObjectConverter.GetActionIdToIndexMapping(options.Actions); + Dictionary> slotIdToFeatures = new Dictionary>(); + foreach (var slot in options.Slots) + { + slotIdToFeatures.Add(slot.Id, RlObjectConverter.GetIncludedActionsForSlot(slot, actionIdToActionIndex)); + } + + // Convert options to the compatible parameter for ChooseRank + DecisionContext decisionContext = new DecisionContext(options, slotIdToFeatures); + var contextJson = JsonSerializer.Serialize(decisionContext); + ActionFlags flags = options.DeferActivation == true ? ActionFlags.Deferred : ActionFlags.Default; + int[] baselineActions = RlObjectConverter.ExtractBaselineActionsFromRankRequest(options); + + // Call ChooseRank of local RL.Net + MultiSlotResponseDetailed multiSlotResponse = _liveModel.RequestMultiSlotDecisionDetailed(eventId, contextJson, flags, baselineActions); + + // Convert response to PersonalizerRankResult + var value = RlObjectConverter.GenerateMultiSlotRankResponse(options.Actions, multiSlotResponse, eventId); + + return Response.FromValue(value, default); + } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs index 1b99c1e3663d..b6810870f7a0 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs @@ -5,6 +5,7 @@ using Rl.Net; using System.Collections.Generic; using System.Linq; +using Azure.Core; namespace Azure.AI.Personalizer { @@ -87,5 +88,54 @@ private static PersonalizerRankResult GenerateRankResultInner(List actions, MultiSlotResponseDetailed multiSlotResponse, string eventId) + { + Dictionary actionIndexToActionId = actions + .Select((action, index) => new { action, index = (long)index }) + .ToDictionary(obj => obj.index, obj => obj.action.Id); + + List slots = multiSlotResponse + .Select(slotRanking => new PersonalizerSlotResult(slotRanking.SlotId, actionIndexToActionId[slotRanking.ChosenAction])) + .ToList(); + + return new PersonalizerMultiSlotRankResult(slots, eventId); + } + + public static int[] ExtractBaselineActionsFromRankRequest(PersonalizerRankMultiSlotOptions request) + { + Dictionary actionIdToIndex = GetActionIdToIndexMapping(request.Actions); + return request.Slots + .Select(slot => actionIdToIndex[slot.BaselineAction]).ToArray(); + } + + public static Dictionary GetActionIdToIndexMapping(IList actions) + { + return actions + .Select((action, index) => new { action, index }) + .ToDictionary(obj => obj.action.Id, obj => obj.index); + } + + public static IList GetIncludedActionsForSlot(PersonalizerSlotOptions slot, Dictionary actionIdToActionIndex) + { + IList res = new ChangeTrackingList(); + if (slot.Features != null) + { + foreach (object feature in slot.Features) + { + res.Add(feature); + } + } + if (slot.ExcludedActions != null) + { + List excludeActionIndices = slot.ExcludedActions.Select(id => actionIdToActionIndex[id]).ToList(); + var allActionIndices = new HashSet(actionIdToActionIndex.Values); + List includedActionIndices = allActionIndices.Except(excludeActionIndices).ToList(); + var includedActions = (new { _inc = includedActionIndices }); + res.Add(includedActions); + } + + return res; + } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs index a2cc0f39276b..547481a17646 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.AI.Personalizer.Tests @@ -13,7 +14,7 @@ public MultiSlotTests(bool isAsync) : base(isAsync) { } - private static IList actions = new List() + public static IList actions = new List() { new PersonalizerRankableAction( id: "NewsArticle", @@ -57,13 +58,13 @@ public MultiSlotTests(bool isAsync) : base(isAsync) excludedActions: new List() { "EntertainmentArticle" } ); - private static IList slots = new List() + public static IList slots = new List() { slot1, slot2 }; - private static IList contextFeatures = new List() + public static IList contextFeatures = new List() { new { User = new { ProfileType = "AnonymousUser", LatLong = "47.6,-122.1"} }, new { Environment = new { DayOfMonth = "28", MonthOfYear = "8", Weather = "Sunny"} }, @@ -75,6 +76,18 @@ public MultiSlotTests(bool isAsync) : base(isAsync) public async Task MultiSlotTest() { PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: false); + await MultiSlotTestInner(client); + } + + [Test] + public async Task MultiSlotLocalInferenceTest() + { + PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true); + await MultiSlotTestInner(client); + } + + private async Task MultiSlotTestInner(PersonalizerClient client) + { await RankMultiSlotNullParameters(client); await RankMultiSlotNoOptions(client); await RankMultiSlot(client); diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs index fcced91dc206..b51b62c94194 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs @@ -8,6 +8,20 @@ namespace Azure.AI.Personalizer.Tests { public class RlObjectConverterTests { + private PersonalizerSlotOptions slot = new PersonalizerSlotOptions( + id: "Main Article", + baselineAction: "NewsArticle", + features: new List() + { + new + { + Size = "Large", + Position = "Top Middle" + } + }, + excludedActions: new List() { "SportsArticle", "EntertainmentArticle" } + ); + [Test] public void ConvertToContextJsonTest() { @@ -41,5 +55,36 @@ public void ConvertToContextJsonTest() "}"; Assert.IsTrue(contextJson.Equals(expectedJson)); } + + [Test] + public void GetIncludedActionsForSlotTest() + { + Dictionary actionIdToActionIndex = new Dictionary(); + actionIdToActionIndex.Add("NewArticle", 0); + actionIdToActionIndex.Add("SportsArticle", 1); + actionIdToActionIndex.Add("EntertainmentArticle", 2); + IList features = RlObjectConverter.GetIncludedActionsForSlot(slot, actionIdToActionIndex); + } + + [Test] + public void ExtractBaselineActionsFromRankRequestTest() + { + PersonalizerRankMultiSlotOptions request = new PersonalizerRankMultiSlotOptions( + MultiSlotTests.actions, MultiSlotTests.slots, MultiSlotTests.contextFeatures, "testEventId"); + int[] baselineActions = RlObjectConverter.ExtractBaselineActionsFromRankRequest(request); + Assert.AreEqual(2, baselineActions.Length); + Assert.AreEqual(0, baselineActions[0]); + Assert.AreEqual(1, baselineActions[1]); + } + + [Test] + public void GetActionIdToIndexMappingTest() + { + Dictionary idToIndex = RlObjectConverter.GetActionIdToIndexMapping(MultiSlotTests.actions); + Assert.AreEqual(3, idToIndex.Keys.Count); + Assert.AreEqual(idToIndex["NewsArticle"], 0); + Assert.AreEqual(idToIndex["SportsArticle"], 1); + Assert.AreEqual(idToIndex["EntertainmentArticle"], 2); + } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json new file mode 100644 index 000000000000..1174eb4855f0 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json @@ -0,0 +1,620 @@ +{ + "Entries": [ + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "511", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "166", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "6687" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "771", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-dc7d4c7f96b2ef4bbdcb172245f6c48c-b8ca17898f77d54b-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "75961857c5237312446a1af9a48fd15c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "contextFeatures": [ + { + "User": { + "ProfileType": "AnonymousUser", + "LatLong": "47.6,-122.1" + } + }, + { + "Environment": { + "DayOfMonth": "28", + "MonthOfYear": "8", + "Weather": "Sunny" + } + }, + { + "Device": { + "Mobile": true, + "Windows": true + } + }, + { + "RecentActivity": { + "ItemsInCart": 3 + } + } + ], + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ], + "deferActivation": false + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "75a2d446-8415-4c5e-8898-ac0d56b05a19", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "166", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:46 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "656" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "3c8158a8634e45938889eef503eca7c1-8Io5Y" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "798", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-5ce193a77854fa4f8cbede3b8b961658-db3b4a8ec090dd4e-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "1473b19eb49357f9e70e3aade0f0d4cd", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "contextFeatures": [ + { + "User": { + "ProfileType": "AnonymousUser", + "LatLong": "47.6,-122.1" + } + }, + { + "Environment": { + "DayOfMonth": "28", + "MonthOfYear": "8", + "Weather": "Sunny" + } + }, + { + "Device": { + "Mobile": true, + "Windows": true + } + }, + { + "RecentActivity": { + "ItemsInCart": 3 + } + } + ], + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ], + "eventId": "sdkTestEventId", + "deferActivation": false + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "5a5ee1b3-3e35-4e59-a67b-1179972d8abb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "142", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "438" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "sdkTestEventId" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "44", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-544c75c6622f6042b29c0e5559b2491d-92512bae864a3745-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "dc54762ad9152f5271c05453f7a4ee60", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "reward": [ + { + "slotId": "testSlot", + "value": 1 + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "147e62d7-78a6-4c0b-9712-5d15e21a90a9", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "0", + "Date": "Fri, 15 Oct 2021 14:55:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "417" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "44", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-76c0680ef4b76c49a79cd70ba19fdbcd-7b068eb1e129124c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "3e3c138bed11a2d11f3e8d158a649254", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "reward": [ + { + "slotId": "testSlot", + "value": 1 + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "514ad45a-8228-44b0-b988-833e3f9f6c0c", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "0", + "Date": "Fri, 15 Oct 2021 14:55:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "41" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/activate", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-d9cc3eb2ee96b04cbcea9ee817a9e6c7-c6c37aa27c2f804e-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2dce4d96f53ac4475e43a2d360a66042", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "50174a48-9297-4f7f-bc69-99fd75a90600", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "0", + "Date": "Fri, 15 Oct 2021 14:55:48 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "40" + }, + "ResponseBody": [] + } + ], + "Variables": { + "PERSONALIZER_API_KEY_MULTI_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_MULTI_SLOT": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/", + "RandomSeed": "2030725436" + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json new file mode 100644 index 000000000000..c9b6b84d7e3b --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json @@ -0,0 +1,620 @@ +{ + "Entries": [ + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "511", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "166", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "6687" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "771", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-dc7d4c7f96b2ef4bbdcb172245f6c48c-b8ca17898f77d54b-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "75961857c5237312446a1af9a48fd15c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "contextFeatures": [ + { + "User": { + "ProfileType": "AnonymousUser", + "LatLong": "47.6,-122.1" + } + }, + { + "Environment": { + "DayOfMonth": "28", + "MonthOfYear": "8", + "Weather": "Sunny" + } + }, + { + "Device": { + "Mobile": true, + "Windows": true + } + }, + { + "RecentActivity": { + "ItemsInCart": 3 + } + } + ], + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ], + "deferActivation": false + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "75a2d446-8415-4c5e-8898-ac0d56b05a19", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "166", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:46 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "656" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "3c8158a8634e45938889eef503eca7c1-8Io5Y" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "798", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-5ce193a77854fa4f8cbede3b8b961658-db3b4a8ec090dd4e-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "1473b19eb49357f9e70e3aade0f0d4cd", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "contextFeatures": [ + { + "User": { + "ProfileType": "AnonymousUser", + "LatLong": "47.6,-122.1" + } + }, + { + "Environment": { + "DayOfMonth": "28", + "MonthOfYear": "8", + "Weather": "Sunny" + } + }, + { + "Device": { + "Mobile": true, + "Windows": true + } + }, + { + "RecentActivity": { + "ItemsInCart": 3 + } + } + ], + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ], + "eventId": "sdkTestEventId", + "deferActivation": false + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "5a5ee1b3-3e35-4e59-a67b-1179972d8abb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "142", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "438" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "sdkTestEventId" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "44", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-544c75c6622f6042b29c0e5559b2491d-92512bae864a3745-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "dc54762ad9152f5271c05453f7a4ee60", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "reward": [ + { + "slotId": "testSlot", + "value": 1 + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "147e62d7-78a6-4c0b-9712-5d15e21a90a9", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "0", + "Date": "Fri, 15 Oct 2021 14:55:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "417" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "44", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-76c0680ef4b76c49a79cd70ba19fdbcd-7b068eb1e129124c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "3e3c138bed11a2d11f3e8d158a649254", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "reward": [ + { + "slotId": "testSlot", + "value": 1 + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "514ad45a-8228-44b0-b988-833e3f9f6c0c", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "0", + "Date": "Fri, 15 Oct 2021 14:55:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "41" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/activate", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-d9cc3eb2ee96b04cbcea9ee817a9e6c7-c6c37aa27c2f804e-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2dce4d96f53ac4475e43a2d360a66042", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "50174a48-9297-4f7f-bc69-99fd75a90600", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "0", + "Date": "Fri, 15 Oct 2021 14:55:48 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "40" + }, + "ResponseBody": [] + } + ], + "Variables": { + "PERSONALIZER_API_KEY_MULTI_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_MULTI_SLOT": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/", + "RandomSeed": "2030725436" + } +} \ No newline at end of file From 4c40b507a9f19fe326700ca3c9f13c2f1ef79253 Mon Sep 17 00:00:00 2001 From: Tejaswi Paruchuri Date: Thu, 3 Feb 2022 11:55:29 -0800 Subject: [PATCH 06/33] Subsampling --- .../src/Models/PersonalizerClient.cs | 36 ++++++++++++++++--- .../Infrastructure/PersonalizerTestBase.cs | 4 +-- .../Personalizer/RlObjectConverterTests.cs | 1 + 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index a129b654e0bd..0d0687327f92 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -21,6 +21,8 @@ public class PersonalizerClient private readonly bool _isLocalInference; private string stringEndpoint; private string apiKey; + private float _interactionsSubsamplePercentage = 1.0f; + private float _observationsSubsamplePercentage = 1.0f; private readonly RankProcessor _rankProcessor; @@ -70,13 +72,25 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. + /// Percentage from (0,1] determines how much percentage of interaction events to consider + /// Percentage from (0,1] determines how much percentage of observation events to consider /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : + public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float interactionsSubsamplePercentage = 100, float observationsSubSamplePercentage = 100, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; if (isLocalInference) { + if (0 >= interactionsSubsamplePercentage || interactionsSubsamplePercentage > 1) + { + throw new ArgumentOutOfRangeException(nameof(interactionsSubsamplePercentage), "Percentage should be between (0,1]"); + } + if (0 >= observationsSubSamplePercentage || observationsSubSamplePercentage > 1) + { + throw new ArgumentOutOfRangeException(nameof(observationsSubSamplePercentage), "Percentage should be between (0,1]"); + } + _interactionsSubsamplePercentage = interactionsSubsamplePercentage; + _observationsSubsamplePercentage = observationsSubSamplePercentage; //Intialize liveModel and call Rank processor //ToDo:TASK 13057958: Working on changes to support token authentication in RLClient Configuration configuration = GetConfigurationForLiveModel("Token", "token"); @@ -122,13 +136,25 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. + /// Percentage from (0,1] determines how much percentage of interaction events to consider + /// Percentage from (0,1] determines how much percentage of observation events to consider /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, PersonalizerClientOptions options = null) : + public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, float interactionsSubsamplePercentage = 100, float observationsSubSamplePercentage = 100, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; if (isLocalInference) { + if (0 >= interactionsSubsamplePercentage || interactionsSubsamplePercentage > 1) + { + throw new ArgumentOutOfRangeException(nameof(interactionsSubsamplePercentage), "Percentage should be between (0,1]"); + } + if (0 >= observationsSubSamplePercentage || observationsSubSamplePercentage > 1) + { + throw new ArgumentOutOfRangeException(nameof(observationsSubSamplePercentage), "Percentage should be between (0,1]"); + } + _interactionsSubsamplePercentage = interactionsSubsamplePercentage; + _observationsSubsamplePercentage = observationsSubSamplePercentage; //Intialize liveModel and Rankprocessor Configuration configuration = GetConfigurationForLiveModel("apiKey", apiKey); LiveModel liveModel = new LiveModel(configuration); @@ -559,8 +585,10 @@ internal Configuration GetConfigurationForLiveModel(string authType, string auth //ToDo: TASK 13057958 Working on changes to support token authentication in RLClient //config["http.token.key"] = authValue; } - config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.1/logs/interactions"; - config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.1/logs/observations"; + config["interaction.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.2/logs/interactions"; + config["observation.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.2/logs/observations"; + config["interaction.subsample.rate"] = Convert.ToString(_interactionsSubsamplePercentage, CultureInfo.InvariantCulture); + config["observation.subsample.rate"] = Convert.ToString(_observationsSubsamplePercentage, CultureInfo.InvariantCulture); //ToDo: TASK 13057958 Working on changes to support model api in RL.Net config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.1/model"; config["vw.commandline"] = _personalizerPolicy.Arguments; diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs index d2604d28806f..80b1d00ad094 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs @@ -18,7 +18,7 @@ public PersonalizerTestBase(bool isAsync) : base(isAsync) Sanitizer = new PersonalizerRecordedTestSanitizer(); } - protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false, bool isLocalInference = false) + protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false, bool isLocalInference = false, float interactionsSubsamplePercentage = 1.0f, float observationsSubsamplePercentage = 1.0f) { string endpoint = isSingleSlot ? TestEnvironment.SingleSlotEndpoint : TestEnvironment.MultiSlotEndpoint; string apiKey = isSingleSlot ? TestEnvironment.SingleSlotApiKey : TestEnvironment.MultiSlotApiKey; @@ -32,7 +32,7 @@ protected async Task GetPersonalizerClientAsync(bool isSingl PersonalizerClient personalizerClient = null; if (isLocalInference) { - personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options); + personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options:options, interactionsSubsamplePercentage: interactionsSubsamplePercentage, observationsSubSamplePercentage: observationsSubsamplePercentage); } else { diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs index b51b62c94194..1718f679109c 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs @@ -44,6 +44,7 @@ public void ConvertToContextJsonTest() "\"weather\":\"sunny\"}}]," + "\"_multi\":[{" + "\"_tag\":\"Person\"," + + "\"i\":{\"constant\":1,\"id\":\"Person\"}," + "\"j\":[{" + "\"videoType\":\"documentary\"," + "\"videoLength\":35," + From 63bffb988255c24b365aac5f06ed06665ad8a1b3 Mon Sep 17 00:00:00 2001 From: Tejaswi Paruchuri Date: Thu, 3 Feb 2022 12:26:02 -0800 Subject: [PATCH 07/33] Cleanup and added tests --- .../src/Models/PersonalizerClient.cs | 57 +++++++++---------- .../Infrastructure/PersonalizerTestBase.cs | 4 +- .../tests/Personalizer/RankTests.cs | 3 + 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index 0d0687327f92..253e35c572a8 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -21,8 +21,8 @@ public class PersonalizerClient private readonly bool _isLocalInference; private string stringEndpoint; private string apiKey; - private float _interactionsSubsamplePercentage = 1.0f; - private float _observationsSubsamplePercentage = 1.0f; + private float _interactionsSubsampleRate = 1.0f; + private float _observationsSubsampleRate = 1.0f; private readonly RankProcessor _rankProcessor; @@ -72,25 +72,16 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. - /// Percentage from (0,1] determines how much percentage of interaction events to consider - /// Percentage from (0,1] determines how much percentage of observation events to consider + /// Percentage from (0,1] determines how much percentage of interaction events to consider + /// Percentage from (0,1] determines how much percentage of observation events to consider /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float interactionsSubsamplePercentage = 100, float observationsSubSamplePercentage = 100, PersonalizerClientOptions options = null) : + public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float interactionsSubsampleRate = 1.0f, float observationsSubSampleRate = 100, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; if (isLocalInference) { - if (0 >= interactionsSubsamplePercentage || interactionsSubsamplePercentage > 1) - { - throw new ArgumentOutOfRangeException(nameof(interactionsSubsamplePercentage), "Percentage should be between (0,1]"); - } - if (0 >= observationsSubSamplePercentage || observationsSubSamplePercentage > 1) - { - throw new ArgumentOutOfRangeException(nameof(observationsSubSamplePercentage), "Percentage should be between (0,1]"); - } - _interactionsSubsamplePercentage = interactionsSubsamplePercentage; - _observationsSubsamplePercentage = observationsSubSamplePercentage; + validateAndAssignSampleRate(interactionsSubsampleRate, observationsSubSampleRate); //Intialize liveModel and call Rank processor //ToDo:TASK 13057958: Working on changes to support token authentication in RLClient Configuration configuration = GetConfigurationForLiveModel("Token", "token"); @@ -136,25 +127,16 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. - /// Percentage from (0,1] determines how much percentage of interaction events to consider - /// Percentage from (0,1] determines how much percentage of observation events to consider + /// Percentage from (0,1] determines how much percentage of interaction events to consider + /// Percentage from (0,1] determines how much percentage of observation events to consider /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, float interactionsSubsamplePercentage = 100, float observationsSubSamplePercentage = 100, PersonalizerClientOptions options = null) : + public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, float interactionsSubsampleRate = 1.0f, float observationsSubSampleRate = 1.0f, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; if (isLocalInference) { - if (0 >= interactionsSubsamplePercentage || interactionsSubsamplePercentage > 1) - { - throw new ArgumentOutOfRangeException(nameof(interactionsSubsamplePercentage), "Percentage should be between (0,1]"); - } - if (0 >= observationsSubSamplePercentage || observationsSubSamplePercentage > 1) - { - throw new ArgumentOutOfRangeException(nameof(observationsSubSamplePercentage), "Percentage should be between (0,1]"); - } - _interactionsSubsamplePercentage = interactionsSubsamplePercentage; - _observationsSubsamplePercentage = observationsSubSamplePercentage; + validateAndAssignSampleRate(interactionsSubsampleRate, observationsSubSampleRate); //Intialize liveModel and Rankprocessor Configuration configuration = GetConfigurationForLiveModel("apiKey", apiKey); LiveModel liveModel = new LiveModel(configuration); @@ -587,8 +569,8 @@ internal Configuration GetConfigurationForLiveModel(string authType, string auth } config["interaction.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.2/logs/interactions"; config["observation.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.2/logs/observations"; - config["interaction.subsample.rate"] = Convert.ToString(_interactionsSubsamplePercentage, CultureInfo.InvariantCulture); - config["observation.subsample.rate"] = Convert.ToString(_observationsSubsamplePercentage, CultureInfo.InvariantCulture); + config["interaction.subsample.rate"] = Convert.ToString(_interactionsSubsampleRate, CultureInfo.InvariantCulture); + config["observation.subsample.rate"] = Convert.ToString(_observationsSubsampleRate, CultureInfo.InvariantCulture); //ToDo: TASK 13057958 Working on changes to support model api in RL.Net config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.1/model"; config["vw.commandline"] = _personalizerPolicy.Arguments; @@ -598,5 +580,20 @@ internal Configuration GetConfigurationForLiveModel(string authType, string auth //return the config model return config; } + + /// validate interactionsSubsampleRate and observationsSubSampleRate inputs from user and throws exception if not in range + private void validateAndAssignSampleRate(float interactionsSubsampleRate,float observationsSubSampleRate) + { + if (0 >= interactionsSubsampleRate || interactionsSubsampleRate > 1) + { + throw new ArgumentOutOfRangeException(nameof(interactionsSubsampleRate), "Percentage should be between (0,1]"); + } + if (0 >= observationsSubSampleRate || observationsSubSampleRate > 1) + { + throw new ArgumentOutOfRangeException(nameof(observationsSubSampleRate), "Percentage should be between (0,1]"); + } + _interactionsSubsampleRate = interactionsSubsampleRate; + _observationsSubsampleRate = observationsSubSampleRate; + } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs index 80b1d00ad094..8fe3d4966f0e 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs @@ -18,7 +18,7 @@ public PersonalizerTestBase(bool isAsync) : base(isAsync) Sanitizer = new PersonalizerRecordedTestSanitizer(); } - protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false, bool isLocalInference = false, float interactionsSubsamplePercentage = 1.0f, float observationsSubsamplePercentage = 1.0f) + protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false, bool isLocalInference = false, float interactionsSubsampleRate = 1.0f, float observationsSubsampleRate = 1.0f) { string endpoint = isSingleSlot ? TestEnvironment.SingleSlotEndpoint : TestEnvironment.MultiSlotEndpoint; string apiKey = isSingleSlot ? TestEnvironment.SingleSlotApiKey : TestEnvironment.MultiSlotApiKey; @@ -32,7 +32,7 @@ protected async Task GetPersonalizerClientAsync(bool isSingl PersonalizerClient personalizerClient = null; if (isLocalInference) { - personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options:options, interactionsSubsamplePercentage: interactionsSubsamplePercentage, observationsSubSamplePercentage: observationsSubsamplePercentage); + personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options:options, interactionsSubsampleRate: interactionsSubsampleRate, observationsSubSampleRate: observationsSubsampleRate); } else { diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs index 3759c42f6350..1cac36b7ffd8 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Collections.Generic; using System.Threading.Tasks; using NUnit.Framework; @@ -23,6 +24,8 @@ public async Task SingleSlotRankTests() [Test] public async Task SingleSlotRankLocalInferenceTests() { + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, interactionsSubsampleRate: 1.01f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, observationsSubsampleRate: 0f)); PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true); await SingleSlotRankTests(client); } From 625033ee7c36cffb4b009fbabdb71793f0d17b70 Mon Sep 17 00:00:00 2001 From: Tejaswi Paruchuri Date: Thu, 3 Feb 2022 12:28:00 -0800 Subject: [PATCH 08/33] Cleanup and added tests --- .../Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs index 547481a17646..77da5b9215c0 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Collections.Generic; using System.Threading.Tasks; using Azure.Core.TestFramework; @@ -82,6 +83,8 @@ public async Task MultiSlotTest() [Test] public async Task MultiSlotLocalInferenceTest() { + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, observationsSubsampleRate: 1.01f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, interactionsSubsampleRate: 0f)); PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true); await MultiSlotTestInner(client); } From fb0fd6ae55c5f5e1685a3e26295fb261c4c3d5f7 Mon Sep 17 00:00:00 2001 From: Tejaswi Paruchuri Date: Thu, 3 Feb 2022 13:18:05 -0800 Subject: [PATCH 09/33] cleanup --- .../tests/Personalizer/MultiSlotTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs index 77da5b9215c0..797d2d776975 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs @@ -83,8 +83,8 @@ public async Task MultiSlotTest() [Test] public async Task MultiSlotLocalInferenceTest() { - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, observationsSubsampleRate: 1.01f)); - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, interactionsSubsampleRate: 0f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, observationsSubsampleRate: 1.01f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, interactionsSubsampleRate: 0f)); PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true); await MultiSlotTestInner(client); } From d5058a5d53748825f2f84875b10577788119764d Mon Sep 17 00:00:00 2001 From: Tejaswi Paruchuri Date: Thu, 3 Feb 2022 13:55:36 -0800 Subject: [PATCH 10/33] cleanup --- .../Azure.AI.Personalizer/src/Models/PersonalizerClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index 253e35c572a8..846b6385b2f4 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -75,7 +75,7 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer /// Percentage from (0,1] determines how much percentage of interaction events to consider /// Percentage from (0,1] determines how much percentage of observation events to consider /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float interactionsSubsampleRate = 1.0f, float observationsSubSampleRate = 100, PersonalizerClientOptions options = null) : + public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float interactionsSubsampleRate = 1.0f, float observationsSubSampleRate = 1.0f, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; From 329c0af68100aeab25041c337a28dd22785847a7 Mon Sep 17 00:00:00 2001 From: Tejaswi Paruchuri Date: Thu, 3 Feb 2022 15:40:57 -0800 Subject: [PATCH 11/33] Single SubSample rate --- .../src/Models/PersonalizerClient.cs | 36 ++++++++----------- .../Infrastructure/PersonalizerTestBase.cs | 4 +-- .../tests/Personalizer/MultiSlotTests.cs | 4 +-- .../tests/Personalizer/RankTests.cs | 4 +-- 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index 846b6385b2f4..1ae916f253bb 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -21,8 +21,7 @@ public class PersonalizerClient private readonly bool _isLocalInference; private string stringEndpoint; private string apiKey; - private float _interactionsSubsampleRate = 1.0f; - private float _observationsSubsampleRate = 1.0f; + private float _SubsampleRate = 1.0f; private readonly RankProcessor _rankProcessor; @@ -72,16 +71,15 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. - /// Percentage from (0,1] determines how much percentage of interaction events to consider - /// Percentage from (0,1] determines how much percentage of observation events to consider + /// Percentage from (0,1] determines how much percentage of interaction events to consider /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float interactionsSubsampleRate = 1.0f, float observationsSubSampleRate = 1.0f, PersonalizerClientOptions options = null) : + public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float SubsampleRate = 1.0f, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; if (isLocalInference) { - validateAndAssignSampleRate(interactionsSubsampleRate, observationsSubSampleRate); + validateAndAssignSampleRate(SubsampleRate); //Intialize liveModel and call Rank processor //ToDo:TASK 13057958: Working on changes to support token authentication in RLClient Configuration configuration = GetConfigurationForLiveModel("Token", "token"); @@ -127,16 +125,15 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. - /// Percentage from (0,1] determines how much percentage of interaction events to consider - /// Percentage from (0,1] determines how much percentage of observation events to consider + /// Percentage from (0,1] determines how much percentage of interaction events to consider /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, float interactionsSubsampleRate = 1.0f, float observationsSubSampleRate = 1.0f, PersonalizerClientOptions options = null) : + public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, float SubsampleRate = 1.0f, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; if (isLocalInference) { - validateAndAssignSampleRate(interactionsSubsampleRate, observationsSubSampleRate); + validateAndAssignSampleRate(SubsampleRate); //Intialize liveModel and Rankprocessor Configuration configuration = GetConfigurationForLiveModel("apiKey", apiKey); LiveModel liveModel = new LiveModel(configuration); @@ -569,8 +566,8 @@ internal Configuration GetConfigurationForLiveModel(string authType, string auth } config["interaction.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.2/logs/interactions"; config["observation.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.2/logs/observations"; - config["interaction.subsample.rate"] = Convert.ToString(_interactionsSubsampleRate, CultureInfo.InvariantCulture); - config["observation.subsample.rate"] = Convert.ToString(_observationsSubsampleRate, CultureInfo.InvariantCulture); + config["interaction.subsample.rate"] = Convert.ToString(_SubsampleRate, CultureInfo.InvariantCulture); + config["observation.subsample.rate"] = Convert.ToString(_SubsampleRate, CultureInfo.InvariantCulture); //ToDo: TASK 13057958 Working on changes to support model api in RL.Net config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.1/model"; config["vw.commandline"] = _personalizerPolicy.Arguments; @@ -581,19 +578,14 @@ internal Configuration GetConfigurationForLiveModel(string authType, string auth return config; } - /// validate interactionsSubsampleRate and observationsSubSampleRate inputs from user and throws exception if not in range - private void validateAndAssignSampleRate(float interactionsSubsampleRate,float observationsSubSampleRate) + /// validate SubsampleRate input from user and throws exception if not in range + private void validateAndAssignSampleRate(float SubsampleRate) { - if (0 >= interactionsSubsampleRate || interactionsSubsampleRate > 1) + if (0 >= SubsampleRate || SubsampleRate > 1) { - throw new ArgumentOutOfRangeException(nameof(interactionsSubsampleRate), "Percentage should be between (0,1]"); + throw new ArgumentOutOfRangeException(nameof(SubsampleRate), "Percentage should be between (0,1]"); } - if (0 >= observationsSubSampleRate || observationsSubSampleRate > 1) - { - throw new ArgumentOutOfRangeException(nameof(observationsSubSampleRate), "Percentage should be between (0,1]"); - } - _interactionsSubsampleRate = interactionsSubsampleRate; - _observationsSubsampleRate = observationsSubSampleRate; + _SubsampleRate = SubsampleRate; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs index 8fe3d4966f0e..8547b1f204d9 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs @@ -18,7 +18,7 @@ public PersonalizerTestBase(bool isAsync) : base(isAsync) Sanitizer = new PersonalizerRecordedTestSanitizer(); } - protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false, bool isLocalInference = false, float interactionsSubsampleRate = 1.0f, float observationsSubsampleRate = 1.0f) + protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false, bool isLocalInference = false, float SubsampleRate = 1.0f) { string endpoint = isSingleSlot ? TestEnvironment.SingleSlotEndpoint : TestEnvironment.MultiSlotEndpoint; string apiKey = isSingleSlot ? TestEnvironment.SingleSlotApiKey : TestEnvironment.MultiSlotApiKey; @@ -32,7 +32,7 @@ protected async Task GetPersonalizerClientAsync(bool isSingl PersonalizerClient personalizerClient = null; if (isLocalInference) { - personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options:options, interactionsSubsampleRate: interactionsSubsampleRate, observationsSubSampleRate: observationsSubsampleRate); + personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options:options, SubsampleRate: SubsampleRate); } else { diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs index 797d2d776975..3afb53b35284 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs @@ -83,8 +83,8 @@ public async Task MultiSlotTest() [Test] public async Task MultiSlotLocalInferenceTest() { - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, observationsSubsampleRate: 1.01f)); - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, interactionsSubsampleRate: 0f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, SubsampleRate: 1.01f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, SubsampleRate: 0f)); PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true); await MultiSlotTestInner(client); } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs index 1cac36b7ffd8..6b6b070060d3 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs @@ -24,8 +24,8 @@ public async Task SingleSlotRankTests() [Test] public async Task SingleSlotRankLocalInferenceTests() { - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, interactionsSubsampleRate: 1.01f)); - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, observationsSubsampleRate: 0f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, SubsampleRate: 1.01f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, SubsampleRate: 0f)); PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true); await SingleSlotRankTests(client); } From 954818ad8f2ee1410667ba3766f85bf2602cadd4 Mon Sep 17 00:00:00 2001 From: Tejaswi Paruchuri Date: Thu, 3 Feb 2022 15:44:22 -0800 Subject: [PATCH 12/33] Cleanup --- .../src/Models/PersonalizerClient.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index 1ae916f253bb..6773e6c19e29 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -71,7 +71,7 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. - /// Percentage from (0,1] determines how much percentage of interaction events to consider + /// Percentage from (0,1] determines how much percentage of interaction and observation events to consider /// The options for configuring the client. public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float SubsampleRate = 1.0f, PersonalizerClientOptions options = null) : this(endpoint, credential, options) @@ -125,7 +125,7 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. - /// Percentage from (0,1] determines how much percentage of interaction events to consider + /// Percentage from (0,1] determines how much percentage of interaction and observation events to consider /// The options for configuring the client. public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, float SubsampleRate = 1.0f, PersonalizerClientOptions options = null) : this(endpoint, credential, options) @@ -564,8 +564,8 @@ internal Configuration GetConfigurationForLiveModel(string authType, string auth //ToDo: TASK 13057958 Working on changes to support token authentication in RLClient //config["http.token.key"] = authValue; } - config["interaction.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.2/logs/interactions"; - config["observation.http.api.host"] = stringEndpoint+"personalizer/v1.1-preview.2/logs/observations"; + config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/interactions"; + config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/observations"; config["interaction.subsample.rate"] = Convert.ToString(_SubsampleRate, CultureInfo.InvariantCulture); config["observation.subsample.rate"] = Convert.ToString(_SubsampleRate, CultureInfo.InvariantCulture); //ToDo: TASK 13057958 Working on changes to support model api in RL.Net @@ -578,7 +578,7 @@ internal Configuration GetConfigurationForLiveModel(string authType, string auth return config; } - /// validate SubsampleRate input from user and throws exception if not in range + /// validate SubsampleRate input from user and throw exception if not in range private void validateAndAssignSampleRate(float SubsampleRate) { if (0 >= SubsampleRate || SubsampleRate > 1) From 43210dd750b53290816e2a1a51ec552e3a6916f4 Mon Sep 17 00:00:00 2001 From: Tejaswi Paruchuri Date: Thu, 3 Feb 2022 16:02:57 -0800 Subject: [PATCH 13/33] Cleanup --- .../tests/Infrastructure/PersonalizerTestBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs index 8547b1f204d9..76ed6a3cb8a6 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs @@ -32,7 +32,7 @@ protected async Task GetPersonalizerClientAsync(bool isSingl PersonalizerClient personalizerClient = null; if (isLocalInference) { - personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options:options, SubsampleRate: SubsampleRate); + personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options: options, SubsampleRate: SubsampleRate); } else { From d99d43f1d4f302d9bfe91e75839242afc8e382df Mon Sep 17 00:00:00 2001 From: Tejaswi Paruchuri Date: Fri, 4 Feb 2022 13:29:10 -0800 Subject: [PATCH 14/33] Variable name --- .../src/Models/PersonalizerClient.cs | 26 +++++++++---------- .../Infrastructure/PersonalizerTestBase.cs | 4 +-- .../tests/Personalizer/MultiSlotTests.cs | 4 +-- .../tests/Personalizer/RankTests.cs | 4 +-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index 6773e6c19e29..95e8907760b1 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -21,7 +21,7 @@ public class PersonalizerClient private readonly bool _isLocalInference; private string stringEndpoint; private string apiKey; - private float _SubsampleRate = 1.0f; + private float subsampleRate = 1.0f; private readonly RankProcessor _rankProcessor; @@ -71,15 +71,15 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. - /// Percentage from (0,1] determines how much percentage of interaction and observation events to consider + /// Percentage from (0,1] determines how much percentage of interaction and observation events to consider /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float SubsampleRate = 1.0f, PersonalizerClientOptions options = null) : + public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; if (isLocalInference) { - validateAndAssignSampleRate(SubsampleRate); + validateAndAssignSampleRate(subsampleRate); //Intialize liveModel and call Rank processor //ToDo:TASK 13057958: Working on changes to support token authentication in RLClient Configuration configuration = GetConfigurationForLiveModel("Token", "token"); @@ -125,15 +125,15 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali /// Supported Cognitive Services endpoint. /// A credential used to authenticate to an Azure Service. /// A flag to determine whether to use local inference. - /// Percentage from (0,1] determines how much percentage of interaction and observation events to consider + /// Percentage from (0,1] determines how much percentage of interaction and observation events to consider /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, float SubsampleRate = 1.0f, PersonalizerClientOptions options = null) : + public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { _isLocalInference = isLocalInference; if (isLocalInference) { - validateAndAssignSampleRate(SubsampleRate); + validateAndAssignSampleRate(subsampleRate); //Intialize liveModel and Rankprocessor Configuration configuration = GetConfigurationForLiveModel("apiKey", apiKey); LiveModel liveModel = new LiveModel(configuration); @@ -566,8 +566,8 @@ internal Configuration GetConfigurationForLiveModel(string authType, string auth } config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/interactions"; config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/observations"; - config["interaction.subsample.rate"] = Convert.ToString(_SubsampleRate, CultureInfo.InvariantCulture); - config["observation.subsample.rate"] = Convert.ToString(_SubsampleRate, CultureInfo.InvariantCulture); + config["interaction.subsample.rate"] = Convert.ToString(subsampleRate, CultureInfo.InvariantCulture); + config["observation.subsample.rate"] = Convert.ToString(subsampleRate, CultureInfo.InvariantCulture); //ToDo: TASK 13057958 Working on changes to support model api in RL.Net config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.1/model"; config["vw.commandline"] = _personalizerPolicy.Arguments; @@ -579,13 +579,13 @@ internal Configuration GetConfigurationForLiveModel(string authType, string auth } /// validate SubsampleRate input from user and throw exception if not in range - private void validateAndAssignSampleRate(float SubsampleRate) + private void validateAndAssignSampleRate(float subsampleRate) { - if (0 >= SubsampleRate || SubsampleRate > 1) + if (0 >= subsampleRate || subsampleRate > 1) { - throw new ArgumentOutOfRangeException(nameof(SubsampleRate), "Percentage should be between (0,1]"); + throw new ArgumentOutOfRangeException(nameof(subsampleRate), "Percentage should be between (0,1]"); } - _SubsampleRate = SubsampleRate; + this.subsampleRate = subsampleRate; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs index 76ed6a3cb8a6..58ede423a35c 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs @@ -18,7 +18,7 @@ public PersonalizerTestBase(bool isAsync) : base(isAsync) Sanitizer = new PersonalizerRecordedTestSanitizer(); } - protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false, bool isLocalInference = false, float SubsampleRate = 1.0f) + protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false, bool isLocalInference = false, float subsampleRate = 1.0f) { string endpoint = isSingleSlot ? TestEnvironment.SingleSlotEndpoint : TestEnvironment.MultiSlotEndpoint; string apiKey = isSingleSlot ? TestEnvironment.SingleSlotApiKey : TestEnvironment.MultiSlotApiKey; @@ -32,7 +32,7 @@ protected async Task GetPersonalizerClientAsync(bool isSingl PersonalizerClient personalizerClient = null; if (isLocalInference) { - personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options: options, SubsampleRate: SubsampleRate); + personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options: options, subsampleRate: subsampleRate); } else { diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs index 3afb53b35284..d864bdac32aa 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs @@ -83,8 +83,8 @@ public async Task MultiSlotTest() [Test] public async Task MultiSlotLocalInferenceTest() { - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, SubsampleRate: 1.01f)); - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, SubsampleRate: 0f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, subsampleRate: 1.01f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, subsampleRate: 0f)); PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true); await MultiSlotTestInner(client); } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs index 6b6b070060d3..85ee4a05be5d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs @@ -24,8 +24,8 @@ public async Task SingleSlotRankTests() [Test] public async Task SingleSlotRankLocalInferenceTests() { - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, SubsampleRate: 1.01f)); - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, SubsampleRate: 0f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, subsampleRate: 1.01f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, subsampleRate: 0f)); PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true); await SingleSlotRankTests(client); } From 9b1c3b08acf2750fe5950b1a76b1c9d84ab73fb2 Mon Sep 17 00:00:00 2001 From: johnhuang01 <90279783+johnhuang01@users.noreply.github.com> Date: Sun, 6 Feb 2022 20:13:02 -0800 Subject: [PATCH 15/33] 13192221: Point to the Rl.Net nuget package from SDK dev drop (#9) --- NuGet.Config | 1 - .../Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj | 2 +- .../tests/Azure.AI.Personalizer.Tests.csproj | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index 7b6da4adea45..be103949f661 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -10,7 +10,6 @@ Used for azure-sdk-tools repo until issue https://github.com/Azure/azure-sdk-tools/issues/1329 is addressed --> - diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj b/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj index 3a4a5faa2a62..4bd20e764f5e 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj @@ -32,7 +32,7 @@ - + diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj index b39fb2167a97..a4ebd5b5462b 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj @@ -7,7 +7,7 @@ $(NoWarn);CS8032 - + From 93fd434f670812c3210fe2fde666c850c6bd3bc1 Mon Sep 17 00:00:00 2001 From: Personalizer Team Date: Tue, 8 Feb 2022 10:17:56 -0800 Subject: [PATCH 16/33] Adding test code for Model/Put api and moving to preview.3 --- .../src/Generated/EvaluationsRestClient.cs | 8 +- .../src/Generated/EventsRestClient.cs | 4 +- .../src/Generated/LogRestClient.cs | 4 +- .../src/Generated/ModelClient.cs | 186 ------------------ .../src/Generated/ModelRestClient.cs | 84 +++++++- .../Generated/Models/PersonalizerErrorCode.cs | 20 +- .../Generated/MultiSlotEventsRestClient.cs | 4 +- .../src/Generated/MultiSlotRestClient.cs | 2 +- .../src/Generated/PolicyRestClient.cs | 6 +- .../src/Generated/RankRestClient.cs | 2 +- .../ServiceConfigurationRestClient.cs | 6 +- .../PersonalizerAdministrationClient.cs | 48 ++++- .../src/Models/PersonalizerClient.cs | 6 +- .../tests/Personalizer/ModelTests.cs | 13 +- .../ConfigurationTests.json | 22 +-- .../ConfigurationTestsAsync.json | 22 +-- .../EventsTests/SingleSlotEventsTests.json | 4 +- .../SingleSlotEventsTestsAsync.json | 4 +- .../SessionRecords/LogsTests/LogTest.json | 4 +- .../LogsTests/LogTestAsync.json | 4 +- .../SessionRecords/ModelTests/ModelTest.json | 153 ++++++++------ .../ModelTests/ModelTestAsync.json | 155 +++++++++------ .../MultiSlotLocalInferenceTest.json | 18 +- .../MultiSlotLocalInferenceTestAsync.json | 18 +- .../MultiSlotTests/MultiSlotTest.json | 18 +- .../MultiSlotTests/MultiSlotTestAsync.json | 18 +- .../SingleSlotRankLocalInferenceTests.json | 6 +- ...ingleSlotRankLocalInferenceTestsAsync.json | 6 +- .../RankTests/SingleSlotRankTests.json | 6 +- .../RankTests/SingleSlotRankTestsAsync.json | 6 +- 30 files changed, 434 insertions(+), 423 deletions(-) delete mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Generated/ModelClient.cs diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/EvaluationsRestClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/EvaluationsRestClient.cs index ab5ae5800dd4..4e8df6d96cdc 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/EvaluationsRestClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/EvaluationsRestClient.cs @@ -41,7 +41,7 @@ internal HttpMessage CreateDeleteRequest(string evaluationId) request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/evaluations/", false); uri.AppendPath(evaluationId, true); request.Uri = uri; @@ -99,7 +99,7 @@ internal HttpMessage CreateGetRequest(string evaluationId) request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/evaluations/", false); uri.AppendPath(evaluationId, true); request.Uri = uri; @@ -168,7 +168,7 @@ internal HttpMessage CreateListRequest() request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/evaluations", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -232,7 +232,7 @@ internal HttpMessage CreateCreateRequest(PersonalizerEvaluationOptions evaluatio request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/evaluations", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/EventsRestClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/EventsRestClient.cs index 95e7a3e6af90..255dc118a554 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/EventsRestClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/EventsRestClient.cs @@ -39,7 +39,7 @@ internal HttpMessage CreateRewardRequest(string eventId, PersonalizerRewardOptio request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/events/", false); uri.AppendPath(eventId, true); uri.AppendPath("/reward", false); @@ -113,7 +113,7 @@ internal HttpMessage CreateActivateRequest(string eventId) request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/events/", false); uri.AppendPath(eventId, true); uri.AppendPath("/activate", false); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/LogRestClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/LogRestClient.cs index 428ddc5cd1b2..33a6221ca354 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/LogRestClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/LogRestClient.cs @@ -40,7 +40,7 @@ internal HttpMessage CreateDeleteRequest() request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/logs", false); request.Uri = uri; return message; @@ -83,7 +83,7 @@ internal HttpMessage CreateGetPropertiesRequest() request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/logs/properties", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/ModelClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/ModelClient.cs deleted file mode 100644 index ae9af19c567c..000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/ModelClient.cs +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.AI.Personalizer -{ - /// The Model service client. - internal partial class ModelClient - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal ModelRestClient RestClient { get; } - - /// Initializes a new instance of ModelClient for mocking. - protected ModelClient() - { - } - - /// Initializes a new instance of ModelClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public ModelClient(string endpoint, TokenCredential credential, PersonalizerClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new PersonalizerClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - string[] scopes = { "https://cognitiveservices.azure.com/.default" }; - _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes)); - RestClient = new ModelRestClient(_clientDiagnostics, _pipeline, endpoint); - } - - /// Initializes a new instance of ModelClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public ModelClient(string endpoint, AzureKeyCredential credential, PersonalizerClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new PersonalizerClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - _pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key")); - RestClient = new ModelRestClient(_clientDiagnostics, _pipeline, endpoint); - } - - /// Initializes a new instance of ModelClient. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// Supported Cognitive Services endpoint. - internal ModelClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint) - { - RestClient = new ModelRestClient(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Get the model file generated by Personalizer service. - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ModelClient.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get the model file generated by Personalizer service. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ModelClient.Get"); - scope.Start(); - try - { - return RestClient.Get(cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Resets the model file generated by Personalizer service. - /// The cancellation token to use. - public virtual async Task ResetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ModelClient.Reset"); - scope.Start(); - try - { - return await RestClient.ResetAsync(cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Resets the model file generated by Personalizer service. - /// The cancellation token to use. - public virtual Response Reset(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ModelClient.Reset"); - scope.Start(); - try - { - return RestClient.Reset(cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get properties of the model file generated by Personalizer service. - /// The cancellation token to use. - public virtual async Task> GetPropertiesAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ModelClient.GetProperties"); - scope.Start(); - try - { - return await RestClient.GetPropertiesAsync(cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get properties of the model file generated by Personalizer service. - /// The cancellation token to use. - public virtual Response GetProperties(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ModelClient.GetProperties"); - scope.Start(); - try - { - return RestClient.GetProperties(cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/ModelRestClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/ModelRestClient.cs index af0400da452b..8e41037f85e5 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/ModelRestClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/ModelRestClient.cs @@ -34,25 +34,30 @@ public ModelRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin _pipeline = pipeline; } - internal HttpMessage CreateGetRequest() + internal HttpMessage CreateGetRequest(bool? signed) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/model", false); + if (signed != null) + { + uri.AppendQuery("signed", signed.Value, true); + } request.Uri = uri; - request.Headers.Add("Accept", "application/octet-stream"); + request.Headers.Add("Accept", "application/octet-stream, application/json"); return message; } /// Get the model file generated by Personalizer service. + /// True if requesting signed model zip archive, false otherwise. /// The cancellation token to use. - public async Task> GetAsync(CancellationToken cancellationToken = default) + public async Task> GetAsync(bool? signed = null, CancellationToken cancellationToken = default) { - using var message = CreateGetRequest(); + using var message = CreateGetRequest(signed); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -67,10 +72,11 @@ public async Task> GetAsync(CancellationToken cancellationToken } /// Get the model file generated by Personalizer service. + /// True if requesting signed model zip archive, false otherwise. /// The cancellation token to use. - public Response Get(CancellationToken cancellationToken = default) + public Response Get(bool? signed = null, CancellationToken cancellationToken = default) { - using var message = CreateGetRequest(); + using var message = CreateGetRequest(signed); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -84,6 +90,66 @@ public Response Get(CancellationToken cancellationToken = default) } } + internal HttpMessage CreateImportRequest(Stream body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(endpoint, false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); + uri.AppendPath("/model", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/octet-stream"); + request.Content = RequestContent.Create(body); + return message; + } + + /// Replace the existing model file for the Personalizer service. + /// The binary to use. + /// The cancellation token to use. + /// is null. + public async Task ImportAsync(Stream body, CancellationToken cancellationToken = default) + { + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateImportRequest(body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Replace the existing model file for the Personalizer service. + /// The binary to use. + /// The cancellation token to use. + /// is null. + public Response Import(Stream body, CancellationToken cancellationToken = default) + { + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateImportRequest(body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + internal HttpMessage CreateResetRequest() { var message = _pipeline.CreateMessage(); @@ -91,7 +157,7 @@ internal HttpMessage CreateResetRequest() request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/model", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -135,7 +201,7 @@ internal HttpMessage CreateGetPropertiesRequest() request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/model/properties", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerErrorCode.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerErrorCode.cs index f089ff68ef64..0de6f0376573 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerErrorCode.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerErrorCode.cs @@ -35,12 +35,18 @@ public PersonalizerErrorCode(string value) private const string InvalidEventIdToActivateValue = "InvalidEventIdToActivate"; private const string InvalidRankRequestValue = "InvalidRankRequest"; private const string InvalidExportLogsRequestValue = "InvalidExportLogsRequest"; + private const string InvalidRequestValue = "InvalidRequest"; private const string InvalidContainerValue = "InvalidContainer"; private const string InvalidModelMetadataValue = "InvalidModelMetadata"; private const string ApprenticeModeNeverTurnedOnValue = "ApprenticeModeNeverTurnedOn"; private const string MissingAppIdValue = "MissingAppId"; private const string InvalidRewardWaitTimeValue = "InvalidRewardWaitTime"; + private const string InvalidLogRetentionDaysValue = "InvalidLogRetentionDays"; private const string InvalidMultiSlotApiAccessValue = "InvalidMultiSlotApiAccess"; + private const string PayloadSizeExceededValue = "PayloadSizeExceeded"; + private const string InvalidModelImportSignatureValue = "InvalidModelImportSignature"; + private const string InvalidModelImportFormatValue = "InvalidModelImportFormat"; + private const string InvalidApiAccessValue = "InvalidApiAccess"; private const string ModelFileAccessDeniedValue = "ModelFileAccessDenied"; private const string ProblemTypeIncompatibleWithAutoOptimizationValue = "ProblemTypeIncompatibleWithAutoOptimization"; private const string ResourceNotFoundValue = "ResourceNotFound"; @@ -84,6 +90,8 @@ public PersonalizerErrorCode(string value) public static PersonalizerErrorCode InvalidRankRequest { get; } = new PersonalizerErrorCode(InvalidRankRequestValue); /// Invalid request. public static PersonalizerErrorCode InvalidExportLogsRequest { get; } = new PersonalizerErrorCode(InvalidExportLogsRequestValue); + /// Invalid request. + public static PersonalizerErrorCode InvalidRequest { get; } = new PersonalizerErrorCode(InvalidRequestValue); /// SAS Uri must be the Uri to a container that has write permissions. public static PersonalizerErrorCode InvalidContainer { get; } = new PersonalizerErrorCode(InvalidContainerValue); /// Invalid model metadata. @@ -92,10 +100,20 @@ public PersonalizerErrorCode(string value) public static PersonalizerErrorCode ApprenticeModeNeverTurnedOn { get; } = new PersonalizerErrorCode(ApprenticeModeNeverTurnedOnValue); /// AppId is missing in the header. public static PersonalizerErrorCode MissingAppId { get; } = new PersonalizerErrorCode(MissingAppIdValue); - /// Reward wait time should be between 5 seconds and 2 days. + /// Reward wait time should be either 10 minutes or 4 hours or 12 hours or 24 hours. public static PersonalizerErrorCode InvalidRewardWaitTime { get; } = new PersonalizerErrorCode(InvalidRewardWaitTimeValue); + /// Log Retention Days must be -1 to store indefinitely or must be at least reward wait time plus 1 day (rounded up). + public static PersonalizerErrorCode InvalidLogRetentionDays { get; } = new PersonalizerErrorCode(InvalidLogRetentionDaysValue); /// Multi-slot feature is currently disabled. Please follow multi-slot Personalizer documentation to update your loop settings to enable multi-slot functionality. public static PersonalizerErrorCode InvalidMultiSlotApiAccess { get; } = new PersonalizerErrorCode(InvalidMultiSlotApiAccessValue); + /// Exceeds maximum allowed payload size. + public static PersonalizerErrorCode PayloadSizeExceeded { get; } = new PersonalizerErrorCode(PayloadSizeExceededValue); + /// Given model file is not signed or does not have a valid signature. + public static PersonalizerErrorCode InvalidModelImportSignature { get; } = new PersonalizerErrorCode(InvalidModelImportSignatureValue); + /// Given model file format is invalid. + public static PersonalizerErrorCode InvalidModelImportFormat { get; } = new PersonalizerErrorCode(InvalidModelImportFormatValue); + /// Api is currently disabled for the instance. + public static PersonalizerErrorCode InvalidApiAccess { get; } = new PersonalizerErrorCode(InvalidApiAccessValue); /// Key vault Key used for customer managed key cannot be accessed. public static PersonalizerErrorCode ModelFileAccessDenied { get; } = new PersonalizerErrorCode(ModelFileAccessDeniedValue); /// Auto-optimization is not compatible with multi-slot personalization. diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotEventsRestClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotEventsRestClient.cs index 4233b8366958..2c935101ff06 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotEventsRestClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotEventsRestClient.cs @@ -39,7 +39,7 @@ internal HttpMessage CreateRewardRequest(string eventId, PersonalizerRewardMulti request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/multislot/events/", false); uri.AppendPath(eventId, true); uri.AppendPath("/reward", false); @@ -113,7 +113,7 @@ internal HttpMessage CreateActivateRequest(string eventId) request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/multislot/events/", false); uri.AppendPath(eventId, true); uri.AppendPath("/activate", false); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotRestClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotRestClient.cs index 121afab5e515..c001a8ef77ce 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotRestClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotRestClient.cs @@ -40,7 +40,7 @@ internal HttpMessage CreateRankRequest(PersonalizerRankMultiSlotOptions body) request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/multislot/rank", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/PolicyRestClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/PolicyRestClient.cs index 66ca693d167f..fd3c936e584a 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/PolicyRestClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/PolicyRestClient.cs @@ -40,7 +40,7 @@ internal HttpMessage CreateGetRequest() request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/configurations/policy", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -94,7 +94,7 @@ internal HttpMessage CreateUpdateRequest(PersonalizerPolicy policy) request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/configurations/policy", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -166,7 +166,7 @@ internal HttpMessage CreateResetRequest() request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/configurations/policy", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankRestClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankRestClient.cs index 51d57677e5cc..24a0be61d7ec 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankRestClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankRestClient.cs @@ -40,7 +40,7 @@ internal HttpMessage CreateRankRequest(PersonalizerRankOptions rankRequest) request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/rank", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/ServiceConfigurationRestClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/ServiceConfigurationRestClient.cs index 4c7dfbae7b3d..72fff9d81e1c 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/ServiceConfigurationRestClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/ServiceConfigurationRestClient.cs @@ -40,7 +40,7 @@ internal HttpMessage CreateUpdateRequest(PersonalizerServiceProperties config) request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/configurations/service", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -112,7 +112,7 @@ internal HttpMessage CreateGetRequest() request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/configurations/service", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -166,7 +166,7 @@ internal HttpMessage CreateApplyFromEvaluationRequest(PersonalizerPolicyReferenc request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(endpoint, false); - uri.AppendRaw("/personalizer/v1.1-preview.1", false); + uri.AppendRaw("/personalizer/v1.1-preview.3", false); uri.AppendPath("/configurations/applyFromEvaluation", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs index 07ad969801e5..ff255cb70b20 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; @@ -271,14 +271,15 @@ public virtual Response ApplyPersonalizerEvaluation(PersonalizerPolicyReferenceO } /// Get the model file generated by Personalizer service. + /// True if requesting digitally signed model zip archive, false otherwise. /// The cancellation token to use. - public virtual async Task> GetPersonalizerModelAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetPersonalizerModelAsync(bool isSigned = false, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.GetPersonalizerModel"); scope.Start(); try { - return await ModelRestClient.GetAsync(cancellationToken).ConfigureAwait(false); + return await ModelRestClient.GetAsync(isSigned, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -288,14 +289,51 @@ public virtual async Task> GetPersonalizerModelAsync(Cancellati } /// Get the model file generated by Personalizer service. + /// True if requesting signed model zip archive, false otherwise. /// The cancellation token to use. - public virtual Response GetPersonalizerModel(CancellationToken cancellationToken = default) + public virtual Response GetPersonalizerModel(bool isSigned = false, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.GetPersonalizerModel"); scope.Start(); try { - return ModelRestClient.Get(cancellationToken); + return ModelRestClient.Get(isSigned, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the current model used by Personalizer service with an updated model. + /// Stream representing the digitally signed model zip archive. + /// The cancellation token to use. + public virtual async Task ImportPersonalizerModelAsync(Stream modelStream, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerModel"); + scope.Start(); + try + { + return await ModelRestClient.ImportAsync(modelStream, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the current model used by Personalizer service with an updated model. + /// Stream representing the digitally signed model zip archive. + /// The cancellation token to use. + public virtual Response ImportPersonalizerModel(Stream modelStream, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerModel"); + scope.Start(); + try + { + return ModelRestClient.Import(modelStream, cancellationToken); } catch (Exception e) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index 95e8907760b1..c417142d0d3e 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -564,12 +564,12 @@ internal Configuration GetConfigurationForLiveModel(string authType, string auth //ToDo: TASK 13057958 Working on changes to support token authentication in RLClient //config["http.token.key"] = authValue; } - config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/interactions"; - config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/observations"; + config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.3/logs/interactions"; + config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.3/logs/observations"; config["interaction.subsample.rate"] = Convert.ToString(subsampleRate, CultureInfo.InvariantCulture); config["observation.subsample.rate"] = Convert.ToString(subsampleRate, CultureInfo.InvariantCulture); //ToDo: TASK 13057958 Working on changes to support model api in RL.Net - config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.1/model"; + config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.3/model"; config["vw.commandline"] = _personalizerPolicy.Arguments; config["protocol.version"] = "2"; config["initial_exploration.epsilon"] = Convert.ToString(_personalizerServiceProperties.ExplorationPercentage, CultureInfo.InvariantCulture); diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs index 646d939e34dc..3b85d9169ca3 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs @@ -17,14 +17,21 @@ public ModelTests(bool isAsync) : base(isAsync) public async Task ModelTest() { PersonalizerAdministrationClient client = GetAdministrationClient(isSingleSlot: true); - await GetModel(client); + await GetModel(false, client); await GetModelProperties(client); + Response response = await GetModel(true, client); + await ImportModel(response.Value, client); await ResetModel(client); } - private async Task GetModel(PersonalizerAdministrationClient client) + private async Task> GetModel(bool signed, PersonalizerAdministrationClient client) { - await client.GetPersonalizerModelAsync(); + return await client.GetPersonalizerModelAsync(signed); + } + + private async Task ImportModel(Stream modelStream, PersonalizerAdministrationClient client) + { + return await client.ImportPersonalizerModelAsync(modelStream); } private async Task ResetModel(PersonalizerAdministrationClient client) diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ConfigurationsTests/ConfigurationTests.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ConfigurationsTests/ConfigurationTests.json index b6e35a04cdc4..893125d07a40 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ConfigurationsTests/ConfigurationTests.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ConfigurationsTests/ConfigurationTests.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -33,7 +33,7 @@ "ResponseBody": "downstream duration timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -86,7 +86,7 @@ } }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -109,7 +109,7 @@ "ResponseBody": "upstream request timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -132,7 +132,7 @@ "ResponseBody": "upstream request timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -177,7 +177,7 @@ } }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -205,7 +205,7 @@ "ResponseBody": "upstream request timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -233,7 +233,7 @@ "ResponseBody": "upstream request timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -261,7 +261,7 @@ "ResponseBody": "upstream request timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -302,7 +302,7 @@ } }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -337,7 +337,7 @@ } }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ConfigurationsTests/ConfigurationTestsAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ConfigurationsTests/ConfigurationTestsAsync.json index b6e35a04cdc4..893125d07a40 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ConfigurationsTests/ConfigurationTestsAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ConfigurationsTests/ConfigurationTestsAsync.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -33,7 +33,7 @@ "ResponseBody": "downstream duration timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -86,7 +86,7 @@ } }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -109,7 +109,7 @@ "ResponseBody": "upstream request timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -132,7 +132,7 @@ "ResponseBody": "upstream request timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -177,7 +177,7 @@ } }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -205,7 +205,7 @@ "ResponseBody": "upstream request timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -233,7 +233,7 @@ "ResponseBody": "upstream request timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -261,7 +261,7 @@ "ResponseBody": "upstream request timeout" }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -302,7 +302,7 @@ } }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -337,7 +337,7 @@ } }, { - "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://personalizersdktestrecordersingleslot.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsTests.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsTests.json index b95b5e2a10d7..d15552b1aca8 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsTests.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsTests.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/reward", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/events/123456789/reward", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -35,7 +35,7 @@ "ResponseBody": [] }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/activate", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/events/123456789/activate", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsTestsAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsTestsAsync.json index b95b5e2a10d7..d15552b1aca8 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsTestsAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsTestsAsync.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/reward", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/events/123456789/reward", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -35,7 +35,7 @@ "ResponseBody": [] }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/activate", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/events/123456789/activate", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/LogsTests/LogTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/LogsTests/LogTest.json index 933e02bb259a..523c3c1b0bef 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/LogsTests/LogTest.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/LogsTests/LogTest.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/logs/properties", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/logs/properties", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -33,7 +33,7 @@ "ResponseBody": {} }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/logs", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/logs", "RequestMethod": "DELETE", "RequestHeaders": { "Ocp-Apim-Subscription-Key": "Sanitized", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/LogsTests/LogTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/LogsTests/LogTestAsync.json index 933e02bb259a..523c3c1b0bef 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/LogsTests/LogTestAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/LogsTests/LogTestAsync.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/logs/properties", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/logs/properties", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -33,7 +33,7 @@ "ResponseBody": {} }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/logs", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/logs", "RequestMethod": "DELETE", "RequestHeaders": { "Ocp-Apim-Subscription-Key": "Sanitized", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json index e24d272911f6..0497a4d7d192 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json @@ -1,106 +1,141 @@ { "Entries": [ { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/model", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=false", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/octet-stream", + "Accept": "application/octet-stream, application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-ea5b816552290444b10cd30aba31e21a-e15c75a5419efa4d-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "44ddce88136516921a7dec82c13d0833", + "traceparent": "00-e98e2a58d4059695a3536105883c1aec-8e7f9e21144c7064-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220207.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "54fdd3ff4adf4059f9e84c940341c97d", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "cc10f1d5-d035-4a37-98ab-f314d6b241ee", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], + "Cache-Control": "no-store, must-revalidate, no-cache", + "Content-Disposition": "attachment; filename=model.vw; filename*=UTF-8\u0027\u0027model.vw", "Content-Length": "0", - "Date": "Thu, 05 Aug 2021 20:59:11 GMT", + "Content-Type": "application/octet-stream", + "Date": "Tue, 08 Feb 2022 04:49:39 GMT", "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "58" + "Last-Modified": "Tue, 08 Feb 2022 04:45:19 GMT", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" }, - "ResponseBody": [] + "ResponseBody": null }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/model/properties", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model/properties", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-c1cb56a47d6451499510c223565573b7-720ebd7c99b18c49-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "3aa331e1c6475d535a9fe1883413099d", + "traceparent": "00-90caf7f408d8a595abafe51af3b778ce-72fd30aae43900fd-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220207.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "fd9d54f446da306dd532ef8788956a73", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "6f109a12-4228-4476-8353-871f2620857e", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "91", + "Cache-Control": "no-store, must-revalidate, no-cache", + "Content-Length": "103", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 05 Aug 2021 20:59:11 GMT", + "Date": "Tue, 08 Feb 2022 04:49:40 GMT", "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "93" + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" }, - "ResponseBody": { - "creationTime": "2021-08-05T13:55:04-07:00", - "lastModifiedTime": "2021-08-05T13:55:04-07:00" - } + "ResponseBody": [ + "{\r\n", + " \u0022creationTime\u0022: \u00222021-04-14T18:35:22\u002B00:00\u0022,\r\n", + " \u0022lastModifiedTime\u0022: \u00222022-02-08T04:45:19\u002B00:00\u0022\r\n", + "}" + ] }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/model", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/octet-stream, application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-8f8f889f1c89d567aa54b61476b0d70c-fc9369752558c3a7-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220207.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "ace92831713032ca11a785e61fc54d73", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, must-revalidate, no-cache", + "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", + "Content-Length": "2075", + "Content-Type": "application/octet-stream", + "Date": "Tue, 08 Feb 2022 04:49:42 GMT", + "Expires": "0", + "Last-Modified": "Mon, 04 Oct 2021 16:47:43 GMT", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" + }, + "ResponseBody": "UEsDBBQAAAAIADWmR1Qcxu93eAEAAIcCAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYPADMo2SLBPTzMwMLIxNTExS05ItzRKTkgxSU43MTE1TzFPTdC1cC/xT9BNTUyySkk1MTS0Sk0yMDUySDIzM0sxMzE0tTQwNLVJSwcqcGXKBJh4AYgYhEIEEJgOxgq5uclJ8YkoahJFaUZCTX5SKEChOzC3ISYWwSyoLUhUyC4pBPEy1xfmJifE5QHZuaU5JZk5mXipctCgxLxvISS0ozszJz1Mw0DMygAAjSwsDI2MjoFxuYlF6Zl5ijkImAwvQWS\u002BcjE8zojmXgRlKJxxAlnpgDxFMdEh9yoQk/mM/mHKIdahOwCL\u002BIN8BZsqFLy3uDmDWgXwQbWJs/BmkCEqvcYYFIJIaFPAPSsfJI4tKQNQ1pMLVn9FhYMi5M3lv392FjkAJ\u002B8OpDAyFqXaH9NZGWRnyHLbe\u002BYaBYcnLq3uPvwtwAslf4mJE4WtbM6Kof7kWVT7mKCpfi4cJxb69y5kYCqRY9gKdApY3rWNG4QMAUEsDBBQAAAAIADWmR1SQ6SPzWAQAAPcGAAAKAAAAc2lnbmVyLmRlcjNoYvts0MR6ewEzEyMTk3ANg6dXV0iBF8\u002BftMZ\u002BBgYQz4CXjVOrzaPtOy8jIzcrg4GLobCBIBsX5yS1zsmfdFIYJcWY3Z18MAUdfV0NJQzE2JhDWZiF\u002BYE8Bc\u002B8tKJEBWdHBQNTAzlxXiMjAyMDYyNDYwtD8ygg19jA0MgSyjVQNVQ2UITolSooSNUrSC0qzs9LzMmsSi3SS6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7pB2M7mrdWStwg62nvCotduLVrXoxax/JLvN4FTXxpN/XFuuQM0801r/aeU3ywYOXAvWup/I3zHx0zkD74rufptu3qpt8jOks/nlF6qfAW8vbEwxb5uivZllRK7/L5afn6nfaqbXaF1tuxv5e86lxQ8XZ5zvO8DyMM9VkN1aSXLOocqehxZIJmgXbuzJPsrzacuHhClblhxVpNiFmdaxHflYrPWR96cN1qI1xWubrC6k22hM3\u002BQEAUEsDBBQAAAAIADWmR1RU97bHBQEAAAABAAAUAAAAc2hhNTEyX3NpZ25hdHVyZS5iaW4BAAH//oXISYN\u002BjmbQVwV2a\u002BFkqipm\u002Bk6QzBctyn\u002BH1kMgBY\u002Bxlg2ry3bwUFjNNDun/pX6RyJugdOAQ\u002BwnKX9GBTEMBqfx1fuBweiFxahUSd\u002B2XlqtiwFx0QfuIhUbvGvORGZd6VFjfWVpQGcxor9CUO80p5DQ6Pm5H1Ru2O/sftOuK\u002Bs1\u002BU6fDH3O0dLlnWJkFNSexz\u002BapZYaRiZgzk56AjwzjNu68cI5vtyV27YZtajBdWzbdQ5uAn4YmCq7VvS/zFUwNfUxYJCEvyLDTklRCWgVSMEFQnoDVhdJkEzlGGtbuZIyYHvTDCome9HfkwsbVTcrsclowWwTRFuyW5iZjb48jUtQSwECFAAUAAAACAA1pkdUHMbvd3gBAACHAgAACAAAAAAAAAAAAAAAAAAAAAAAbW9kZWwudndQSwECFAAUAAAACAA1pkdUkOkj81gEAAD3BgAACgAAAAAAAAAAAAAAAACeAQAAc2lnbmVyLmRlclBLAQIUABQAAAAIADWmR1RU97bHBQEAAAABAAAUAAAAAAAAAAAAAAAAAB4GAABzaGE1MTJfc2lnbmF0dXJlLmJpblBLBQYAAAAAAwADALAAAABVBwAAAAA=" + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "2075", + "Content-Type": "application/octet-stream", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-7d94e9d2b6affc07f9e19a6150ed4015-3ee7e4476da8d384-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220207.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "0b4b02a7170ab99266cc7fad5ad1b763", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "UEsDBBQAAAAIADWmR1Qcxu93eAEAAIcCAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYPADMo2SLBPTzMwMLIxNTExS05ItzRKTkgxSU43MTE1TzFPTdC1cC/xT9BNTUyySkk1MTS0Sk0yMDUySDIzM0sxMzE0tTQwNLVJSwcqcGXKBJh4AYgYhEIEEJgOxgq5uclJ8YkoahJFaUZCTX5SKEChOzC3ISYWwSyoLUhUyC4pBPEy1xfmJifE5QHZuaU5JZk5mXipctCgxLxvISS0ozszJz1Mw0DMygAAjSwsDI2MjoFxuYlF6Zl5ijkImAwvQWS\u002BcjE8zojmXgRlKJxxAlnpgDxFMdEh9yoQk/mM/mHKIdahOwCL\u002BIN8BZsqFLy3uDmDWgXwQbWJs/BmkCEqvcYYFIJIaFPAPSsfJI4tKQNQ1pMLVn9FhYMi5M3lv392FjkAJ\u002B8OpDAyFqXaH9NZGWRnyHLbe\u002BYaBYcnLq3uPvwtwAslf4mJE4WtbM6Kof7kWVT7mKCpfi4cJxb69y5kYCqRY9gKdApY3rWNG4QMAUEsDBBQAAAAIADWmR1SQ6SPzWAQAAPcGAAAKAAAAc2lnbmVyLmRlcjNoYvts0MR6ewEzEyMTk3ANg6dXV0iBF8\u002BftMZ\u002BBgYQz4CXjVOrzaPtOy8jIzcrg4GLobCBIBsX5yS1zsmfdFIYJcWY3Z18MAUdfV0NJQzE2JhDWZiF\u002BYE8Bc\u002B8tKJEBWdHBQNTAzlxXiMjAyMDYyNDYwtD8ygg19jA0MgSyjVQNVQ2UITolSooSNUrSC0qzs9LzMmsSi3SS6wqLUrVS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rdWStwg62nvCotduLVrXoxax/JLvN4FTXxpN/XFuuQM0801r/aeU3ywYOXAvWup/I3zHx0zkD74rufptu3qpt8jOks/nlF6qfAW8vbEwxb5uivZllRK7/L5afn6nfaqbXaF1tuxv5e86lxQ8XZ5zvO8DyMM9VkN1aSXLOocqehxZIJmgXbuzJPsrzacuHhClblhxVpNiFmdaxHflYrPWR96cN1qI1xWubrC6k22hM3\u002BQEAUEsDBBQAAAAIADWmR1RU97bHBQEAAAABAAAUAAAAc2hhNTEyX3NpZ25hdHVyZS5iaW4BAAH//oXISYN\u002BjmbQVwV2a\u002BFkqipm\u002Bk6QzBctyn\u002BH1kMgBY\u002Bxlg2ry3bwUFjNNDun/pX6RyJugdOAQ\u002BwnKX9GBTEMBqfx1fuBweiFxahUSd\u002B2XlqtiwFx0QfuIhUbvGvORGZd6VFjfWVpQGcxor9CUO80p5DQ6Pm5H1Ru2O/sftOuK\u002Bs1\u002BU6fDH3O0dLlnWJkFNSexz\u002BapZYaRiZgzk56AjwzjNu68cI5vtyV27YZtajBdWzbdQ5uAn4YmCq7VvS/zFUwNfUxYJCEvyLDTklRCWgVSMEFQnoDVhdJkEzlGGtbuZIyYHvTDCome9HfkwsbVTcrsclowWwTRFuyW5iZjb48jUtQSwECFAAUAAAACAA1pkdUHMbvd3gBAACHAgAACAAAAAAAAAAAAAAAAAAAAAAAbW9kZWwudndQSwECFAAUAAAACAA1pkdUkOkj81gEAAD3BgAACgAAAAAAAAAAAAAAAACeAQAAc2lnbmVyLmRlclBLAQIUABQAAAAIADWmR1RU97bHBQEAAAABAAAUAAAAAAAAAAAAAAAAAB4GAABzaGE1MTJfc2lnbmF0dXJlLmJpblBLBQYAAAAAAwADALAAAABVBwAAAAA=", + "StatusCode": 204, + "ResponseHeaders": { + "Cache-Control": "no-store, must-revalidate, no-cache", + "Date": "Tue, 08 Feb 2022 04:49:49 GMT", + "Expires": "0", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-daf776d2681f8647ac73b0879270f912-f88b681397d1c745-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "5d19677d0ecc34ab08f6f1fd3c95c071", + "traceparent": "00-6fda99e488640bc8800333e5cd6b9899-ec877c01fc41f794-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220207.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "db63d87e1c58834d896aeb33c086100f", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 204, "ResponseHeaders": { - "apim-request-id": "39f058a9-2a12-4542-aa63-27c239b32bad", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Thu, 05 Aug 2021 20:59:27 GMT", + "Cache-Control": "no-store, must-revalidate, no-cache", + "Date": "Tue, 08 Feb 2022 04:49:52 GMT", "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "14894" + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" }, - "ResponseBody": [] + "ResponseBody": null } ], "Variables": { "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "663464005" + "RandomSeed": "1090338795" } -} \ No newline at end of file +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json index e24d272911f6..daefb87e1fc1 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json @@ -1,106 +1,139 @@ { "Entries": [ { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/model", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=false", "RequestMethod": "GET", "RequestHeaders": { - "Accept": "application/octet-stream", + "Accept": "application/octet-stream, application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-ea5b816552290444b10cd30aba31e21a-e15c75a5419efa4d-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "44ddce88136516921a7dec82c13d0833", + "traceparent": "00-1bca1a665b4200aa3b128b52273e7e1e-4378f4eec4eb965a-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220208.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "c6288841d99b7a7d20062507ca6d38b0", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "cc10f1d5-d035-4a37-98ab-f314d6b241ee", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], + "Cache-Control": "no-store, must-revalidate, no-cache", + "Content-Disposition": "attachment; filename=model.vw; filename*=UTF-8\u0027\u0027model.vw", "Content-Length": "0", - "Date": "Thu, 05 Aug 2021 20:59:11 GMT", + "Content-Type": "application/octet-stream", + "Date": "Tue, 08 Feb 2022 17:41:57 GMT", "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "58" + "Last-Modified": "Tue, 08 Feb 2022 04:49:50 GMT", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" }, - "ResponseBody": [] + "ResponseBody": null }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/model/properties", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model/properties", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-c1cb56a47d6451499510c223565573b7-720ebd7c99b18c49-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "3aa331e1c6475d535a9fe1883413099d", + "traceparent": "00-70faab57742d911155683a6daedfb1ed-c41c441baef3df4c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220208.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "fa0e2904b60e570f5cae893d1f9d43d7", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "6f109a12-4228-4476-8353-871f2620857e", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "91", + "Cache-Control": "no-store, must-revalidate, no-cache", + "Content-Length": "103", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 05 Aug 2021 20:59:11 GMT", + "Date": "Tue, 08 Feb 2022 17:41:58 GMT", "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "93" + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" }, - "ResponseBody": { - "creationTime": "2021-08-05T13:55:04-07:00", - "lastModifiedTime": "2021-08-05T13:55:04-07:00" - } + "ResponseBody": [ + "{\r\n", + " \u0022creationTime\u0022: \u00222021-04-14T18:35:22\u002B00:00\u0022,\r\n", + " \u0022lastModifiedTime\u0022: \u00222022-02-08T04:49:50\u002B00:00\u0022\r\n", + "}" + ] }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/model", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/octet-stream, application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-65606c3707f3a49510d2f5256e1c525a-5df616de88c3ae74-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220208.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "9aba3d9ec478a22e79e7835fe4b0db0f", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, must-revalidate, no-cache", + "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", + "Content-Length": "2075", + "Content-Type": "application/octet-stream", + "Date": "Tue, 08 Feb 2022 17:42:01 GMT", + "Expires": "0", + "Last-Modified": "Mon, 04 Oct 2021 16:47:43 GMT", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" + }, + "ResponseBody": "UEsDBBQAAAAIAEBNSFQcxu93eAEAAIcCAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYPADMo2SLBPTzMwMLIxNTExS05ItzRKTkgxSU43MTE1TzFPTdC1cC/xT9BNTUyySkk1MTS0Sk0yMDUySDIzM0sxMzE0tTQwNLVJSwcqcGXKBJh4AYgYhEIEEJgOxgq5uclJ8YkoahJFaUZCTX5SKEChOzC3ISYWwSyoLUhUyC4p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6VFjfWVpQGcxor9CUO80p5DQ6Pm5H1Ru2O/sftOuK\u002Bs1\u002BU6fDH3O0dLlnWJkFNSexz\u002BapZYaRiZgzk56AjwzjNu68cI5vtyV27YZtajBdWzbdQ5uAn4YmCq7VvS/zFUwNfUxYJCEvyLDTklRCWgVSMEFQnoDVhdJkEzlGGtbuZIyYHvTDCome9HfkwsbVTcrsclowWwTRFuyW5iZjb48jUtQSwECFAAUAAAACABATUhUHMbvd3gBAACHAgAACAAAAAAAAAAAAAAAAAAAAAAAbW9kZWwudndQSwECFAAUAAAACABATUhUkOkj81gEAAD3BgAACgAAAAAAAAAAAAAAAACeAQAAc2lnbmVyLmRlclBLAQIUABQAAAAIAEBNSFRU97bHBQEAAAABAAAUAAAAAAAAAAAAAAAAAB4GAABzaGE1MTJfc2lnbmF0dXJlLmJpblBLBQYAAAAAAwADALAAAABVBwAAAAA=" + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "2075", + "Content-Type": "application/octet-stream", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-6e2a4c546563f8f21c0b195425cd6fab-6c281dd1099d6322-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220208.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "bd9e2e6144968a2e79d069ed50405b82", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "UEsDBBQAAAAIAEBNSFQcxu93eAEAAIcCAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYPADMo2SLBPTzMwMLIxNTExS05ItzRKTkgxSU43MTE1TzFPTdC1cC/xT9BNTUyySkk1MTS0Sk0yMDUySDIzM0sxMzE0tTQwNLVJSwcqcGXKBJh4AYgYhEIEEJgOxgq5uclJ8YkoahJFaUZCTX5SKEChOzC3ISYWwSyoLUhUyC4pBPEy1xfmJifE5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or9CUO80p5DQ6Pm5H1Ru2O/sftOuK\u002Bs1\u002BU6fDH3O0dLlnWJkFNSexz\u002BapZYaRiZgzk56AjwzjNu68cI5vtyV27YZtajBdWzbdQ5uAn4YmCq7VvS/zFUwNfUxYJCEvyLDTklRCWgVSMEFQnoDVhdJkEzlGGtbuZIyYHvTDCome9HfkwsbVTcrsclowWwTRFuyW5iZjb48jUtQSwECFAAUAAAACABATUhUHMbvd3gBAACHAgAACAAAAAAAAAAAAAAAAAAAAAAAbW9kZWwudndQSwECFAAUAAAACABATUhUkOkj81gEAAD3BgAACgAAAAAAAAAAAAAAAACeAQAAc2lnbmVyLmRlclBLAQIUABQAAAAIAEBNSFRU97bHBQEAAAABAAAUAAAAAAAAAAAAAAAAAB4GAABzaGE1MTJfc2lnbmF0dXJlLmJpblBLBQYAAAAAAwADALAAAABVBwAAAAA=", + "StatusCode": 204, + "ResponseHeaders": { + "Cache-Control": "no-store, must-revalidate, no-cache", + "Date": "Tue, 08 Feb 2022 17:42:08 GMT", + "Expires": "0", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-daf776d2681f8647ac73b0879270f912-f88b681397d1c745-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "5d19677d0ecc34ab08f6f1fd3c95c071", + "traceparent": "00-a69cb0a0dc75fd620597075b26cfeef4-f734f184d167c1f9-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220208.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "8c684ec29db34037fb6c802733af73ab", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 204, "ResponseHeaders": { - "apim-request-id": "39f058a9-2a12-4542-aa63-27c239b32bad", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Thu, 05 Aug 2021 20:59:27 GMT", + "Cache-Control": "no-store, must-revalidate, no-cache", + "Date": "Tue, 08 Feb 2022 17:42:11 GMT", "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "14894" + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" }, - "ResponseBody": [] + "ResponseBody": null } ], "Variables": { - "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "663464005" + "RandomSeed": "1431761393" } -} \ No newline at end of file +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json index 1174eb4855f0..c393e2608fea 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -45,7 +45,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -103,7 +103,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -143,7 +143,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -245,7 +245,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -374,7 +374,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -504,7 +504,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -543,7 +543,7 @@ "ResponseBody": [] }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -582,7 +582,7 @@ "ResponseBody": [] }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/activate", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/activate", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json index c9b6b84d7e3b..a670ef1173cb 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -45,7 +45,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -103,7 +103,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -143,7 +143,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -245,7 +245,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -374,7 +374,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -504,7 +504,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -543,7 +543,7 @@ "ResponseBody": [] }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -582,7 +582,7 @@ "ResponseBody": [] }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/activate", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/activate", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotTest.json index 1174eb4855f0..c393e2608fea 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotTest.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotTest.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -45,7 +45,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -103,7 +103,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -143,7 +143,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -245,7 +245,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -374,7 +374,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -504,7 +504,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -543,7 +543,7 @@ "ResponseBody": [] }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -582,7 +582,7 @@ "ResponseBody": [] }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/activate", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/activate", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotTestAsync.json index c9b6b84d7e3b..a670ef1173cb 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotTestAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotTestAsync.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", @@ -45,7 +45,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/service", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -103,7 +103,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/configurations/policy", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -143,7 +143,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -245,7 +245,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -374,7 +374,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/rank", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -504,7 +504,7 @@ } }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -543,7 +543,7 @@ "ResponseBody": [] }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/reward", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -582,7 +582,7 @@ "ResponseBody": [] }, { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.1/multislot/events/123456789/activate", + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/activate", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json index 22e88a549dc5..922b78324427 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -60,7 +60,7 @@ } }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -158,7 +158,7 @@ } }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json index 22e88a549dc5..922b78324427 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -60,7 +60,7 @@ } }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -158,7 +158,7 @@ } }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankTests.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankTests.json index 22e88a549dc5..922b78324427 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankTests.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankTests.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -60,7 +60,7 @@ } }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -158,7 +158,7 @@ } }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankTestsAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankTestsAsync.json index 22e88a549dc5..922b78324427 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankTestsAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankTestsAsync.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -60,7 +60,7 @@ } }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -158,7 +158,7 @@ } }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/rank", + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", From 740f23857ce8481815533c113ae6aac56ede4bca Mon Sep 17 00:00:00 2001 From: johnhuang01 <90279783+johnhuang01@users.noreply.github.com> Date: Tue, 8 Feb 2022 22:26:54 -0800 Subject: [PATCH 17/33] Johnhuang/13216589 reward activate local inference api (#10) * Update API view file * 13216589: Add local inference reward api 13216590: Add local inference activate api * Fix the comments * Remove IsDisposed method * Revert "Update API view file" This reverts commit 0a4dcbf173abf028ec9a30ff70bb497c63ad1ede. * Remove MultiSlotClient class as it is never used --- .../src/Generated/MultiSlotClient.cs | 159 ------------------ .../src/Generated/RankClient.cs | 8 +- .../src/Models/EventResponse.cs | 75 +++++++++ .../src/Models/MultiSlotClient.cs | 7 - .../src/Models/PersonalizerClient.cs | 89 ++++++++-- .../{RankProcessor.cs => RlNetProcessor.cs} | 46 ++++- .../tests/Personalizer/EventsTests.cs | 12 ++ .../SingleSlotEventsLocalInferenceTests.json | 73 ++++++++ ...gleSlotEventsLocalInferenceTestsAsync.json | 73 ++++++++ 9 files changed, 352 insertions(+), 190 deletions(-) delete mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/EventResponse.cs delete mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotClient.cs rename sdk/personalizer/Azure.AI.Personalizer/src/Models/{RankProcessor.cs => RlNetProcessor.cs} (71%) create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs deleted file mode 100644 index 78699b565ae0..000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Rl.Net; - -namespace Azure.AI.Personalizer -{ - /// The MultiSlot service client. - internal partial class MultiSlotClient - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - private readonly bool _isLocalInference; - private readonly RankProcessor _rankProcessor; - - internal MultiSlotRestClient RestClient { get; } - - /// Initializes a new instance of MultiSlotClient for mocking. - protected MultiSlotClient() - { - } - - /// Initializes a new instance of MultiSlotClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public MultiSlotClient(string endpoint, TokenCredential credential, PersonalizerClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new PersonalizerClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - string[] scopes = { "https://cognitiveservices.azure.com/.default" }; - _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes)); - RestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, endpoint); - } - - /// Initializes a new instance of PersonalizerClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local inference. - /// A configuration to use local reference. - /// The options for configuring the client. - public MultiSlotClient(string endpoint, TokenCredential credential, bool isLocalInference = false, Configuration configuration = null, PersonalizerClientOptions options = null) : - this(endpoint, credential, options) - { - _isLocalInference = isLocalInference; - if (isLocalInference) - { - LiveModel liveModel = new LiveModel(configuration); - liveModel.Init(); - _rankProcessor = new RankProcessor(liveModel); - } - } - - /// Initializes a new instance of MultiSlotClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public MultiSlotClient(string endpoint, AzureKeyCredential credential, PersonalizerClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new PersonalizerClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - _pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key")); - RestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, endpoint); - } - - /// Initializes a new instance of PersonalizerClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local inference. - /// A configuration to use local reference. - /// The options for configuring the client. - public MultiSlotClient(string endpoint, AzureKeyCredential credential, bool isLocalInference = false, Configuration configuration = null, PersonalizerClientOptions options = null) : - this(endpoint, credential, options) - { - _isLocalInference = isLocalInference; - if (isLocalInference) - { - LiveModel liveModel = new LiveModel(configuration); - liveModel.Init(); - _rankProcessor = new RankProcessor(liveModel); - } - } - - /// Initializes a new instance of MultiSlotClient. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// Supported Cognitive Services endpoint. - internal MultiSlotClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint) - { - RestClient = new MultiSlotRestClient(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Submit a Personalizer multi-slot rank request. Receives a context, a list of actions, and a list of slots. Returns which of the provided actions should be used in each slot, in each rewardActionId. - /// A Personalizer multi-slot Rank request. - /// The cancellation token to use. - public virtual async Task> RankAsync(PersonalizerRankMultiSlotOptions body, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("MultiSlotClient.Rank"); - scope.Start(); - try - { - return await RestClient.RankAsync(body, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Submit a Personalizer multi-slot rank request. Receives a context, a list of actions, and a list of slots. Returns which of the provided actions should be used in each slot, in each rewardActionId. - /// A Personalizer multi-slot Rank request. - /// The cancellation token to use. - public virtual Response Rank(PersonalizerRankMultiSlotOptions body, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("MultiSlotClient.Rank"); - scope.Start(); - try - { - return RestClient.Rank(body, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs index aceb36681241..3cffc6b60d58 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs @@ -21,7 +21,7 @@ internal partial class RankClient private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; private readonly bool _isLocalInference; - private readonly RankProcessor _rankProcessor; + private readonly RlNetProcessor _rlNetProcessor; internal RankRestClient RestClient { get; } /// Initializes a new instance of RankClient for mocking. @@ -65,7 +65,7 @@ public RankClient(string endpoint, TokenCredential credential, bool isLocalInfer { LiveModel liveModel = new LiveModel(configuration); liveModel.Init(); - _rankProcessor = new RankProcessor(liveModel); + _rlNetProcessor = new RlNetProcessor(liveModel); } } @@ -104,7 +104,7 @@ public RankClient(string endpoint, AzureKeyCredential credential, bool isLocalIn { LiveModel liveModel = new LiveModel(configuration); liveModel.Init(); - _rankProcessor = new RankProcessor(liveModel); + _rlNetProcessor = new RlNetProcessor(liveModel); } } @@ -131,7 +131,7 @@ public virtual async Task> RankAsync(Personaliz { if (_isLocalInference) { - return _rankProcessor.Rank(rankRequest); + return _rlNetProcessor.Rank(rankRequest); } else { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/EventResponse.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/EventResponse.cs new file mode 100644 index 000000000000..41ebad8d525e --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/EventResponse.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Azure.Core; + +namespace Azure.AI.Personalizer +{ + /// Response of an event operation + public class EventResponse : Response + { + private readonly Dictionary> _headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); + + /// Initializes a new instance of EventResponse. + /// Status of the response. + /// Reason phrase of the response + public EventResponse(int status, string reasonPhrase = null) + { + Status = status; + ReasonPhrase = reasonPhrase; + } + + /// Status + public override int Status { get; } + + /// Reason phrase + public override string ReasonPhrase { get; } + + /// Content stream + public override Stream ContentStream { get; set; } + + /// Client reqauest id + public override string ClientRequestId { get; set; } + + /// Dispose + public override void Dispose() + { + GC.SuppressFinalize(this); + } + + /// Contains the header + protected override bool ContainsHeader(string name) + { + return TryGetHeaderValues(name, out _); + } + + /// Enumerate the headers + protected override IEnumerable EnumerateHeaders() => _headers.Select(h => new HttpHeader(h.Key, string.Join(",", h.Value))); + + /// Try to get the header + protected override bool TryGetHeader(string name, out string value) + { + if (_headers.TryGetValue(name, out List values)) + { + value = string.Join(",", values); + return true; + } + + value = null; + return false; + } + + /// Try to get the header values + protected override bool TryGetHeaderValues(string name, out IEnumerable values) + { + var result = _headers.TryGetValue(name, out List valuesList); + values = valuesList; + return result; + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotClient.cs deleted file mode 100644 index 5bedf02c1c37..000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotClient.cs +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.AI.Personalizer -{ - internal partial class MultiSlotClient {} -} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index c417142d0d3e..b191ad31ccdd 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -23,7 +23,7 @@ public class PersonalizerClient private string apiKey; private float subsampleRate = 1.0f; - private readonly RankProcessor _rankProcessor; + private readonly RlNetProcessor _rlNetProcessor; internal RankRestClient RankRestClient { get; set; } internal EventsRestClient EventsRestClient { get; set; } @@ -85,7 +85,7 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocal Configuration configuration = GetConfigurationForLiveModel("Token", "token"); LiveModel liveModel = new LiveModel(configuration); liveModel.Init(); - _rankProcessor = new RankProcessor(liveModel); + _rlNetProcessor = new RlNetProcessor(liveModel); } } @@ -133,12 +133,13 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLo _isLocalInference = isLocalInference; if (isLocalInference) { + //Intialize liveModel and RlNetprocessor validateAndAssignSampleRate(subsampleRate); //Intialize liveModel and Rankprocessor Configuration configuration = GetConfigurationForLiveModel("apiKey", apiKey); LiveModel liveModel = new LiveModel(configuration); liveModel.Init(); - _rankProcessor = new RankProcessor(liveModel); + _rlNetProcessor = new RlNetProcessor(liveModel); } } @@ -173,7 +174,7 @@ public virtual async Task> RankAsync(Personaliz { if (_isLocalInference) { - return _rankProcessor.Rank(options); + return _rlNetProcessor.Rank(options); } else { @@ -223,7 +224,7 @@ public virtual Response Rank(PersonalizerRankOptions opt { if (_isLocalInference) { - return _rankProcessor.Rank(options); + return _rlNetProcessor.Rank(options); } else { @@ -273,7 +274,7 @@ public virtual async Task> RankMultiSl { if (_isLocalInference) { - return _rankProcessor.Rank(options); + return _rlNetProcessor.Rank(options); } else { @@ -330,7 +331,7 @@ public virtual Response RankMultiSlot(Personali { if (_isLocalInference) { - return _rankProcessor.Rank(options); + return _rlNetProcessor.Rank(options); } else { @@ -387,7 +388,14 @@ public virtual async Task RewardAsync(string eventId, float reward, Ca try { PersonalizerRewardOptions rewardOptions = new PersonalizerRewardOptions(reward); - return await EventsRestClient.RewardAsync(eventId, rewardOptions, cancellationToken).ConfigureAwait(false); + if (_isLocalInference) + { + return _rlNetProcessor.Reward(eventId, reward); + } + else + { + return await EventsRestClient.RewardAsync(eventId, rewardOptions, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -406,8 +414,15 @@ public virtual Response Reward(string eventId, float reward, CancellationToken c scope.Start(); try { - PersonalizerRewardOptions rewardOptions = new PersonalizerRewardOptions(reward); - return EventsRestClient.Reward(eventId, rewardOptions, cancellationToken); + if (_isLocalInference) + { + return _rlNetProcessor.Reward(eventId, reward); + } + else + { + PersonalizerRewardOptions rewardOptions = new PersonalizerRewardOptions(reward); + return EventsRestClient.Reward(eventId, rewardOptions, cancellationToken); + } } catch (Exception e) { @@ -426,7 +441,14 @@ public virtual async Task RewardMultiSlotAsync(string eventId, Persona scope.Start(); try { - return await MultiSlotEventsRestClient.RewardAsync(eventId, options, cancellationToken).ConfigureAwait(false); + if (_isLocalInference) + { + return _rlNetProcessor.RewardMultiSlot(eventId, options.Reward); + } + else + { + return await MultiSlotEventsRestClient.RewardAsync(eventId, options, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -456,7 +478,14 @@ public virtual Response RewardMultiSlot(string eventId, PersonalizerRewardMultiS scope.Start(); try { - return MultiSlotEventsRestClient.Reward(eventId, options, cancellationToken); + if (_isLocalInference) + { + return _rlNetProcessor.RewardMultiSlot(eventId, options.Reward); + } + else + { + return MultiSlotEventsRestClient.Reward(eventId, options, cancellationToken); + } } catch (Exception e) { @@ -485,7 +514,14 @@ public virtual async Task ActivateAsync(string eventId, CancellationTo scope.Start(); try { - return await EventsRestClient.ActivateAsync(eventId, cancellationToken).ConfigureAwait(false); + if (_isLocalInference) + { + return _rlNetProcessor.Activate(eventId); + } + else + { + return await EventsRestClient.ActivateAsync(eventId, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -503,7 +539,14 @@ public virtual Response Activate(string eventId, CancellationToken cancellationT scope.Start(); try { - return EventsRestClient.Activate(eventId, cancellationToken); + if (_isLocalInference) + { + return _rlNetProcessor.Activate(eventId); + } + else + { + return EventsRestClient.Activate(eventId, cancellationToken); + } } catch (Exception e) { @@ -521,7 +564,14 @@ public virtual async Task ActivateMultiSlotAsync(string eventId, Cance scope.Start(); try { - return await MultiSlotEventsRestClient.ActivateAsync(eventId, cancellationToken).ConfigureAwait(false); + if (_isLocalInference) + { + return _rlNetProcessor.Activate(eventId); + } + else + { + return await MultiSlotEventsRestClient.ActivateAsync(eventId, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -539,7 +589,14 @@ public virtual Response ActivateMultiSlot(string eventId, CancellationToken canc scope.Start(); try { - return MultiSlotEventsRestClient.Activate(eventId, cancellationToken); + if (_isLocalInference) + { + return _rlNetProcessor.Activate(eventId); + } + else + { + return MultiSlotEventsRestClient.Activate(eventId, cancellationToken); + } } catch (Exception e) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankProcessor.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs similarity index 71% rename from sdk/personalizer/Azure.AI.Personalizer/src/Models/RankProcessor.cs rename to sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs index d94ec102065b..670275b44b4b 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankProcessor.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs @@ -11,14 +11,14 @@ namespace Azure.AI.Personalizer { - /// The Rank Processor. - internal class RankProcessor + /// The Rl.Net Processor. + internal class RlNetProcessor { private readonly LiveModel _liveModel; internal PolicyRestClient RestClient { get; } - /// Initializes a new instance of RankProcessor. - public RankProcessor(LiveModel liveModel) + /// Initializes a new instance of RlNetProcessor. + public RlNetProcessor(LiveModel liveModel) { this._liveModel = liveModel; } @@ -100,5 +100,43 @@ public Response Rank(PersonalizerRankMultiSlotO return Response.FromValue(value, default); } + + /// Submit a Personalizer reward request. + /// The event id this reward applies to. + /// The reward should be a floating point number, typically between 0 and 1. + public Response Reward(string eventId, float reward) + { + // Call QueueOutcomeEvent of local RL.Net + _liveModel.QueueOutcomeEvent(eventId, reward); + + // Use 204 as there is no return value + return new EventResponse(204); + } + + /// Submit a Personalizer reward multi-slot request. + /// The event id this reward applies to. + /// List of slot id and reward values. + public Response RewardMultiSlot(string eventId, IList slotRewards) + { + foreach (PersonalizerSlotReward slotReward in slotRewards) + { + // Call QueueOutcomeEvent of local RL.Net + _liveModel.QueueOutcomeEvent(eventId, slotReward.SlotId, slotReward.Value); + } + + // Use 204 as there is no return value + return new EventResponse(204); + } + + /// Activate Event. + /// The event ID to be activated. + public Response Activate(string eventId) + { + // Call ReportActionTaken of local RL.Net + _liveModel.QueueActionTakenEvent(eventId); + + // Use 204 as there is no return value + return new EventResponse(204); + } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/EventsTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/EventsTests.cs index bb096b6ec114..acd8e30eb64d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/EventsTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/EventsTests.cs @@ -16,6 +16,18 @@ public EventsTests(bool isAsync) : base(isAsync) public async Task SingleSlotEventsTests() { PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true); + await SingleSlotEventsTests(client); + } + + [Test] + public async Task SingleSlotEventsLocalInferenceTests() + { + PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true); + await SingleSlotEventsTests(client); + } + + private async Task SingleSlotEventsTests(PersonalizerClient client) + { await Reward(client); await Activate(client); } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json new file mode 100644 index 000000000000..b95b5e2a10d7 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json @@ -0,0 +1,73 @@ +{ + "Entries": [ + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/reward", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "13", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-a8125774fa5bf645a4f7f0260dfebc69-7be7bbef03bb984a-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "bcb1cd876e871b813f8dd9c2cd071bbb", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "value": 0.5 + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "12343c91-62ea-43e5-8785-5f7de07f498a", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "0", + "Date": "Thu, 05 Aug 2021 21:27:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "122" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/activate", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-59b4a539d938e2488c5450a33c026dfb-660f72fcf097d346-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "d957b65ffb63f941575b40b059f5292e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "41f83543-d485-4713-b6cc-2dda1cafc84d", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "0", + "Date": "Thu, 05 Aug 2021 21:27:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "243" + }, + "ResponseBody": [] + } + ], + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "856681796" + } +} \ No newline at end of file diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json new file mode 100644 index 000000000000..b95b5e2a10d7 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json @@ -0,0 +1,73 @@ +{ + "Entries": [ + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/reward", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "13", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-a8125774fa5bf645a4f7f0260dfebc69-7be7bbef03bb984a-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "bcb1cd876e871b813f8dd9c2cd071bbb", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "value": 0.5 + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "12343c91-62ea-43e5-8785-5f7de07f498a", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "0", + "Date": "Thu, 05 Aug 2021 21:27:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "122" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/activate", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-59b4a539d938e2488c5450a33c026dfb-660f72fcf097d346-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "d957b65ffb63f941575b40b059f5292e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "41f83543-d485-4713-b6cc-2dda1cafc84d", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "0", + "Date": "Thu, 05 Aug 2021 21:27:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "243" + }, + "ResponseBody": [] + } + ], + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "856681796" + } +} \ No newline at end of file From 35a3120706f5c710ab3830e9f4295eac3bd90681 Mon Sep 17 00:00:00 2001 From: John Huang Date: Tue, 8 Feb 2022 22:40:27 -0800 Subject: [PATCH 18/33] Add more change after other PRs were merged --- .../Azure.AI.Personalizer.netstandard2.0.cs | 89 +++++++++++++++++-- 1 file changed, 81 insertions(+), 8 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs index c90b96fa93d0..42b44ee8dc4f 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs @@ -1,5 +1,73 @@ namespace Azure.AI.Personalizer { + public partial class DecisionContext + { + public DecisionContext() { } + public DecisionContext(Azure.AI.Personalizer.PersonalizerRankMultiSlotOptions rankRequest, System.Collections.Generic.Dictionary> slotIdToFeatures) { } + public DecisionContext(System.Collections.Generic.IEnumerable contextFeatures, System.Collections.Generic.List rankableActions) { } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("FromUrl")] + public System.Collections.Generic.List ContextFeatures { get { throw null; } } + [System.Text.Json.Serialization.JsonPropertyNameAttribute("_multi")] + public Azure.AI.Personalizer.DecisionContextDocument[] Documents { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("_slots")] + public Azure.AI.Personalizer.DecisionContextDocument[] Slots { get { throw null; } set { } } + } + public partial class DecisionContextDocument + { + public DecisionContextDocument(string id, System.Collections.Generic.List json, string slotId, System.Collections.Generic.List slotJson) { } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("f")] + public System.Collections.Generic.Dictionary FloatFeatures { get { throw null; } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("_tag")] + public string ID { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("j")] + public System.Collections.Generic.List JSON { get { throw null; } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("i")] + public Azure.AI.Personalizer.DecisionContextDocumentId Marginal { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("_id")] + public string SlotId { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("sj")] + public System.Collections.Generic.List SlotJson { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("s")] + public Azure.AI.Personalizer.DecisionContextDocumentSource Source { get { throw null; } set { } } + } + public partial class DecisionContextDocumentId + { + public DecisionContextDocumentId() { } + [System.Text.Json.Serialization.JsonPropertyNameAttribute("constant")] + public int Constant { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonPropertyNameAttribute("id")] + public string ID { get { throw null; } set { } } + } + public partial class DecisionContextDocumentSource + { + public DecisionContextDocumentSource() { } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + public string Parameter { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + public string Set { get { throw null; } set { } } + } + public partial class EventResponse : Azure.Response + { + public EventResponse(int status, string reasonPhrase = null) { } + public override string ClientRequestId { get { throw null; } set { } } + public override System.IO.Stream ContentStream { get { throw null; } set { } } + public override string ReasonPhrase { get { throw null; } } + public override int Status { get { throw null; } } + protected override bool ContainsHeader(string name) { throw null; } + public override void Dispose() { } + protected override System.Collections.Generic.IEnumerable EnumerateHeaders() { throw null; } + protected override bool TryGetHeader(string name, out string value) { throw null; } + protected override bool TryGetHeaderValues(string name, out System.Collections.Generic.IEnumerable values) { throw null; } + } public partial class PersonalizerAdministrationClient { protected PersonalizerAdministrationClient() { } @@ -19,14 +87,16 @@ public PersonalizerAdministrationClient(System.Uri endpoint, Azure.Core.TokenCre public virtual Azure.AsyncPageable GetPersonalizerEvaluationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerLogProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerLogPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetPersonalizerModel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetPersonalizerModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPersonalizerModel(bool isSigned = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPersonalizerModelAsync(bool isSigned = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerModelProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerModelPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerPolicyAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ImportPersonalizerModel(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ImportPersonalizerModelAsync(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ResetPersonalizerModel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ResetPersonalizerModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ResetPersonalizerPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -41,8 +111,10 @@ public partial class PersonalizerClient protected PersonalizerClient() { } public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential) { } public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } + public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential, bool isLocalInference, float subsampleRate = 1f, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } + public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, bool isLocalInference, float subsampleRate = 1f, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } public virtual Azure.Response Activate(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ActivateAsync(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ActivateMultiSlot(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -257,12 +329,13 @@ public partial class PersonalizerRankableAction public PersonalizerRankableAction(string id, System.Collections.Generic.IEnumerable features) { } public System.Collections.Generic.IList Features { get { throw null; } } public string Id { get { throw null; } } + public int Index { get { throw null; } set { } } } public partial class PersonalizerRankedAction { internal PersonalizerRankedAction() { } - public string Id { get { throw null; } } - public float? Probability { get { throw null; } } + public string Id { get { throw null; } set { } } + public float? Probability { get { throw null; } set { } } } public partial class PersonalizerRankMultiSlotOptions { @@ -289,9 +362,9 @@ public PersonalizerRankOptions(System.Collections.Generic.IEnumerable Ranking { get { throw null; } } - public string RewardActionId { get { throw null; } } + public string EventId { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList Ranking { get { throw null; } set { } } + public string RewardActionId { get { throw null; } set { } } } public partial class PersonalizerRewardMultiSlotOptions { @@ -327,7 +400,7 @@ public PersonalizerSlotOptions(string id, string baselineAction) { } public PersonalizerSlotOptions(string id, string baselineAction, System.Collections.Generic.IList features = null, System.Collections.Generic.IList excludedActions = null) { } public string BaselineAction { get { throw null; } } public System.Collections.Generic.IList ExcludedActions { get { throw null; } } - public System.Collections.Generic.IList Features { get { throw null; } } + public System.Collections.Generic.IList Features { get { throw null; } set { } } public string Id { get { throw null; } } } public partial class PersonalizerSlotResult From 92e8266622f6ec4dc1ed3c0ef769242c28361cd3 Mon Sep 17 00:00:00 2001 From: John Huang Date: Tue, 8 Feb 2022 22:43:30 -0800 Subject: [PATCH 19/33] Revert "Add more change after other PRs were merged" This reverts commit 35a3120706f5c710ab3830e9f4295eac3bd90681. --- .../Azure.AI.Personalizer.netstandard2.0.cs | 89 ++----------------- 1 file changed, 8 insertions(+), 81 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs index 42b44ee8dc4f..c90b96fa93d0 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs @@ -1,73 +1,5 @@ namespace Azure.AI.Personalizer { - public partial class DecisionContext - { - public DecisionContext() { } - public DecisionContext(Azure.AI.Personalizer.PersonalizerRankMultiSlotOptions rankRequest, System.Collections.Generic.Dictionary> slotIdToFeatures) { } - public DecisionContext(System.Collections.Generic.IEnumerable contextFeatures, System.Collections.Generic.List rankableActions) { } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("FromUrl")] - public System.Collections.Generic.List ContextFeatures { get { throw null; } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("_multi")] - public Azure.AI.Personalizer.DecisionContextDocument[] Documents { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("_slots")] - public Azure.AI.Personalizer.DecisionContextDocument[] Slots { get { throw null; } set { } } - } - public partial class DecisionContextDocument - { - public DecisionContextDocument(string id, System.Collections.Generic.List json, string slotId, System.Collections.Generic.List slotJson) { } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("f")] - public System.Collections.Generic.Dictionary FloatFeatures { get { throw null; } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("_tag")] - public string ID { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("j")] - public System.Collections.Generic.List JSON { get { throw null; } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("i")] - public Azure.AI.Personalizer.DecisionContextDocumentId Marginal { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("_id")] - public string SlotId { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("sj")] - public System.Collections.Generic.List SlotJson { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("s")] - public Azure.AI.Personalizer.DecisionContextDocumentSource Source { get { throw null; } set { } } - } - public partial class DecisionContextDocumentId - { - public DecisionContextDocumentId() { } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("constant")] - public int Constant { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("id")] - public string ID { get { throw null; } set { } } - } - public partial class DecisionContextDocumentSource - { - public DecisionContextDocumentSource() { } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - public string Parameter { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - public string Set { get { throw null; } set { } } - } - public partial class EventResponse : Azure.Response - { - public EventResponse(int status, string reasonPhrase = null) { } - public override string ClientRequestId { get { throw null; } set { } } - public override System.IO.Stream ContentStream { get { throw null; } set { } } - public override string ReasonPhrase { get { throw null; } } - public override int Status { get { throw null; } } - protected override bool ContainsHeader(string name) { throw null; } - public override void Dispose() { } - protected override System.Collections.Generic.IEnumerable EnumerateHeaders() { throw null; } - protected override bool TryGetHeader(string name, out string value) { throw null; } - protected override bool TryGetHeaderValues(string name, out System.Collections.Generic.IEnumerable values) { throw null; } - } public partial class PersonalizerAdministrationClient { protected PersonalizerAdministrationClient() { } @@ -87,16 +19,14 @@ public PersonalizerAdministrationClient(System.Uri endpoint, Azure.Core.TokenCre public virtual Azure.AsyncPageable GetPersonalizerEvaluationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerLogProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerLogPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetPersonalizerModel(bool isSigned = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetPersonalizerModelAsync(bool isSigned = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPersonalizerModel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPersonalizerModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerModelProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerModelPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerPolicyAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ImportPersonalizerModel(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ImportPersonalizerModelAsync(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ResetPersonalizerModel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ResetPersonalizerModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ResetPersonalizerPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -111,10 +41,8 @@ public partial class PersonalizerClient protected PersonalizerClient() { } public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential) { } public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } - public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential, bool isLocalInference, float subsampleRate = 1f, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } - public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, bool isLocalInference, float subsampleRate = 1f, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } public virtual Azure.Response Activate(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ActivateAsync(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ActivateMultiSlot(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -329,13 +257,12 @@ public partial class PersonalizerRankableAction public PersonalizerRankableAction(string id, System.Collections.Generic.IEnumerable features) { } public System.Collections.Generic.IList Features { get { throw null; } } public string Id { get { throw null; } } - public int Index { get { throw null; } set { } } } public partial class PersonalizerRankedAction { internal PersonalizerRankedAction() { } - public string Id { get { throw null; } set { } } - public float? Probability { get { throw null; } set { } } + public string Id { get { throw null; } } + public float? Probability { get { throw null; } } } public partial class PersonalizerRankMultiSlotOptions { @@ -362,9 +289,9 @@ public PersonalizerRankOptions(System.Collections.Generic.IEnumerable Ranking { get { throw null; } set { } } - public string RewardActionId { get { throw null; } set { } } + public string EventId { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Ranking { get { throw null; } } + public string RewardActionId { get { throw null; } } } public partial class PersonalizerRewardMultiSlotOptions { @@ -400,7 +327,7 @@ public PersonalizerSlotOptions(string id, string baselineAction) { } public PersonalizerSlotOptions(string id, string baselineAction, System.Collections.Generic.IList features = null, System.Collections.Generic.IList excludedActions = null) { } public string BaselineAction { get { throw null; } } public System.Collections.Generic.IList ExcludedActions { get { throw null; } } - public System.Collections.Generic.IList Features { get { throw null; } set { } } + public System.Collections.Generic.IList Features { get { throw null; } } public string Id { get { throw null; } } } public partial class PersonalizerSlotResult From 1f7219154fb241728e976c248939775626aeb86b Mon Sep 17 00:00:00 2001 From: johnhuang01 <90279783+johnhuang01@users.noreply.github.com> Date: Tue, 8 Feb 2022 23:00:15 -0800 Subject: [PATCH 20/33] 13225147: Update API view file for thick client (#11) * 13225147: Update API view file for thick client * Remove some suppressing warning * Add more changes after 2 PRs were merged --- .../src/Azure.Core.TestFramework.csproj | 1 - .../src/TestRecording.cs | 2 - .../Azure.AI.Personalizer.netstandard2.0.cs | 89 +++++++++++++++++-- 3 files changed, 81 insertions(+), 11 deletions(-) diff --git a/sdk/core/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj b/sdk/core/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj index a25ee8a75765..24a3cd4bb1bf 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj +++ b/sdk/core/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj @@ -1,7 +1,6 @@  $(RequiredTargetFrameworks);net47 - $(NoWarn);CS8032 true diff --git a/sdk/core/Azure.Core.TestFramework/src/TestRecording.cs b/sdk/core/Azure.Core.TestFramework/src/TestRecording.cs index d406fa419ac6..0776c070f0d7 100644 --- a/sdk/core/Azure.Core.TestFramework/src/TestRecording.cs +++ b/sdk/core/Azure.Core.TestFramework/src/TestRecording.cs @@ -210,12 +210,10 @@ public TestRandom Random #if NET6_0_OR_GREATER var liveSeed = RandomNumberGenerator.GetInt32(int.MaxValue); #else -#pragma warning disable SYSLIB0023 var csp = new RNGCryptoServiceProvider(); var bytes = new byte[4]; csp.GetBytes(bytes); var liveSeed = BitConverter.ToInt32(bytes, 0); -#pragma warning restore SYSLIB0023 #endif _random = new TestRandom(Mode, liveSeed); break; diff --git a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs index c90b96fa93d0..42b44ee8dc4f 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs @@ -1,5 +1,73 @@ namespace Azure.AI.Personalizer { + public partial class DecisionContext + { + public DecisionContext() { } + public DecisionContext(Azure.AI.Personalizer.PersonalizerRankMultiSlotOptions rankRequest, System.Collections.Generic.Dictionary> slotIdToFeatures) { } + public DecisionContext(System.Collections.Generic.IEnumerable contextFeatures, System.Collections.Generic.List rankableActions) { } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("FromUrl")] + public System.Collections.Generic.List ContextFeatures { get { throw null; } } + [System.Text.Json.Serialization.JsonPropertyNameAttribute("_multi")] + public Azure.AI.Personalizer.DecisionContextDocument[] Documents { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("_slots")] + public Azure.AI.Personalizer.DecisionContextDocument[] Slots { get { throw null; } set { } } + } + public partial class DecisionContextDocument + { + public DecisionContextDocument(string id, System.Collections.Generic.List json, string slotId, System.Collections.Generic.List slotJson) { } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("f")] + public System.Collections.Generic.Dictionary FloatFeatures { get { throw null; } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("_tag")] + public string ID { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("j")] + public System.Collections.Generic.List JSON { get { throw null; } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("i")] + public Azure.AI.Personalizer.DecisionContextDocumentId Marginal { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("_id")] + public string SlotId { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("sj")] + public System.Collections.Generic.List SlotJson { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + [System.Text.Json.Serialization.JsonPropertyNameAttribute("s")] + public Azure.AI.Personalizer.DecisionContextDocumentSource Source { get { throw null; } set { } } + } + public partial class DecisionContextDocumentId + { + public DecisionContextDocumentId() { } + [System.Text.Json.Serialization.JsonPropertyNameAttribute("constant")] + public int Constant { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonPropertyNameAttribute("id")] + public string ID { get { throw null; } set { } } + } + public partial class DecisionContextDocumentSource + { + public DecisionContextDocumentSource() { } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + public string Parameter { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] + public string Set { get { throw null; } set { } } + } + public partial class EventResponse : Azure.Response + { + public EventResponse(int status, string reasonPhrase = null) { } + public override string ClientRequestId { get { throw null; } set { } } + public override System.IO.Stream ContentStream { get { throw null; } set { } } + public override string ReasonPhrase { get { throw null; } } + public override int Status { get { throw null; } } + protected override bool ContainsHeader(string name) { throw null; } + public override void Dispose() { } + protected override System.Collections.Generic.IEnumerable EnumerateHeaders() { throw null; } + protected override bool TryGetHeader(string name, out string value) { throw null; } + protected override bool TryGetHeaderValues(string name, out System.Collections.Generic.IEnumerable values) { throw null; } + } public partial class PersonalizerAdministrationClient { protected PersonalizerAdministrationClient() { } @@ -19,14 +87,16 @@ public PersonalizerAdministrationClient(System.Uri endpoint, Azure.Core.TokenCre public virtual Azure.AsyncPageable GetPersonalizerEvaluationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerLogProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerLogPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetPersonalizerModel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetPersonalizerModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPersonalizerModel(bool isSigned = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPersonalizerModelAsync(bool isSigned = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerModelProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerModelPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerPolicyAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ImportPersonalizerModel(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ImportPersonalizerModelAsync(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ResetPersonalizerModel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ResetPersonalizerModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ResetPersonalizerPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -41,8 +111,10 @@ public partial class PersonalizerClient protected PersonalizerClient() { } public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential) { } public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } + public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential, bool isLocalInference, float subsampleRate = 1f, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } + public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, bool isLocalInference, float subsampleRate = 1f, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } public virtual Azure.Response Activate(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ActivateAsync(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ActivateMultiSlot(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -257,12 +329,13 @@ public partial class PersonalizerRankableAction public PersonalizerRankableAction(string id, System.Collections.Generic.IEnumerable features) { } public System.Collections.Generic.IList Features { get { throw null; } } public string Id { get { throw null; } } + public int Index { get { throw null; } set { } } } public partial class PersonalizerRankedAction { internal PersonalizerRankedAction() { } - public string Id { get { throw null; } } - public float? Probability { get { throw null; } } + public string Id { get { throw null; } set { } } + public float? Probability { get { throw null; } set { } } } public partial class PersonalizerRankMultiSlotOptions { @@ -289,9 +362,9 @@ public PersonalizerRankOptions(System.Collections.Generic.IEnumerable Ranking { get { throw null; } } - public string RewardActionId { get { throw null; } } + public string EventId { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList Ranking { get { throw null; } set { } } + public string RewardActionId { get { throw null; } set { } } } public partial class PersonalizerRewardMultiSlotOptions { @@ -327,7 +400,7 @@ public PersonalizerSlotOptions(string id, string baselineAction) { } public PersonalizerSlotOptions(string id, string baselineAction, System.Collections.Generic.IList features = null, System.Collections.Generic.IList excludedActions = null) { } public string BaselineAction { get { throw null; } } public System.Collections.Generic.IList ExcludedActions { get { throw null; } } - public System.Collections.Generic.IList Features { get { throw null; } } + public System.Collections.Generic.IList Features { get { throw null; } set { } } public string Id { get { throw null; } } } public partial class PersonalizerSlotResult From fc8a16616aaca9a8dd9c54b13607b7ea9dbfb36f Mon Sep 17 00:00:00 2001 From: Tejaswi Paruchuri <86433817+Tparuchuri@users.noreply.github.com> Date: Wed, 9 Feb 2022 23:55:19 -0800 Subject: [PATCH 21/33] lazy load rank processor, refresh config and relaod token on expiry (#12) * lazy load rank processor, refresh config and relaod token on expiry * Comments & Cleanup * Cleanup * Addressed comments * Cleanup * Fix conflict Co-authored-by: John Huang --- .../src/Models/PersonalizerClient.cs | 239 ++++++++------ .../SingleSlotEventsLocalInferenceTests.json | 158 +++++---- ...gleSlotEventsLocalInferenceTestsAsync.json | 158 +++++---- .../ModelTests/ModelTestAsync.json | 8 +- .../SingleSlotRankLocalInferenceTests.json | 306 +++++------------- ...ingleSlotRankLocalInferenceTestsAsync.json | 306 +++++------------- 6 files changed, 486 insertions(+), 689 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index b191ad31ccdd..ded880bbd78f 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -16,23 +16,27 @@ namespace Azure.AI.Personalizer /// public class PersonalizerClient { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - private readonly bool _isLocalInference; + private readonly ClientDiagnostics clientDiagnostics; + private readonly HttpPipeline pipeline; + private readonly bool isLocalInference; private string stringEndpoint; - private string apiKey; + private AzureKeyCredential azureKeyCredential; + private TokenCredential tokenCredential; + private int liveModelRefreshTimeInMinutes = 15; + private DateTimeOffset tokenExpiry; + private DateTimeOffset liveModelLastRefresh; + private string[] scopes = { "https://cognitiveservices.azure.com/.default" }; private float subsampleRate = 1.0f; - private readonly RlNetProcessor _rlNetProcessor; - + private Lazy rlNetProcessor; internal RankRestClient RankRestClient { get; set; } internal EventsRestClient EventsRestClient { get; set; } internal MultiSlotRestClient MultiSlotRestClient { get; set; } internal MultiSlotEventsRestClient MultiSlotEventsRestClient { get; set; } internal ServiceConfigurationRestClient ServiceConfigurationRestClient { get; set; } internal PolicyRestClient PolicyRestClient { get; set; } - internal PersonalizerServiceProperties _personalizerServiceProperties { get; set; } - internal PersonalizerPolicy _personalizerPolicy { get; set; } + internal PersonalizerServiceProperties personalizerServiceProperties { get; set; } + internal PersonalizerPolicy personalizerPolicy { get; set; } /// Initializes a new instance of Personalizer Client for mocking. protected PersonalizerClient() @@ -55,16 +59,16 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer } options ??= new PersonalizerClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - string[] scopes = { "https://cognitiveservices.azure.com/.default" }; - _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes)); + clientDiagnostics = new ClientDiagnostics(options); + pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes)); stringEndpoint = endpoint.AbsoluteUri; - RankRestClient = new RankRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - EventsRestClient = new EventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - MultiSlotRestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - MultiSlotEventsRestClient = new MultiSlotEventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - ServiceConfigurationRestClient = new ServiceConfigurationRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - PolicyRestClient = new PolicyRestClient(_clientDiagnostics, _pipeline, stringEndpoint); + RankRestClient = new RankRestClient(clientDiagnostics, pipeline, stringEndpoint); + EventsRestClient = new EventsRestClient(clientDiagnostics, pipeline, stringEndpoint); + MultiSlotRestClient = new MultiSlotRestClient(clientDiagnostics, pipeline, stringEndpoint); + MultiSlotEventsRestClient = new MultiSlotEventsRestClient(clientDiagnostics, pipeline, stringEndpoint); + ServiceConfigurationRestClient = new ServiceConfigurationRestClient(clientDiagnostics, pipeline, stringEndpoint); + PolicyRestClient = new PolicyRestClient(clientDiagnostics, pipeline, stringEndpoint); + tokenCredential = credential; } /// Initializes a new instance of PersonalizerClient. @@ -76,16 +80,12 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { - _isLocalInference = isLocalInference; + this.isLocalInference = isLocalInference; if (isLocalInference) { validateAndAssignSampleRate(subsampleRate); - //Intialize liveModel and call Rank processor - //ToDo:TASK 13057958: Working on changes to support token authentication in RLClient - Configuration configuration = GetConfigurationForLiveModel("Token", "token"); - LiveModel liveModel = new LiveModel(configuration); - liveModel.Init(); - _rlNetProcessor = new RlNetProcessor(liveModel); + //lazy load Rankprocessor + rlNetProcessor = new Lazy(() => GetConfigurationForRankProcessor()); } } @@ -108,17 +108,17 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali { throw new ArgumentNullException(nameof(credential)); } - apiKey = credential.Key; options ??= new PersonalizerClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - _pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key")); + clientDiagnostics = new ClientDiagnostics(options); + pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key")); stringEndpoint = endpoint.AbsoluteUri; - RankRestClient = new RankRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - EventsRestClient = new EventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - MultiSlotRestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - MultiSlotEventsRestClient = new MultiSlotEventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - ServiceConfigurationRestClient = new ServiceConfigurationRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - PolicyRestClient = new PolicyRestClient(_clientDiagnostics, _pipeline, stringEndpoint); + RankRestClient = new RankRestClient(clientDiagnostics, pipeline, stringEndpoint); + EventsRestClient = new EventsRestClient(clientDiagnostics, pipeline, stringEndpoint); + MultiSlotRestClient = new MultiSlotRestClient(clientDiagnostics, pipeline, stringEndpoint); + MultiSlotEventsRestClient = new MultiSlotEventsRestClient(clientDiagnostics, pipeline, stringEndpoint); + ServiceConfigurationRestClient = new ServiceConfigurationRestClient(clientDiagnostics, pipeline, stringEndpoint); + PolicyRestClient = new PolicyRestClient(clientDiagnostics, pipeline, stringEndpoint); + azureKeyCredential = credential; } /// Initializes a new instance of PersonalizerClient. @@ -130,16 +130,12 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : this(endpoint, credential, options) { - _isLocalInference = isLocalInference; + this.isLocalInference = isLocalInference; if (isLocalInference) { - //Intialize liveModel and RlNetprocessor validateAndAssignSampleRate(subsampleRate); - //Intialize liveModel and Rankprocessor - Configuration configuration = GetConfigurationForLiveModel("apiKey", apiKey); - LiveModel liveModel = new LiveModel(configuration); - liveModel.Init(); - _rlNetProcessor = new RlNetProcessor(liveModel); + //lazy load Rankprocessor + rlNetProcessor = new Lazy(() => GetConfigurationForRankProcessor()); } } @@ -155,12 +151,12 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential) : this(en internal PersonalizerClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { string stringEndpoint = endpoint.AbsoluteUri; - RankRestClient = new RankRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - EventsRestClient = new EventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - MultiSlotRestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - MultiSlotEventsRestClient = new MultiSlotEventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; + RankRestClient = new RankRestClient(clientDiagnostics, pipeline, stringEndpoint); + EventsRestClient = new EventsRestClient(clientDiagnostics, pipeline, stringEndpoint); + MultiSlotRestClient = new MultiSlotRestClient(clientDiagnostics, pipeline, stringEndpoint); + MultiSlotEventsRestClient = new MultiSlotEventsRestClient(clientDiagnostics, pipeline, stringEndpoint); + this.clientDiagnostics = clientDiagnostics; + this.pipeline = pipeline; } /// Submit a Personalizer rank request. Receives a context and a list of actions. Returns which of the provided actions should be used by your application, in rewardActionId. @@ -168,13 +164,14 @@ internal PersonalizerClient(ClientDiagnostics clientDiagnostics, HttpPipeline pi /// The cancellation token to use. public virtual async Task> RankAsync(PersonalizerRankOptions options, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Rank"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Rank"); scope.Start(); try { - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.Rank(options); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Rank(options); } else { @@ -218,13 +215,14 @@ public virtual async Task> RankAsync(IEnumerabl /// The cancellation token to use. public virtual Response Rank(PersonalizerRankOptions options, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Rank"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Rank"); scope.Start(); try { - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.Rank(options); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Rank(options); } else { @@ -268,13 +266,14 @@ public virtual Response Rank(IEnumerable The cancellation token to use. public virtual async Task> RankMultiSlotAsync(PersonalizerRankMultiSlotOptions options, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.RankMultiSlot"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.RankMultiSlot"); scope.Start(); try { - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.Rank(options); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Rank(options); } else { @@ -325,13 +324,14 @@ public virtual async Task> RankMultiSl /// The cancellation token to use. public virtual Response RankMultiSlot(PersonalizerRankMultiSlotOptions options, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.RankMultiSlot"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.RankMultiSlot"); scope.Start(); try { - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.Rank(options); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Rank(options); } else { @@ -383,14 +383,15 @@ public virtual Response RankMultiSlot(IEnumerab /// The cancellation token to use. public virtual async Task RewardAsync(string eventId, float reward, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Reward"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Reward"); scope.Start(); try { PersonalizerRewardOptions rewardOptions = new PersonalizerRewardOptions(reward); - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.Reward(eventId, reward); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Reward(eventId, reward); } else { @@ -410,13 +411,14 @@ public virtual async Task RewardAsync(string eventId, float reward, Ca /// The cancellation token to use. public virtual Response Reward(string eventId, float reward, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Reward"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Reward"); scope.Start(); try { - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.Reward(eventId, reward); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Reward(eventId, reward); } else { @@ -437,13 +439,14 @@ public virtual Response Reward(string eventId, float reward, CancellationToken c /// The cancellation token to use. public virtual async Task RewardMultiSlotAsync(string eventId, PersonalizerRewardMultiSlotOptions options, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.RewardMultiSlot"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.RewardMultiSlot"); scope.Start(); try { - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.RewardMultiSlot(eventId, options.Reward); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.RewardMultiSlot(eventId, options.Reward); } else { @@ -474,13 +477,14 @@ public virtual async Task RewardMultiSlotAsync(string eventId, string /// The cancellation token to use. public virtual Response RewardMultiSlot(string eventId, PersonalizerRewardMultiSlotOptions options, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.RewardMultiSlot"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.RewardMultiSlot"); scope.Start(); try { - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.RewardMultiSlot(eventId, options.Reward); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.RewardMultiSlot(eventId, options.Reward); } else { @@ -510,13 +514,14 @@ public virtual Response RewardMultiSlot(string eventId, string slotId, float rew /// The cancellation token to use. public virtual async Task ActivateAsync(string eventId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Activate"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Activate"); scope.Start(); try { - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.Activate(eventId); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Activate(eventId); } else { @@ -535,13 +540,14 @@ public virtual async Task ActivateAsync(string eventId, CancellationTo /// The cancellation token to use. public virtual Response Activate(string eventId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Activate"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Activate"); scope.Start(); try { - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.Activate(eventId); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Activate(eventId); } else { @@ -560,13 +566,14 @@ public virtual Response Activate(string eventId, CancellationToken cancellationT /// The cancellation token to use. public virtual async Task ActivateMultiSlotAsync(string eventId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.ActivateMultiSlot"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.ActivateMultiSlot"); scope.Start(); try { - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.Activate(eventId); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Activate(eventId); } else { @@ -585,13 +592,14 @@ public virtual async Task ActivateMultiSlotAsync(string eventId, Cance /// The cancellation token to use. public virtual Response ActivateMultiSlot(string eventId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.ActivateMultiSlot"); + using var scope = clientDiagnostics.CreateScope("PersonalizerClient.ActivateMultiSlot"); scope.Start(); try { - if (_isLocalInference) + if (isLocalInference) { - return _rlNetProcessor.Activate(eventId); + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Activate(eventId); } else { @@ -605,34 +613,61 @@ public virtual Response ActivateMultiSlot(string eventId, CancellationToken canc } } - /// Gets the configuration details for the live model to use - internal Configuration GetConfigurationForLiveModel(string authType, string authValue) + /// Gets the rank processor initiated with live model to use + private RlNetProcessor GetConfigurationForRankProcessor(CancellationToken cancellationToken = default) { - _personalizerServiceProperties = ServiceConfigurationRestClient.Get(); - _personalizerPolicy = PolicyRestClient.Get(); Configuration config = new Configuration(); // set up the model - if (authType == "apiKey") + if (azureKeyCredential != null) { - config["http.api.key"] = authValue; + config["http.api.key"] = azureKeyCredential.Key; } - else + else if (tokenCredential != null) { - //ToDo: TASK 13057958 Working on changes to support token authentication in RLClient - //config["http.token.key"] = authValue; + var tokenRequestContext = new TokenRequestContext(scopes); + AccessToken token = tokenCredential.GetToken(tokenRequestContext, cancellationToken); + config["http.api.key"] = "Bearer " + token.Token; + config["http.api.header.key.name"] = "Authorization"; + tokenExpiry = token.ExpiresOn; } - config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.3/logs/interactions"; - config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.3/logs/observations"; - config["interaction.subsample.rate"] = Convert.ToString(subsampleRate, CultureInfo.InvariantCulture); - config["observation.subsample.rate"] = Convert.ToString(subsampleRate, CultureInfo.InvariantCulture); - //ToDo: TASK 13057958 Working on changes to support model api in RL.Net - config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.3/model"; - config["vw.commandline"] = _personalizerPolicy.Arguments; + else + { + throw new ApplicationException("PersonalizerClient is neither initalized with Token Credential nor with AzureKey Credential"); + } + personalizerServiceProperties = ServiceConfigurationRestClient.Get(cancellationToken); + personalizerPolicy = PolicyRestClient.Get(cancellationToken); + //interactions & observations + config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/interactions"; + config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/observations"; + config["interaction.sender.implementation"] = "INTERACTION_HTTP_API_SENDER"; + config["observation.sender.implementation"] = "OBSERVATION_HTTP_API_SENDER"; + config["interaction.subsample.rate"] = Convert.ToString(this.subsampleRate, CultureInfo.InvariantCulture); + config["observation.subsample.rate"] = Convert.ToString(this.subsampleRate, CultureInfo.InvariantCulture); + //model + config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.1/model"; + config["model.source"] = "AZURE_STORAGE_BLOB"; + + config["model.vw.initial_command_line"] = personalizerPolicy.Arguments; config["protocol.version"] = "2"; - config["initial_exploration.epsilon"] = Convert.ToString(_personalizerServiceProperties.ExplorationPercentage, CultureInfo.InvariantCulture); - config["rank.learning.mode"] = Convert.ToString(_personalizerServiceProperties.LearningMode, CultureInfo.InvariantCulture); - //return the config model - return config; + config["initial_exploration.epsilon"] = Convert.ToString(personalizerServiceProperties.ExplorationPercentage, CultureInfo.InvariantCulture); + config["rank.learning.mode"] = Convert.ToString(personalizerServiceProperties.LearningMode, CultureInfo.InvariantCulture); + LiveModel liveModel = new LiveModel(config); + liveModel.Init(); + liveModelLastRefresh = DateTimeOffset.UtcNow; + return new RlNetProcessor(liveModel); + } + + /// Update the config details periodically based on liveModelRefreshTimeInMinutes or when bearer token is expired + private void validateAndUpdateLiveModelConfig() + { + if ((tokenCredential != null && + DateTimeOffset.Compare(tokenExpiry, DateTimeOffset.MinValue) != 0 && + DateTimeOffset.Compare(tokenExpiry, DateTimeOffset.UtcNow) <= 0) || + (DateTimeOffset.Compare(liveModelLastRefresh, DateTimeOffset.MinValue) != 0 && + DateTimeOffset.Compare(liveModelLastRefresh.AddMinutes(liveModelRefreshTimeInMinutes), DateTimeOffset.UtcNow) < 0)) + { + rlNetProcessor = new Lazy(() => GetConfigurationForRankProcessor()); + } } /// validate SubsampleRate input from user and throw exception if not in range diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json index b95b5e2a10d7..1b0aa39ef532 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json @@ -1,73 +1,89 @@ { - "Entries": [ - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/reward", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "13", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-a8125774fa5bf645a4f7f0260dfebc69-7be7bbef03bb984a-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "bcb1cd876e871b813f8dd9c2cd071bbb", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "value": 0.5 - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "12343c91-62ea-43e5-8785-5f7de07f498a", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Thu, 05 Aug 2021 21:27:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "122" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/activate", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-59b4a539d938e2488c5450a33c026dfb-660f72fcf097d346-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "d957b65ffb63f941575b40b059f5292e", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "41f83543-d485-4713-b6cc-2dda1cafc84d", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Thu, 05 Aug 2021 21:27:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "243" - }, - "ResponseBody": [] + "Entries": [ + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-62c9c02e7f51624ea929794857b34cce-355fc01d53896141-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "0888336647ce5b4d471f554e73523042", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "32747b42-bbb4-40e0-894b-b05dc162a82b", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Connection": "close", + "Content-Length": "355", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 15:09:09 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10" + }, + "ResponseBody": { + "rewardWaitTime": "PT4H", + "defaultReward": 1.0, + "rewardAggregation": "average", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT3M", + "logRetentionDays": 2147483647, + "lastConfigurationEditDate": "2021-08-05T14:18:34", + "learningMode": "Online", + "isAutoOptimizationEnabled": true, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-08-18T21:43:47" + } + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-b0a9efd8ccf8204aa5a53a2c3c9bdda6-fbc21b761ea0694a-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "0f9e1cde582023b0f88a64306ea7a794", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "5cc62991-dec4-48cf-ba81-714051bb0a81", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "248", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 15:14:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10" + }, + "ResponseBody": { + "name": "d578f341411041e19ed83df0e0573a80", + "arguments": "--cb_explore_adf --quadratic GT --quadratic MR --quadratic GR --quadratic ME --quadratic OT --quadratic OE --quadratic OR --quadratic MS --quadratic GX --ignore A --cb_type ips --epsilon 0.2" + } + } + ], + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1112192962" } - ], - "Variables": { - "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "856681796" - } -} \ No newline at end of file +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json index b95b5e2a10d7..1b0aa39ef532 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json @@ -1,73 +1,89 @@ { - "Entries": [ - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/reward", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "13", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-a8125774fa5bf645a4f7f0260dfebc69-7be7bbef03bb984a-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "bcb1cd876e871b813f8dd9c2cd071bbb", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "value": 0.5 - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "12343c91-62ea-43e5-8785-5f7de07f498a", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Thu, 05 Aug 2021 21:27:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "122" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/activate", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-59b4a539d938e2488c5450a33c026dfb-660f72fcf097d346-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "d957b65ffb63f941575b40b059f5292e", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "41f83543-d485-4713-b6cc-2dda1cafc84d", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Thu, 05 Aug 2021 21:27:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "243" - }, - "ResponseBody": [] + "Entries": [ + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-62c9c02e7f51624ea929794857b34cce-355fc01d53896141-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "0888336647ce5b4d471f554e73523042", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "32747b42-bbb4-40e0-894b-b05dc162a82b", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Connection": "close", + "Content-Length": "355", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 15:09:09 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10" + }, + "ResponseBody": { + "rewardWaitTime": "PT4H", + "defaultReward": 1.0, + "rewardAggregation": "average", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT3M", + "logRetentionDays": 2147483647, + "lastConfigurationEditDate": "2021-08-05T14:18:34", + "learningMode": "Online", + "isAutoOptimizationEnabled": true, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-08-18T21:43:47" + } + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-b0a9efd8ccf8204aa5a53a2c3c9bdda6-fbc21b761ea0694a-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "0f9e1cde582023b0f88a64306ea7a794", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "5cc62991-dec4-48cf-ba81-714051bb0a81", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "248", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 15:14:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10" + }, + "ResponseBody": { + "name": "d578f341411041e19ed83df0e0573a80", + "arguments": "--cb_explore_adf --quadratic GT --quadratic MR --quadratic GR --quadratic ME --quadratic OT --quadratic OE --quadratic OR --quadratic MS --quadratic GX --ignore A --cb_type ips --epsilon 0.2" + } + } + ], + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1112192962" } - ], - "Variables": { - "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "856681796" - } -} \ No newline at end of file +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json index daefb87e1fc1..8a64e98e7e3b 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json @@ -133,7 +133,9 @@ "ResponseBody": null } ], - "Variables": { - "RandomSeed": "1431761393" - } + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1431761393" + } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json index 922b78324427..1b0aa39ef532 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json @@ -1,225 +1,89 @@ { - "Entries": [ - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "139", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-8a2352f590c938419932183af7ad2039-475eb6f9bad6944a-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "72fe1c6ec5e1742467bce38ccf58b021", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "actions": [ - { - "id": "Person", - "features": [ - { - "videoType": "documentary", - "videoLength": 35, - "director": "CarlSagan" - }, - { - "mostWatchedByAge": "30-35" - } - ] - } - ] - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "a7d4ebf4-e94b-4332-8066-a1936f394b5a", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "124", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 05 Aug 2021 20:55:04 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "13492" - }, - "ResponseBody": { - "ranking": [ - { - "id": "Person", - "probability": 1.0 - } - ], - "eventId": "4e9af3e0604e4fc1af091c9e76c0c93d-8iJRK", - "rewardActionId": "Person" - } - }, - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "527", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-9eed4f0ce6b0c340802623beef2c0a21-5e9e395f17eb1343-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "f451845d717dfcfd636af66ed165bf61", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "contextFeatures": [ - { - "Features": { - "day": "tuesday", - "time": "night", - "weather": "rainy" + "Entries": [ + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-62c9c02e7f51624ea929794857b34cce-355fc01d53896141-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "0888336647ce5b4d471f554e73523042", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "32747b42-bbb4-40e0-894b-b05dc162a82b", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Connection": "close", + "Content-Length": "355", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 15:09:09 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10" + }, + "ResponseBody": { + "rewardWaitTime": "PT4H", + "defaultReward": 1.0, + "rewardAggregation": "average", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT3M", + "logRetentionDays": 2147483647, + "lastConfigurationEditDate": "2021-08-05T14:18:34", + "learningMode": "Online", + "isAutoOptimizationEnabled": true, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-08-18T21:43:47" } - }, - { - "Features": { - "userId": "1234", - "payingUser": true, - "favoriteGenre": "documentary", - "hoursOnSite": 0.12, - "lastwatchedType": "movie" + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-b0a9efd8ccf8204aa5a53a2c3c9bdda6-fbc21b761ea0694a-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "0f9e1cde582023b0f88a64306ea7a794", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "5cc62991-dec4-48cf-ba81-714051bb0a81", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "248", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 15:14:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10" + }, + "ResponseBody": { + "name": "d578f341411041e19ed83df0e0573a80", + "arguments": "--cb_explore_adf --quadratic GT --quadratic MR --quadratic GR --quadratic ME --quadratic OT --quadratic OE --quadratic OR --quadratic MS --quadratic GX --ignore A --cb_type ips --epsilon 0.2" } - } - ], - "actions": [ - { - "id": "Person1", - "features": [ - { - "videoType": "documentary", - "videoLength": 35, - "director": "CarlSagan" - }, - { - "mostWatchedByAge": "30-35" - } - ] - }, - { - "id": "Person2", - "features": [ - { - "videoType": "documentary", - "videoLength": 35, - "director": "CarlSagan" - }, - { - "mostWatchedByAge": "40-45" - } - ] - } - ], - "excludedActions": [ - "Person1" - ], - "eventId": "123456789" - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "f4625cd9-6ee1-4f1a-b6de-af954ff2465e", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "132", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 05 Aug 2021 20:55:19 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "15290" - }, - "ResponseBody": { - "ranking": [ - { - "id": "Person1", - "probability": 0.0 - }, - { - "id": "Person2", - "probability": 1.0 - } - ], - "eventId": "123456789", - "rewardActionId": "Person2" - } - }, - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "139", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-cd2c7cfe73673242856c322a2fa711db-f43e2530c4f71446-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "66317083bf6f0fc05cfb3b5eae739abb", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "actions": [ - { - "id": "Person", - "features": [ - { - "videoType": "documentary", - "videoLength": 35, - "director": "CarlSagan" - }, - { - "mostWatchedByAge": "30-35" - } - ] - } - ] - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "e4c82d6d-7ee8-4eef-85fe-d31735c47995", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "124", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 05 Aug 2021 20:55:33 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "13443" - }, - "ResponseBody": { - "ranking": [ - { - "id": "Person", - "probability": 1.0 - } - ], - "eventId": "c638ab102e9f464dbc35f2f102f59f35-8iJSd", - "rewardActionId": "Person" - } + } + ], + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1112192962" } - ], - "Variables": { - "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "1112192962" - } -} \ No newline at end of file +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json index 922b78324427..1b0aa39ef532 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json @@ -1,225 +1,89 @@ { - "Entries": [ - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "139", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-8a2352f590c938419932183af7ad2039-475eb6f9bad6944a-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "72fe1c6ec5e1742467bce38ccf58b021", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "actions": [ - { - "id": "Person", - "features": [ - { - "videoType": "documentary", - "videoLength": 35, - "director": "CarlSagan" - }, - { - "mostWatchedByAge": "30-35" - } - ] - } - ] - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "a7d4ebf4-e94b-4332-8066-a1936f394b5a", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "124", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 05 Aug 2021 20:55:04 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "13492" - }, - "ResponseBody": { - "ranking": [ - { - "id": "Person", - "probability": 1.0 - } - ], - "eventId": "4e9af3e0604e4fc1af091c9e76c0c93d-8iJRK", - "rewardActionId": "Person" - } - }, - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "527", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-9eed4f0ce6b0c340802623beef2c0a21-5e9e395f17eb1343-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "f451845d717dfcfd636af66ed165bf61", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "contextFeatures": [ - { - "Features": { - "day": "tuesday", - "time": "night", - "weather": "rainy" + "Entries": [ + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-62c9c02e7f51624ea929794857b34cce-355fc01d53896141-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "0888336647ce5b4d471f554e73523042", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "32747b42-bbb4-40e0-894b-b05dc162a82b", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Connection": "close", + "Content-Length": "355", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 15:09:09 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10" + }, + "ResponseBody": { + "rewardWaitTime": "PT4H", + "defaultReward": 1.0, + "rewardAggregation": "average", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT3M", + "logRetentionDays": 2147483647, + "lastConfigurationEditDate": "2021-08-05T14:18:34", + "learningMode": "Online", + "isAutoOptimizationEnabled": true, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-08-18T21:43:47" } - }, - { - "Features": { - "userId": "1234", - "payingUser": true, - "favoriteGenre": "documentary", - "hoursOnSite": 0.12, - "lastwatchedType": "movie" + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-b0a9efd8ccf8204aa5a53a2c3c9bdda6-fbc21b761ea0694a-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "0f9e1cde582023b0f88a64306ea7a794", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "5cc62991-dec4-48cf-ba81-714051bb0a81", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "248", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 05 Aug 2021 15:14:47 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10" + }, + "ResponseBody": { + "name": "d578f341411041e19ed83df0e0573a80", + "arguments": "--cb_explore_adf --quadratic GT --quadratic MR --quadratic GR --quadratic ME --quadratic OT --quadratic OE --quadratic OR --quadratic MS --quadratic GX --ignore A --cb_type ips --epsilon 0.2" } - } - ], - "actions": [ - { - "id": "Person1", - "features": [ - { - "videoType": "documentary", - "videoLength": 35, - "director": "CarlSagan" - }, - { - "mostWatchedByAge": "30-35" - } - ] - }, - { - "id": "Person2", - "features": [ - { - "videoType": "documentary", - "videoLength": 35, - "director": "CarlSagan" - }, - { - "mostWatchedByAge": "40-45" - } - ] - } - ], - "excludedActions": [ - "Person1" - ], - "eventId": "123456789" - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "f4625cd9-6ee1-4f1a-b6de-af954ff2465e", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "132", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 05 Aug 2021 20:55:19 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "15290" - }, - "ResponseBody": { - "ranking": [ - { - "id": "Person1", - "probability": 0.0 - }, - { - "id": "Person2", - "probability": 1.0 - } - ], - "eventId": "123456789", - "rewardActionId": "Person2" - } - }, - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "139", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-cd2c7cfe73673242856c322a2fa711db-f43e2530c4f71446-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", - "x-ms-client-request-id": "66317083bf6f0fc05cfb3b5eae739abb", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "actions": [ - { - "id": "Person", - "features": [ - { - "videoType": "documentary", - "videoLength": 35, - "director": "CarlSagan" - }, - { - "mostWatchedByAge": "30-35" - } - ] - } - ] - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "e4c82d6d-7ee8-4eef-85fe-d31735c47995", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "124", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 05 Aug 2021 20:55:33 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "13443" - }, - "ResponseBody": { - "ranking": [ - { - "id": "Person", - "probability": 1.0 - } - ], - "eventId": "c638ab102e9f464dbc35f2f102f59f35-8iJSd", - "rewardActionId": "Person" - } + } + ], + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1112192962" } - ], - "Variables": { - "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "1112192962" - } -} \ No newline at end of file +} From 356fcbce004545e7af753f560244f6de5ec46819 Mon Sep 17 00:00:00 2001 From: John Huang <90279783+johnhuang01@users.noreply.github.com> Date: Mon, 14 Feb 2022 17:03:43 -0800 Subject: [PATCH 22/33] 13309375: Improve the tests by mocking LiveModel when test mode is (#14) * 13309375: Improve the tests by mocking LiveModel when test mode is Playback but using real LiveModel when test mode is Live * Change some public classes to private * Address those comments in the main PR * Update Microsoft.RL version * Rename some properties * Update Microsoft.RL version --- .../src/Azure.AI.Personalizer.csproj | 2 +- .../Models/PersonalizerRankResult.cs | 5 +- .../Models/PersonalizerRankedAction.cs | 4 +- .../src/Generated/RankClient.cs | 6 +- .../src/GlobalSuppressions.cs | 2 - .../src/Models/ActionProbabilityWrapper.cs | 31 + .../src/Models/DecisionContext.cs | 8 +- .../src/Models/DecisionContextDocument.cs | 50 +- .../src/Models/DecisionContextDocumentId.cs | 23 - .../Models/DecisionContextDocumentSource.cs | 19 - .../src/Models/ILiveModel.cs | 30 + .../src/Models/LiveModelAdapter.cs | 61 + .../MultiSlotResponseDetailedWrapper.cs | 42 + .../src/Models/PersonalizerClient.cs | 5 +- .../src/Models/PersonalizerSlotOptions.cs | 2 +- .../src/Models/RankingResponseWrapper.cs | 43 + .../src/Models/RlNetProcessor.cs | 20 +- .../src/Models/RlObjectConverter.cs | 20 +- .../src/Models/SlotRankingResponseWrapper.cs | 50 + .../tests/Azure.AI.Personalizer.Tests.csproj | 2 +- .../Infrastructure/PersonalizerTestBase.cs | 133 +- .../Personalizer/DecisionContextTests.cs | 8 +- .../Personalizer/PersonalizerClientForTest.cs | 25 + .../tests/Personalizer/RankTests.cs | 2 +- .../Personalizer/RlObjectConverterTests.cs | 1 - .../MultiSlotLocalInferenceTest.json | 481 +++--- .../MultiSlotLocalInferenceTestAsync.json | 1341 +++++++++-------- 27 files changed, 1499 insertions(+), 917 deletions(-) create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs delete mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentId.cs delete mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentSource.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/ILiveModel.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/RankingResponseWrapper.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingResponseWrapper.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj b/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj index 4bd20e764f5e..b5d425649ea8 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj @@ -32,7 +32,7 @@ - + diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs index 629d36afdcb0..9eb32219a975 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs @@ -36,13 +36,14 @@ internal PersonalizerRankResult(IReadOnlyList ranking, /// The calculated ranking for the current request. public IReadOnlyList Ranking { get; set; } + /// The eventId for the round trip from request to response. - public string EventId { get; set; } + public string EventId { get; } /// /// The action chosen by the Personalizer service. /// This is the action your application should display, and for which to report the reward. /// This might not be the first found in 'ranking'. /// - public string RewardActionId { get; set; } + public string RewardActionId { get; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs index 304775da49e6..9d55861dba4d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs @@ -25,8 +25,8 @@ internal PersonalizerRankedAction(string id, float? probability) } /// Id of the action. - public string Id { get; set; } + public string Id { get; } /// Probability of the action. - public float? Probability { get; set; } + public float? Probability { get; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs index 3cffc6b60d58..f5a56abb28f3 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs @@ -65,7 +65,8 @@ public RankClient(string endpoint, TokenCredential credential, bool isLocalInfer { LiveModel liveModel = new LiveModel(configuration); liveModel.Init(); - _rlNetProcessor = new RlNetProcessor(liveModel); + ILiveModel liveModelAdapter = new LiveModelAdapter(liveModel); + _rlNetProcessor = new RlNetProcessor(liveModelAdapter); } } @@ -104,7 +105,8 @@ public RankClient(string endpoint, AzureKeyCredential credential, bool isLocalIn { LiveModel liveModel = new LiveModel(configuration); liveModel.Init(); - _rlNetProcessor = new RlNetProcessor(liveModel); + LiveModelAdapter liveModelAdapter = new LiveModelAdapter(liveModel); + _rlNetProcessor = new RlNetProcessor(liveModelAdapter); } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs b/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs index 1e1c96d25518..227726867313 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs @@ -4,5 +4,3 @@ using System.Diagnostics.CodeAnalysis; [assembly: SuppressMessage("Usage", "AZC0016:Invalid ServiceVersion member name.", Justification = "Generated code: https://github.com/Azure/autorest.csharp/issues/1524", Scope = "type", Target = "~T:Azure.AI.Personalizer.PersonalizerClientOptions.ServiceVersion")] -[assembly: SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "", Scope = "member", Target = "~P:Azure.AI.Personalizer.DecisionContextDocument.SlotJson")] -[assembly: SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "", Scope = "member", Target = "~P:Azure.AI.Personalizer.PersonalizerSlotOptions.Features")] diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs new file mode 100644 index 000000000000..53b51e4deeb1 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; + +namespace Azure.AI.Personalizer +{ + /// The Wrapper for Rl.Net.ActionProbability + public class ActionProbabilityWrapper + { + private readonly ActionProbability _actionProbability; + + /// The probability + public virtual float Probability { get { return _actionProbability.Probability; } } + + /// The action index + public virtual long ActionIndex { get { return _actionProbability.ActionIndex; } } + + /// Initializes a new instance of ActionProbabilityWrapper. + public ActionProbabilityWrapper() + { + } + + /// Initializes a new instance of ActionProbabilityWrapper. + /// An action probability + public ActionProbabilityWrapper(ActionProbability actionProbability) + { + _actionProbability = actionProbability; + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs index 9607b94d182b..a3f302278da1 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs @@ -44,11 +44,11 @@ public DecisionContext(PersonalizerRankMultiSlotOptions rankRequest, Dictionary< List actionFeatures = action.Features.Select(f => JsonSerializer.Serialize(f)).ToList(); return new DecisionContextDocument(action.Id, actionFeatures, null, null); - }).ToArray(); + }).ToList(); this.Slots = rankRequest.Slots? .Select( slot => new DecisionContextDocument(null, null, slot.Id, serializeFeatures(slotIdToFeatures[slot.Id])) - ).ToArray(); + ).ToList(); } /// Properties from url @@ -59,12 +59,12 @@ public DecisionContext(PersonalizerRankMultiSlotOptions rankRequest, Dictionary< /// Properties of documents [JsonPropertyName("_multi")] - public DecisionContextDocument[] Documents { get; set; } + public IList Documents { get; } /// Properties of slots [JsonPropertyName("_slots")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public DecisionContextDocument[] Slots { get; set; } + public IList Slots { get; } private static List serializeFeatures(IList features) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs index ed7ce55c0b65..53b17fe1522d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs @@ -11,15 +11,15 @@ public class DecisionContextDocument { /// Initializes a new instance of DecisionContextDocument. /// Id of the decision context document - /// The json features + /// The json list of action features /// The slot Id - /// The slot json features - public DecisionContextDocument(string id, List json, string slotId, List slotJson) + /// The json list of slot features + public DecisionContextDocument(string id, List actionFeatureJsons, string slotId, List slotFeatureJsons) { - ID = id; - JSON = json; + Id = id; + ActionFeatureJsons = actionFeatureJsons; SlotId = slotId; - SlotJson = slotJson; + SlotFeatureJsons = slotFeatureJsons; } /// @@ -27,60 +27,36 @@ public DecisionContextDocument(string id, List json, string slotId, List /// [JsonPropertyName("_tag")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string ID - { - get { return this?.Marginal?.ID; } - set - { - this.Marginal = value == null ? null : new DecisionContextDocumentId - { - ID = value - }; - } - } - - /// - /// Provide feature for marginal feature based on document id. - /// - [JsonPropertyName("i")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public DecisionContextDocumentId Marginal { get; set; } - - /// - /// Provide source set feature. - /// - [JsonPropertyName("s")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public DecisionContextDocumentSource Source { get; set; } + public string Id { get; } /// - /// Generic json features. + /// A list of generic action feature jsons. /// [JsonPropertyName("j")] [JsonConverter(typeof(JsonRawStringListConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public List JSON { get; } + public List ActionFeatureJsons { get; } /// /// Keep as float[] arrays to improve marshalling speed. /// [JsonPropertyName("f")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public Dictionary FloatFeatures { get; } + public Dictionary Features { get; } /// /// Slot ID. /// [JsonPropertyName("_id")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string SlotId { get; set; } + public string SlotId { get; } /// - /// Generic slot json features. + /// A list of generic slot feature jsons. /// [JsonPropertyName("sj")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonConverter(typeof(JsonRawStringListConverter))] - public List SlotJson { get; set; } + public List SlotFeatureJsons { get; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentId.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentId.cs deleted file mode 100644 index 20880629e4dc..000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentId.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Text.Json.Serialization; - -namespace Azure.AI.Personalizer -{ - /// The Decision Context Document. - public class DecisionContextDocumentId - { - /// - /// Required for --marginal - /// - [JsonPropertyName("constant")] - public int Constant { get; set; } = 1; - - /// - /// Included for offline analysis. - /// - [JsonPropertyName("id")] - public string ID { get; set; } - } -} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentSource.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentSource.cs deleted file mode 100644 index b114f161426b..000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentSource.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Text.Json.Serialization; - -namespace Azure.AI.Personalizer -{ - /// The Decision Context Document Source. - public class DecisionContextDocumentSource - { - /// The set. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string Set { get; set; } - - /// The parameter. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string Parameter { get; set; } - } -} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/ILiveModel.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ILiveModel.cs new file mode 100644 index 000000000000..4ad02796042b --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ILiveModel.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; +using System; + +namespace Azure.AI.Personalizer +{ + /// An interface for Rl.Net.LiveModel + public interface ILiveModel + { + /// Init LiveModel + void Init(); + + /// Wrapper method of ChooseRank + RankingResponseWrapper ChooseRank(string eventId, string contextJson, ActionFlags flags); + + /// Wrapper method of RequestMultiSlotDecisionDetailed + MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, ActionFlags flags, int[] baselineActions); + + /// Wrapper method of QueueOutcomeEvent + void QueueOutcomeEvent(string eventId, float outcome); + + /// Wrapper method of RequestMultiSlotDecisionDetailed + void QueueOutcomeEvent(string eventId, string slotId, float outcome); + + /// Wrapper method of QueueActionTakenEvent + void QueueActionTakenEvent(string eventId); + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs new file mode 100644 index 000000000000..81a1edbecd98 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; +using System; + +namespace Azure.AI.Personalizer +{ + /// An adapter class of Rl.Net.LiveModel + public class LiveModelAdapter : ILiveModel + { + private readonly LiveModel liveModel; + + /// Initializes a new instance of LiveModelAdapter. + public LiveModelAdapter(LiveModel liveModel) + { + this.liveModel = liveModel ?? throw new ArgumentNullException(nameof(liveModel)); + } + + /// Init LiveModel + public void Init() + { + liveModel.Init(); + } + + /// Wrapper method of ChooseRank + public RankingResponseWrapper ChooseRank(string eventId, string contextJson, ActionFlags flags) + { + RankingResponse rankingResponse = liveModel.ChooseRank(eventId, contextJson, flags); + RankingResponseWrapper rankingResponseWrapper = rankingResponse == null ? null : new RankingResponseWrapper(rankingResponse); + + return rankingResponseWrapper; + } + + /// Wrapper method of RequestMultiSlotDecisionDetailed + public MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, ActionFlags flags, int[] baselineActions) + { + MultiSlotResponseDetailed multiSlotResponse = liveModel.RequestMultiSlotDecisionDetailed(eventId, contextJson, flags, baselineActions); + MultiSlotResponseDetailedWrapper multiSlotResponseDetailedWrapper = multiSlotResponse == null ? null : new MultiSlotResponseDetailedWrapper(multiSlotResponse); + return multiSlotResponseDetailedWrapper; + } + + /// Wrapper method of QueueOutcomeEvent + public void QueueOutcomeEvent(string eventId, float outcome) + { + liveModel.QueueOutcomeEvent(eventId, outcome); + } + + /// Wrapper method of RequestMultiSlotDecisionDetailed + public void QueueOutcomeEvent(string eventId, string slotId, float outcome) + { + liveModel.QueueOutcomeEvent(eventId, slotId, outcome); + } + + /// Wrapper method of QueueActionTakenEvent + public void QueueActionTakenEvent(string eventId) + { + liveModel.QueueActionTakenEvent(eventId); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs new file mode 100644 index 000000000000..86846431563f --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Personalizer +{ + /// The Wrapper for Rl.Net.MultiSlotResponseDetailed + public class MultiSlotResponseDetailedWrapper : IEnumerable + { + private readonly MultiSlotResponseDetailed _multiSlotResponse; + + /// Initializes a new instance of ActionProbabilityWrapper. + public MultiSlotResponseDetailedWrapper() + { + } + + /// Initializes a new instance of ActionProbabilityWrapper. + public MultiSlotResponseDetailedWrapper(MultiSlotResponseDetailed multiSlotResponse) + { + _multiSlotResponse = multiSlotResponse ?? throw new ArgumentNullException(nameof(multiSlotResponse)); + } + + /// Get the enumerator + public virtual IEnumerator GetEnumerator() + { + var enu = _multiSlotResponse.GetEnumerator(); + while (enu.MoveNext()) + { + yield return new SlotRankingResponseWrapper(enu.Current); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index ded880bbd78f..53ed73d79988 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -614,7 +614,7 @@ public virtual Response ActivateMultiSlot(string eventId, CancellationToken canc } /// Gets the rank processor initiated with live model to use - private RlNetProcessor GetConfigurationForRankProcessor(CancellationToken cancellationToken = default) + internal virtual RlNetProcessor GetConfigurationForRankProcessor(CancellationToken cancellationToken = default) { Configuration config = new Configuration(); // set up the model @@ -653,8 +653,9 @@ private RlNetProcessor GetConfigurationForRankProcessor(CancellationToken cancel config["rank.learning.mode"] = Convert.ToString(personalizerServiceProperties.LearningMode, CultureInfo.InvariantCulture); LiveModel liveModel = new LiveModel(config); liveModel.Init(); + ILiveModel liveModelAdapter = new LiveModelAdapter(liveModel); liveModelLastRefresh = DateTimeOffset.UtcNow; - return new RlNetProcessor(liveModel); + return new RlNetProcessor(liveModelAdapter); } /// Update the config details periodically based on liveModelRefreshTimeInMinutes or when bearer token is expired diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs index b169f40dc353..603f39a9950e 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs @@ -15,7 +15,7 @@ public partial class PersonalizerSlotOptions /// List of dictionaries containing slot features. /// Need to be JSON serializable. https://docs.microsoft.com/azure/cognitive-services/personalizer/concepts-features. /// - public IList Features { get; set; } + public IList Features { get; } /// /// Initializes a new instance of the RankRequest class. diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankingResponseWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankingResponseWrapper.cs new file mode 100644 index 000000000000..0d5b0014432a --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankingResponseWrapper.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Personalizer +{ + /// A wrapper class of Rl.Net.RankingResponse + public class RankingResponseWrapper : IEnumerable + { + private readonly RankingResponse _rankingResponse; + + /// Initializes a new instance of RankingResponseWrapper. + public RankingResponseWrapper() + { + } + + /// Initializes a new instance of RankingResponseWrapper. + /// An rank response + public RankingResponseWrapper(RankingResponse rankResponse) + { + _rankingResponse = rankResponse ?? throw new ArgumentNullException(nameof(rankResponse)); + } + + /// Get the enumerator + public virtual IEnumerator GetEnumerator() + { + var enu = _rankingResponse.GetEnumerator(); + while (enu.MoveNext()) + { + yield return new ActionProbabilityWrapper(enu.Current); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs index 670275b44b4b..0463554b40da 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs @@ -14,13 +14,13 @@ namespace Azure.AI.Personalizer /// The Rl.Net Processor. internal class RlNetProcessor { - private readonly LiveModel _liveModel; + private readonly ILiveModel liveModel; internal PolicyRestClient RestClient { get; } /// Initializes a new instance of RlNetProcessor. - public RlNetProcessor(LiveModel liveModel) + public RlNetProcessor(ILiveModel liveModel) { - this._liveModel = liveModel; + this.liveModel = liveModel; } /// Submit a Personalizer rank request. Receives a context and a list of actions. Returns which of the provided actions should be used by your application, in rewardActionId. @@ -61,10 +61,10 @@ public Response Rank(PersonalizerRankOptions options) ActionFlags flags = options.DeferActivation == true ? ActionFlags.Deferred : ActionFlags.Default; // Call ChooseRank of local RL.Net - RankingResponse rankingResponse = _liveModel.ChooseRank(eventId, contextJson, flags); + RankingResponseWrapper rankingResponseWrapper = liveModel.ChooseRank(eventId, contextJson, flags); // Convert response to PersonalizerRankResult - var value = RlObjectConverter.GenerateRankResult(originalActions, rankableActions, excludedActions, rankingResponse, options.EventId); + var value = RlObjectConverter.GenerateRankResult(originalActions, rankableActions, excludedActions, rankingResponseWrapper, options.EventId); return Response.FromValue(value, default); } @@ -93,10 +93,10 @@ public Response Rank(PersonalizerRankMultiSlotO int[] baselineActions = RlObjectConverter.ExtractBaselineActionsFromRankRequest(options); // Call ChooseRank of local RL.Net - MultiSlotResponseDetailed multiSlotResponse = _liveModel.RequestMultiSlotDecisionDetailed(eventId, contextJson, flags, baselineActions); + MultiSlotResponseDetailedWrapper multiSlotResponseDetailedWrapper = liveModel.RequestMultiSlotDecisionDetailed(eventId, contextJson, flags, baselineActions); // Convert response to PersonalizerRankResult - var value = RlObjectConverter.GenerateMultiSlotRankResponse(options.Actions, multiSlotResponse, eventId); + var value = RlObjectConverter.GenerateMultiSlotRankResponse(options.Actions, multiSlotResponseDetailedWrapper, eventId); return Response.FromValue(value, default); } @@ -107,7 +107,7 @@ public Response Rank(PersonalizerRankMultiSlotO public Response Reward(string eventId, float reward) { // Call QueueOutcomeEvent of local RL.Net - _liveModel.QueueOutcomeEvent(eventId, reward); + liveModel.QueueOutcomeEvent(eventId, reward); // Use 204 as there is no return value return new EventResponse(204); @@ -121,7 +121,7 @@ public Response RewardMultiSlot(string eventId, IList sl foreach (PersonalizerSlotReward slotReward in slotRewards) { // Call QueueOutcomeEvent of local RL.Net - _liveModel.QueueOutcomeEvent(eventId, slotReward.SlotId, slotReward.Value); + liveModel.QueueOutcomeEvent(eventId, slotReward.SlotId, slotReward.Value); } // Use 204 as there is no return value @@ -133,7 +133,7 @@ public Response RewardMultiSlot(string eventId, IList sl public Response Activate(string eventId) { // Call ReportActionTaken of local RL.Net - _liveModel.QueueActionTakenEvent(eventId); + liveModel.QueueActionTakenEvent(eventId); // Use 204 as there is no return value return new EventResponse(204); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs index b6810870f7a0..cfdba535e44b 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs @@ -26,7 +26,7 @@ public static string ConvertToContextJson(IEnumerable contextFeatures, L /// public static PersonalizerRankResult GenerateRankResult(List originalActions, List rankableActions, List excludedActions, - RankingResponse rankingResponse, string eventId) + RankingResponseWrapper rankingResponse, string eventId) { var rankedIndices = rankingResponse?.Select(actionProbability => ((int)actionProbability.ActionIndex + 1)).ToArray(); @@ -68,28 +68,20 @@ private static PersonalizerRankResult GenerateRankResultInner(List + var ranking = rankedIndices?.Select((index, i) => { var action = originalActions[index - 1]; - return new PersonalizerRankedAction() - { - Id = action.Id, - Probability = rankingProbabilities[i] - }; + return new PersonalizerRankedAction(action.Id, rankingProbabilities[i]); }).ToList(); - //setting RewardActionId to be the VW chosen action. - personalizerRankResult.RewardActionId = originalActions.ElementAt(chosenActionIndex)?.Id; + // setting RewardActionId to be the VW chosen action. + var personalizerRankResult = new PersonalizerRankResult(ranking, eventId, originalActions.ElementAt(chosenActionIndex)?.Id); return personalizerRankResult; } - public static PersonalizerMultiSlotRankResult GenerateMultiSlotRankResponse(IList actions, MultiSlotResponseDetailed multiSlotResponse, string eventId) + public static PersonalizerMultiSlotRankResult GenerateMultiSlotRankResponse(IList actions, MultiSlotResponseDetailedWrapper multiSlotResponse, string eventId) { Dictionary actionIndexToActionId = actions .Select((action, index) => new { action, index = (long)index }) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingResponseWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingResponseWrapper.cs new file mode 100644 index 000000000000..9e806ca4eada --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingResponseWrapper.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Personalizer +{ + /// The Wrapper for Rl.Net.SlotRankingResponse + public class SlotRankingResponseWrapper : IEnumerable + { + private readonly SlotRanking _slotRanking; + + /// Initializes a new instance of SlotRankingResponseWrapper. + public SlotRankingResponseWrapper() + {} + + /// Initializes a new instance of SlotRankingResponseWrapper. + public SlotRankingResponseWrapper(SlotRanking slotRanking) + { + _slotRanking = slotRanking ?? throw new ArgumentNullException(nameof(slotRanking)); + } + + /// Id of the slot ranking + public virtual string SlotId { get { return _slotRanking.SlotId; } } + + /// The chosen action id + public virtual long ChosenAction { get { return _slotRanking.ChosenAction; } } + + /// The count of the slot ranking + public virtual long Count { get { return _slotRanking.Count; } } + + /// The enumerator + public virtual IEnumerator GetEnumerator() + { + var enu = _slotRanking.GetEnumerator(); + while (enu.MoveNext()) + { + yield return new ActionProbabilityWrapper(enu.Current); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj index a4ebd5b5462b..19aa876b78d2 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj @@ -7,7 +7,7 @@ $(NoWarn);CS8032 - + diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs index 58ede423a35c..254a2837bd38 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs @@ -2,8 +2,12 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Azure.Core.TestFramework; +using Moq; +using Rl.Net; namespace Azure.AI.Personalizer.Tests { @@ -11,6 +15,74 @@ public abstract class PersonalizerTestBase : RecordedTestBase ranking; + private readonly long actionIndex; + private readonly string slotId; + + public override long ChosenAction { get { return this.actionIndex; } } + + public override string SlotId { get { return this.slotId; } } + + public SlotRankingWrapperForTest(long actionIndex, string slotId, IEnumerable ranked) : base() + { + this.actionIndex = actionIndex; + this.slotId = slotId; + this.ranking = ranked; + } + + public override IEnumerator GetEnumerator() + { + return ranking.GetEnumerator(); + } + } + + private class RankingResponseWrapperForTest : RankingResponseWrapper + { + private IEnumerable rank; + + public RankingResponseWrapperForTest(IEnumerable ranked) : base() + { + rank = ranked; + } + + public override IEnumerator GetEnumerator() + { + return rank.GetEnumerator(); + } + } + + private class MultiSlotResponseWrapperForTest : MultiSlotResponseDetailedWrapper + { + private IEnumerable slotRank; + + public MultiSlotResponseWrapperForTest(IEnumerable rankedSlot) : base() + { + slotRank = rankedSlot; + } + + public override IEnumerator GetEnumerator() + { + return slotRank.GetEnumerator(); + } + } + public PersonalizerTestBase(bool isAsync) : base(isAsync) { // TODO: Compare bodies again when https://github.com/Azure/azure-sdk-for-net/issues/22219 is resolved. @@ -32,7 +104,16 @@ protected async Task GetPersonalizerClientAsync(bool isSingl PersonalizerClient personalizerClient = null; if (isLocalInference) { - personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options: options, subsampleRate: subsampleRate); + if (Mode == RecordedTestMode.Playback) + { + RlNetProcessor rlNetProcessor = SetupRlNetProcessor(); + + personalizerClient = new PersonalizerClientForTest(new Uri(endpoint), credential, true, rlNetProcessor, options: options, subsampleRate: subsampleRate); + } + else + { + personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options: options, subsampleRate: subsampleRate); + } } else { @@ -64,5 +145,55 @@ private async Task EnableMultiSlot(PersonalizerAdministrationClient adminClient) //sleep 30 seconds to allow settings to propagate await Delay(30000); } + + private RlNetProcessor SetupRlNetProcessor() + { + Mock mockLiveModel = new Mock(); + + List actionProbability = new List + { + new ActionProbabilityWrapperForTest(0, 1f) + }; + + RankingResponseWrapper responseWrapper = new RankingResponseWrapperForTest(actionProbability); + mockLiveModel.Setup(m => m.ChooseRank(It.IsAny(), It.IsAny(), ActionFlags.Default)).Returns(responseWrapper); + + Dictionary> slotRankedActions = GetSlotActionProbabilityList(); + List rankedSlots = new List(); + + foreach (var item in slotRankedActions) + { + var slotRankingWrapperForTest = new SlotRankingWrapperForTest(item.Value.FirstOrDefault().ActionIndex, item.Key, item.Value); + rankedSlots.Add(slotRankingWrapperForTest); + } + + MultiSlotResponseDetailedWrapper multiSlotResponseWrapper = new MultiSlotResponseWrapperForTest(rankedSlots); + + mockLiveModel.Setup(m => m.RequestMultiSlotDecisionDetailed(It.IsAny(), It.IsAny(), ActionFlags.Default, It.IsAny())).Returns(multiSlotResponseWrapper); + mockLiveModel.Setup(m => m.QueueOutcomeEvent(It.IsAny(), It.IsAny())).Verifiable(); + mockLiveModel.Setup(m => m.QueueOutcomeEvent(It.IsAny(), It.IsAny(), It.IsAny())).Verifiable(); + mockLiveModel.Setup(m => m.QueueActionTakenEvent(It.IsAny())).Verifiable(); + + return new RlNetProcessor(mockLiveModel.Object); + } + + private Dictionary> GetSlotActionProbabilityList() + { + Dictionary> dict = new Dictionary>(); + + List slot1list = new List + { + new ActionProbabilityWrapperForTest(0, 1f) + }; + dict.Add("Main Article", slot1list); + + List slot2list = new List + { + new ActionProbabilityWrapperForTest(1, 1f) + }; + dict.Add("Side Bar", slot2list); + + return dict; + } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs index 88150d6e686e..6db5675f1359 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs @@ -24,10 +24,10 @@ public void DecisionContextConstructorTest() DecisionContext decisionContext = new DecisionContext(contextFeatures, actions); Assert.AreEqual(decisionContext.ContextFeatures.Count, 1); Assert.IsTrue(decisionContext.ContextFeatures[0].Equals("{\"Features\":{\"day\":\"Monday\",\"time\":\"morning\",\"weather\":\"sunny\"}}")); - Assert.AreEqual(decisionContext.Documents.Length, 1); - Assert.AreEqual(decisionContext.Documents[0].JSON.Count, 2); - Assert.IsTrue(decisionContext.Documents[0].JSON[0].Equals("{\"videoType\":\"documentary\",\"videoLength\":35,\"director\":\"CarlSagan\"}")); - Assert.IsTrue(decisionContext.Documents[0].JSON[1].Equals("{\"mostWatchedByAge\":\"30-35\"}")); + Assert.AreEqual(decisionContext.Documents.Count, 1); + Assert.AreEqual(decisionContext.Documents[0].ActionFeatureJsons.Count, 2); + Assert.IsTrue(decisionContext.Documents[0].ActionFeatureJsons[0].Equals("{\"videoType\":\"documentary\",\"videoLength\":35,\"director\":\"CarlSagan\"}")); + Assert.IsTrue(decisionContext.Documents[0].ActionFeatureJsons[1].Equals("{\"mostWatchedByAge\":\"30-35\"}")); } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs new file mode 100644 index 000000000000..b551f79c358d --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading; +using NUnit.Framework.Constraints; + +namespace Azure.AI.Personalizer.Tests +{ + internal class PersonalizerClientForTest : PersonalizerClient + { + private RlNetProcessor rlNetProcessor; + + public PersonalizerClientForTest(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, RlNetProcessor rlNetProcessor, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : + base(endpoint, credential, isLocalInference, subsampleRate, options) + { + this.rlNetProcessor = rlNetProcessor; + } + + internal override RlNetProcessor GetConfigurationForRankProcessor(CancellationToken cancellationToken = default) + { + return rlNetProcessor; + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs index 85ee4a05be5d..86e9b55482d6 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs @@ -46,7 +46,7 @@ private async Task RankNullParameters(PersonalizerClient client) features: new List() { new { videoType = "documentary", videoLength = 35, director = "CarlSagan" }, new { mostWatchedByAge = "30-35" } } )); - var request = new PersonalizerRankOptions(actions); + var request = new PersonalizerRankOptions(actions, null, null); // Action PersonalizerRankResult response = await client.RankAsync(request); // Assert diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs index 1718f679109c..b51b62c94194 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs @@ -44,7 +44,6 @@ public void ConvertToContextJsonTest() "\"weather\":\"sunny\"}}]," + "\"_multi\":[{" + "\"_tag\":\"Person\"," + - "\"i\":{\"constant\":1,\"id\":\"Person\"}," + "\"j\":[{" + "\"videoType\":\"documentary\"," + "\"videoLength\":35," + diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json index c393e2608fea..7034d19d4afa 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json @@ -44,6 +44,210 @@ "autoOptimizationStartDate": "2021-10-30T14:41:23" } }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + } + }, { "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "PUT", @@ -244,46 +448,60 @@ "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" } }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + } + }, { "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", - "Content-Length": "771", + "Content-Length": "511", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-dc7d4c7f96b2ef4bbdcb172245f6c48c-b8ca17898f77d54b-00", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "75961857c5237312446a1af9a48fd15c", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", "x-ms-return-client-request-id": "true" }, "RequestBody": { - "contextFeatures": [ - { - "User": { - "ProfileType": "AnonymousUser", - "LatLong": "47.6,-122.1" - } - }, - { - "Environment": { - "DayOfMonth": "28", - "MonthOfYear": "8", - "Weather": "Sunny" - } - }, - { - "Device": { - "Mobile": true, - "Windows": true - } - }, - { - "RecentActivity": { - "ItemsInCart": 3 - } - } - ], "actions": [ { "id": "NewsArticle", @@ -338,12 +556,11 @@ ], "baselineAction": "SportsArticle" } - ], - "deferActivation": false + ] }, "StatusCode": 201, "ResponseHeaders": { - "apim-request-id": "75a2d446-8415-4c5e-8898-ac0d56b05a19", + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", "Cache-Control": [ "no-cache", "no-store", @@ -351,13 +568,13 @@ ], "Content-Length": "166", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:46 GMT", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", "Expires": "0", "pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "timing-allow-origin": "*", "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "656" + "x-envoy-upstream-service-time": "6687" }, "ResponseBody": { "slots": [ @@ -370,7 +587,47 @@ "rewardActionId": "SportsArticle" } ], - "eventId": "3c8158a8634e45938889eef503eca7c1-8Io5Y" + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" } }, { @@ -378,41 +635,15 @@ "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", - "Content-Length": "798", + "Content-Length": "511", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-5ce193a77854fa4f8cbede3b8b961658-db3b4a8ec090dd4e-00", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "1473b19eb49357f9e70e3aade0f0d4cd", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", "x-ms-return-client-request-id": "true" }, "RequestBody": { - "contextFeatures": [ - { - "User": { - "ProfileType": "AnonymousUser", - "LatLong": "47.6,-122.1" - } - }, - { - "Environment": { - "DayOfMonth": "28", - "MonthOfYear": "8", - "Weather": "Sunny" - } - }, - { - "Device": { - "Mobile": true, - "Windows": true - } - }, - { - "RecentActivity": { - "ItemsInCart": 3 - } - } - ], "actions": [ { "id": "NewsArticle", @@ -467,27 +698,25 @@ ], "baselineAction": "SportsArticle" } - ], - "eventId": "sdkTestEventId", - "deferActivation": false + ] }, "StatusCode": 201, "ResponseHeaders": { - "apim-request-id": "5a5ee1b3-3e35-4e59-a67b-1179972d8abb", + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", "Cache-Control": [ "no-cache", "no-store", "must-revalidate" ], - "Content-Length": "142", + "Content-Length": "166", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", "Expires": "0", "pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "timing-allow-origin": "*", "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "438" + "x-envoy-upstream-service-time": "6687" }, "ResponseBody": { "slots": [ @@ -500,116 +729,8 @@ "rewardActionId": "SportsArticle" } ], - "eventId": "sdkTestEventId" + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "44", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-544c75c6622f6042b29c0e5559b2491d-92512bae864a3745-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "dc54762ad9152f5271c05453f7a4ee60", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "reward": [ - { - "slotId": "testSlot", - "value": 1 - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "147e62d7-78a6-4c0b-9712-5d15e21a90a9", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "417" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "44", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-76c0680ef4b76c49a79cd70ba19fdbcd-7b068eb1e129124c-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "3e3c138bed11a2d11f3e8d158a649254", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "reward": [ - { - "slotId": "testSlot", - "value": 1 - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "514ad45a-8228-44b0-b988-833e3f9f6c0c", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "41" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/activate", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-d9cc3eb2ee96b04cbcea9ee817a9e6c7-c6c37aa27c2f804e-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "2dce4d96f53ac4475e43a2d360a66042", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "50174a48-9297-4f7f-bc69-99fd75a90600", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:48 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "40" - }, - "ResponseBody": [] } ], "Variables": { diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json index a670ef1173cb..7034d19d4afa 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json @@ -1,620 +1,741 @@ { - "Entries": [ - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "350", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:54:18 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "7343" - }, - "ResponseBody": { - "rewardWaitTime": "PT10M", - "defaultReward": 0.0, - "rewardAggregation": "earliest", - "explorationPercentage": 0.2, - "modelExportFrequency": "PT5M", - "logRetentionDays": 90, - "lastConfigurationEditDate": "1601-01-01T00:00:00", - "learningMode": "Online", - "isAutoOptimizationEnabled": false, - "autoOptimizationFrequency": "P28D", - "autoOptimizationStartDate": "2021-10-30T14:41:23" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", - "RequestMethod": "PUT", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "358", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "rewardWaitTime": "PT10M", - "defaultReward": 0, - "rewardAggregation": "earliest", - "explorationPercentage": 0.200000003, - "modelExportFrequency": "PT5M", - "logRetentionDays": 90, - "lastConfigurationEditDate": "1601-01-01T00:00:00Z", - "learningMode": "Online", - "isAutoOptimizationEnabled": false, - "autoOptimizationFrequency": "P28D", - "autoOptimizationStartDate": "2021-10-30T14:41:23Z" - }, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "351", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:54:29 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "10620" - }, - "ResponseBody": { - "rewardWaitTime": "PT10M", - "defaultReward": 0.0, - "rewardAggregation": "earliest", - "explorationPercentage": 0.2, - "modelExportFrequency": "PT5M", - "logRetentionDays": 90, - "lastConfigurationEditDate": "1601-01-01T00:00:00", - "learningMode": "Online", - "isAutoOptimizationEnabled": false, - "autoOptimizationFrequency": "P28D", - "autoOptimizationStartDate": "2021-10-30T14:41:23Z" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", - "RequestMethod": "PUT", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "107", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "name": "multiSlot", - "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" - }, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "130", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:08 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "9284" - }, - "ResponseBody": { - "name": "8c31472ec8f14f65b37a0b1a14d743c7", - "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "511", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "actions": [ - { - "id": "NewsArticle", - "features": [ - { - "Type": "News" - } - ] - }, - { - "id": "SportsArticle", - "features": [ - { - "Type": "Sports" - } - ] - }, - { - "id": "EntertainmentArticle", - "features": [ - { - "Type": "Entertainment" - } - ] - } - ], - "slots": [ - { - "id": "Main Article", - "features": [ - { - "Size": "Large", - "Position": "Top Middle" - } - ], - "excludedActions": [ - "SportsArticle", - "EntertainmentArticle" - ], - "baselineAction": "NewsArticle" - }, - { - "id": "Side Bar", - "features": [ - { - "Size": "Small", - "Position": "Bottom Right" - } - ], - "excludedActions": [ - "EntertainmentArticle" - ], - "baselineAction": "SportsArticle" - } - ] - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "166", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:45 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "6687" - }, - "ResponseBody": { - "slots": [ - { - "id": "Main Article", - "rewardActionId": "NewsArticle" - }, - { - "id": "Side Bar", - "rewardActionId": "SportsArticle" - } - ], - "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "771", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-dc7d4c7f96b2ef4bbdcb172245f6c48c-b8ca17898f77d54b-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "75961857c5237312446a1af9a48fd15c", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "contextFeatures": [ - { - "User": { - "ProfileType": "AnonymousUser", - "LatLong": "47.6,-122.1" + "Entries": [ + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" } - }, - { - "Environment": { - "DayOfMonth": "28", - "MonthOfYear": "8", - "Weather": "Sunny" + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" } - }, - { - "Device": { - "Mobile": true, - "Windows": true + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" } - }, - { - "RecentActivity": { - "ItemsInCart": 3 + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" } - } - ], - "actions": [ - { - "id": "NewsArticle", - "features": [ - { - "Type": "News" - } - ] - }, - { - "id": "SportsArticle", - "features": [ - { - "Type": "Sports" - } - ] - }, - { - "id": "EntertainmentArticle", - "features": [ - { - "Type": "Entertainment" - } - ] - } - ], - "slots": [ - { - "id": "Main Article", - "features": [ - { - "Size": "Large", - "Position": "Top Middle" - } - ], - "excludedActions": [ - "SportsArticle", - "EntertainmentArticle" - ], - "baselineAction": "NewsArticle" - }, - { - "id": "Side Bar", - "features": [ - { - "Size": "Small", - "Position": "Bottom Right" - } - ], - "excludedActions": [ - "EntertainmentArticle" - ], - "baselineAction": "SportsArticle" - } - ], - "deferActivation": false - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "75a2d446-8415-4c5e-8898-ac0d56b05a19", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "166", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:46 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "656" - }, - "ResponseBody": { - "slots": [ - { - "id": "Main Article", - "rewardActionId": "NewsArticle" - }, - { - "id": "Side Bar", - "rewardActionId": "SportsArticle" - } - ], - "eventId": "3c8158a8634e45938889eef503eca7c1-8Io5Y" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "798", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-5ce193a77854fa4f8cbede3b8b961658-db3b4a8ec090dd4e-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "1473b19eb49357f9e70e3aade0f0d4cd", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "contextFeatures": [ - { - "User": { - "ProfileType": "AnonymousUser", - "LatLong": "47.6,-122.1" + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" } - }, - { - "Environment": { - "DayOfMonth": "28", - "MonthOfYear": "8", - "Weather": "Sunny" + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" } - }, - { - "Device": { - "Mobile": true, - "Windows": true + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" } - }, - { - "RecentActivity": { - "ItemsInCart": 3 + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "511", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "166", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "6687" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" } - } - ], - "actions": [ - { - "id": "NewsArticle", - "features": [ - { - "Type": "News" - } - ] - }, - { - "id": "SportsArticle", - "features": [ - { - "Type": "Sports" - } - ] - }, - { - "id": "EntertainmentArticle", - "features": [ - { - "Type": "Entertainment" - } - ] - } - ], - "slots": [ - { - "id": "Main Article", - "features": [ - { - "Size": "Large", - "Position": "Top Middle" - } - ], - "excludedActions": [ - "SportsArticle", - "EntertainmentArticle" - ], - "baselineAction": "NewsArticle" - }, - { - "id": "Side Bar", - "features": [ - { - "Size": "Small", - "Position": "Bottom Right" - } - ], - "excludedActions": [ - "EntertainmentArticle" - ], - "baselineAction": "SportsArticle" - } - ], - "eventId": "sdkTestEventId", - "deferActivation": false - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "5a5ee1b3-3e35-4e59-a67b-1179972d8abb", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "142", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "438" - }, - "ResponseBody": { - "slots": [ - { - "id": "Main Article", - "rewardActionId": "NewsArticle" - }, - { - "id": "Side Bar", - "rewardActionId": "SportsArticle" - } - ], - "eventId": "sdkTestEventId" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "44", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-544c75c6622f6042b29c0e5559b2491d-92512bae864a3745-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "dc54762ad9152f5271c05453f7a4ee60", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "reward": [ - { - "slotId": "testSlot", - "value": 1 - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "147e62d7-78a6-4c0b-9712-5d15e21a90a9", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "417" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "44", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-76c0680ef4b76c49a79cd70ba19fdbcd-7b068eb1e129124c-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "3e3c138bed11a2d11f3e8d158a649254", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "reward": [ - { - "slotId": "testSlot", - "value": 1 - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "514ad45a-8228-44b0-b988-833e3f9f6c0c", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "41" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/activate", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-d9cc3eb2ee96b04cbcea9ee817a9e6c7-c6c37aa27c2f804e-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "2dce4d96f53ac4475e43a2d360a66042", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "50174a48-9297-4f7f-bc69-99fd75a90600", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:48 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "40" - }, - "ResponseBody": [] + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "511", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "166", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "6687" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "511", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "166", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "6687" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" + } + } + ], + "Variables": { + "PERSONALIZER_API_KEY_MULTI_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_MULTI_SLOT": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/", + "RandomSeed": "2030725436" } - ], - "Variables": { - "PERSONALIZER_API_KEY_MULTI_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_MULTI_SLOT": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/", - "RandomSeed": "2030725436" - } -} \ No newline at end of file +} From 0526ce908408410ab80ce90773c60c4cef00ac07 Mon Sep 17 00:00:00 2001 From: John Huang Date: Tue, 15 Feb 2022 11:20:36 -0800 Subject: [PATCH 23/33] Fix spelling check --- .../Azure.AI.Personalizer.netstandard2.0.cs | 103 +++++++++++------- .../src/Models/DecisionContextDocument.cs | 21 ++-- .../Personalizer/DecisionContextTests.cs | 6 +- 3 files changed, 74 insertions(+), 56 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs index 42b44ee8dc4f..1c28136a47a1 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs @@ -1,5 +1,12 @@ namespace Azure.AI.Personalizer { + public partial class ActionProbabilityWrapper + { + public ActionProbabilityWrapper() { } + public ActionProbabilityWrapper(Rl.Net.ActionProbability actionProbability) { } + public virtual long ActionIndex { get { throw null; } } + public virtual float Probability { get { throw null; } } + } public partial class DecisionContext { public DecisionContext() { } @@ -9,51 +16,26 @@ public DecisionContext(System.Collections.Generic.IEnumerable contextFea [System.Text.Json.Serialization.JsonPropertyNameAttribute("FromUrl")] public System.Collections.Generic.List ContextFeatures { get { throw null; } } [System.Text.Json.Serialization.JsonPropertyNameAttribute("_multi")] - public Azure.AI.Personalizer.DecisionContextDocument[] Documents { get { throw null; } set { } } + public System.Collections.Generic.IList Documents { get { throw null; } } [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] [System.Text.Json.Serialization.JsonPropertyNameAttribute("_slots")] - public Azure.AI.Personalizer.DecisionContextDocument[] Slots { get { throw null; } set { } } + public System.Collections.Generic.IList Slots { get { throw null; } } } public partial class DecisionContextDocument { - public DecisionContextDocument(string id, System.Collections.Generic.List json, string slotId, System.Collections.Generic.List slotJson) { } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("f")] - public System.Collections.Generic.Dictionary FloatFeatures { get { throw null; } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("_tag")] - public string ID { get { throw null; } set { } } + public DecisionContextDocument(string id, System.Collections.Generic.List actionFeatureJsonList, string slotId, System.Collections.Generic.List slotFeatureJsonList) { } [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] [System.Text.Json.Serialization.JsonPropertyNameAttribute("j")] - public System.Collections.Generic.List JSON { get { throw null; } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("i")] - public Azure.AI.Personalizer.DecisionContextDocumentId Marginal { get { throw null; } set { } } + public System.Collections.Generic.List ActionFeatureJsonList { get { throw null; } } [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("_id")] - public string SlotId { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonPropertyNameAttribute("_tag")] + public string Id { get { throw null; } } [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] [System.Text.Json.Serialization.JsonPropertyNameAttribute("sj")] - public System.Collections.Generic.List SlotJson { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("s")] - public Azure.AI.Personalizer.DecisionContextDocumentSource Source { get { throw null; } set { } } - } - public partial class DecisionContextDocumentId - { - public DecisionContextDocumentId() { } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("constant")] - public int Constant { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("id")] - public string ID { get { throw null; } set { } } - } - public partial class DecisionContextDocumentSource - { - public DecisionContextDocumentSource() { } + public System.Collections.Generic.List SlotFeatureJsonList { get { throw null; } } [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - public string Parameter { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - public string Set { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonPropertyNameAttribute("_id")] + public string SlotId { get { throw null; } } } public partial class EventResponse : Azure.Response { @@ -68,6 +50,32 @@ public override void Dispose() { } protected override bool TryGetHeader(string name, out string value) { throw null; } protected override bool TryGetHeaderValues(string name, out System.Collections.Generic.IEnumerable values) { throw null; } } + public partial interface ILiveModel + { + Azure.AI.Personalizer.RankingResponseWrapper ChooseRank(string eventId, string contextJson, Rl.Net.ActionFlags flags); + void Init(); + void QueueActionTakenEvent(string eventId); + void QueueOutcomeEvent(string eventId, float outcome); + void QueueOutcomeEvent(string eventId, string slotId, float outcome); + Azure.AI.Personalizer.MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, Rl.Net.ActionFlags flags, int[] baselineActions); + } + public partial class LiveModelAdapter : Azure.AI.Personalizer.ILiveModel + { + public LiveModelAdapter(Rl.Net.LiveModel liveModel) { } + public Azure.AI.Personalizer.RankingResponseWrapper ChooseRank(string eventId, string contextJson, Rl.Net.ActionFlags flags) { throw null; } + public void Init() { } + public void QueueActionTakenEvent(string eventId) { } + public void QueueOutcomeEvent(string eventId, float outcome) { } + public void QueueOutcomeEvent(string eventId, string slotId, float outcome) { } + public Azure.AI.Personalizer.MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, Rl.Net.ActionFlags flags, int[] baselineActions) { throw null; } + } + public partial class MultiSlotResponseDetailedWrapper : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + public MultiSlotResponseDetailedWrapper() { } + public MultiSlotResponseDetailedWrapper(Rl.Net.MultiSlotResponseDetailed multiSlotResponse) { } + public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } public partial class PersonalizerAdministrationClient { protected PersonalizerAdministrationClient() { } @@ -334,8 +342,8 @@ public PersonalizerRankableAction(string id, System.Collections.Generic.IEnumera public partial class PersonalizerRankedAction { internal PersonalizerRankedAction() { } - public string Id { get { throw null; } set { } } - public float? Probability { get { throw null; } set { } } + public string Id { get { throw null; } } + public float? Probability { get { throw null; } } } public partial class PersonalizerRankMultiSlotOptions { @@ -362,9 +370,9 @@ public PersonalizerRankOptions(System.Collections.Generic.IEnumerable Ranking { get { throw null; } set { } } - public string RewardActionId { get { throw null; } set { } } + public string RewardActionId { get { throw null; } } } public partial class PersonalizerRewardMultiSlotOptions { @@ -400,7 +408,7 @@ public PersonalizerSlotOptions(string id, string baselineAction) { } public PersonalizerSlotOptions(string id, string baselineAction, System.Collections.Generic.IList features = null, System.Collections.Generic.IList excludedActions = null) { } public string BaselineAction { get { throw null; } } public System.Collections.Generic.IList ExcludedActions { get { throw null; } } - public System.Collections.Generic.IList Features { get { throw null; } set { } } + public System.Collections.Generic.IList Features { get { throw null; } } public string Id { get { throw null; } } } public partial class PersonalizerSlotResult @@ -415,4 +423,21 @@ public PersonalizerSlotReward(string slotId, float value) { } public string SlotId { get { throw null; } } public float Value { get { throw null; } } } + public partial class RankingResponseWrapper : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + public RankingResponseWrapper() { } + public RankingResponseWrapper(Rl.Net.RankingResponse rankResponse) { } + public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class SlotRankingResponseWrapper : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + public SlotRankingResponseWrapper() { } + public SlotRankingResponseWrapper(Rl.Net.SlotRanking slotRanking) { } + public virtual long ChosenAction { get { throw null; } } + public virtual long Count { get { throw null; } } + public virtual string SlotId { get { throw null; } } + public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs index 53b17fe1522d..51c2d16161dd 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs @@ -11,15 +11,15 @@ public class DecisionContextDocument { /// Initializes a new instance of DecisionContextDocument. /// Id of the decision context document - /// The json list of action features + /// The json list of action features /// The slot Id - /// The json list of slot features - public DecisionContextDocument(string id, List actionFeatureJsons, string slotId, List slotFeatureJsons) + /// The json list of slot features + public DecisionContextDocument(string id, List actionFeatureJsonList, string slotId, List slotFeatureJsonList) { Id = id; - ActionFeatureJsons = actionFeatureJsons; + ActionFeatureJsonList = actionFeatureJsonList; SlotId = slotId; - SlotFeatureJsons = slotFeatureJsons; + SlotFeatureJsonList = slotFeatureJsonList; } /// @@ -35,14 +35,7 @@ public DecisionContextDocument(string id, List actionFeatureJsons, strin [JsonPropertyName("j")] [JsonConverter(typeof(JsonRawStringListConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public List ActionFeatureJsons { get; } - - /// - /// Keep as float[] arrays to improve marshalling speed. - /// - [JsonPropertyName("f")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public Dictionary Features { get; } + public List ActionFeatureJsonList { get; } /// /// Slot ID. @@ -57,6 +50,6 @@ public DecisionContextDocument(string id, List actionFeatureJsons, strin [JsonPropertyName("sj")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonConverter(typeof(JsonRawStringListConverter))] - public List SlotFeatureJsons { get; } + public List SlotFeatureJsonList { get; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs index 6db5675f1359..67d5a45a6c2c 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs @@ -25,9 +25,9 @@ public void DecisionContextConstructorTest() Assert.AreEqual(decisionContext.ContextFeatures.Count, 1); Assert.IsTrue(decisionContext.ContextFeatures[0].Equals("{\"Features\":{\"day\":\"Monday\",\"time\":\"morning\",\"weather\":\"sunny\"}}")); Assert.AreEqual(decisionContext.Documents.Count, 1); - Assert.AreEqual(decisionContext.Documents[0].ActionFeatureJsons.Count, 2); - Assert.IsTrue(decisionContext.Documents[0].ActionFeatureJsons[0].Equals("{\"videoType\":\"documentary\",\"videoLength\":35,\"director\":\"CarlSagan\"}")); - Assert.IsTrue(decisionContext.Documents[0].ActionFeatureJsons[1].Equals("{\"mostWatchedByAge\":\"30-35\"}")); + Assert.AreEqual(decisionContext.Documents[0].ActionFeatureJsonList.Count, 2); + Assert.IsTrue(decisionContext.Documents[0].ActionFeatureJsonList[0].Equals("{\"videoType\":\"documentary\",\"videoLength\":35,\"director\":\"CarlSagan\"}")); + Assert.IsTrue(decisionContext.Documents[0].ActionFeatureJsonList[1].Equals("{\"mostWatchedByAge\":\"30-35\"}")); } } } From 5a493124397ae6e3ca6836a2186707b5bc377ad5 Mon Sep 17 00:00:00 2001 From: John Huang Date: Tue, 15 Feb 2022 11:26:50 -0800 Subject: [PATCH 24/33] Remove the unneeded warning --- .../tests/Azure.AI.Personalizer.Tests.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj index 19aa876b78d2..84690522839b 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj @@ -4,7 +4,6 @@ $(NoWarn);CS1591 - $(NoWarn);CS8032 From 2b8dd1a5d98cdde30db17c33eeb0308d8a1ca963 Mon Sep 17 00:00:00 2001 From: Tejaswi Paruchuri Date: Tue, 15 Feb 2022 13:39:56 -0800 Subject: [PATCH 25/33] Update live model config --- .../src/Models/PersonalizerClient.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index 53ed73d79988..f4c236bde5bb 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -637,15 +637,15 @@ internal virtual RlNetProcessor GetConfigurationForRankProcessor(CancellationTok personalizerServiceProperties = ServiceConfigurationRestClient.Get(cancellationToken); personalizerPolicy = PolicyRestClient.Get(cancellationToken); //interactions & observations - config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/interactions"; - config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/observations"; + config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.3/logs/interactions"; + config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.3/logs/observations"; config["interaction.sender.implementation"] = "INTERACTION_HTTP_API_SENDER"; config["observation.sender.implementation"] = "OBSERVATION_HTTP_API_SENDER"; config["interaction.subsample.rate"] = Convert.ToString(this.subsampleRate, CultureInfo.InvariantCulture); config["observation.subsample.rate"] = Convert.ToString(this.subsampleRate, CultureInfo.InvariantCulture); //model - config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.1/model"; - config["model.source"] = "AZURE_STORAGE_BLOB"; + config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.3/model"; + config["model.source"] = "HTTP_MODEL_DATA"; config["model.vw.initial_command_line"] = personalizerPolicy.Arguments; config["protocol.version"] = "2"; From 98a8ab6732ea5dd960fe03c3e57caf9a9d5dde79 Mon Sep 17 00:00:00 2001 From: Personalizer Team Date: Thu, 17 Feb 2022 17:24:20 -0800 Subject: [PATCH 26/33] Use similar method names for export and import apis --- .../PersonalizerAdministrationClient.cs | 18 +++++++++++++-- .../tests/Personalizer/ModelTests.cs | 22 +++++++++++++++---- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs index ff255cb70b20..b811014ff658 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs @@ -306,10 +306,24 @@ public virtual Response GetPersonalizerModel(bool isSigned = false, Canc } } + /// Export the current model used by Personalizer service. + /// The cancellation token to use. + /// Gets the signed Personalizer model. + public virtual async Task> ExportPersonalizerSignedModelAsync(CancellationToken cancellationToken = default) + { + return await GetPersonalizerModelAsync(true, cancellationToken).ConfigureAwait(false); + } + + /// Export the current model used by Personalizer service. + public virtual Response ExportPersonalizerSignedModel(CancellationToken cancellationToken = default) + { + return GetPersonalizerModel(isSigned: true, cancellationToken); + } + /// Replace the current model used by Personalizer service with an updated model. /// Stream representing the digitally signed model zip archive. /// The cancellation token to use. - public virtual async Task ImportPersonalizerModelAsync(Stream modelStream, CancellationToken cancellationToken = default) + public virtual async Task ImportPersonalizerSignedModelAsync(Stream modelStream, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerModel"); scope.Start(); @@ -327,7 +341,7 @@ public virtual async Task ImportPersonalizerModelAsync(Stream modelStr /// Replace the current model used by Personalizer service with an updated model. /// Stream representing the digitally signed model zip archive. /// The cancellation token to use. - public virtual Response ImportPersonalizerModel(Stream modelStream, CancellationToken cancellationToken = default) + public virtual Response ImportPersonalizerSignedModel(Stream modelStream, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerModel"); scope.Start(); diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs index 3b85d9169ca3..c151c9507099 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs @@ -18,20 +18,34 @@ public async Task ModelTest() { PersonalizerAdministrationClient client = GetAdministrationClient(isSingleSlot: true); await GetModel(false, client); + await GetModel(true, client); await GetModelProperties(client); - Response response = await GetModel(true, client); - await ImportModel(response.Value, client); + Response response = await ExportSignedModel(client); + await ImportSignedModel(response.Value, client); await ResetModel(client); } + [Test] + public async Task ExportImportModelTest() + { + PersonalizerAdministrationClient client = GetAdministrationClient(isSingleSlot: true); + Response response = await ExportSignedModel(client); + await ImportSignedModel(response.Value, client); + } + private async Task> GetModel(bool signed, PersonalizerAdministrationClient client) { return await client.GetPersonalizerModelAsync(signed); } - private async Task ImportModel(Stream modelStream, PersonalizerAdministrationClient client) + private async Task> ExportSignedModel(PersonalizerAdministrationClient client) + { + return await client.ExportPersonalizerSignedModelAsync(); + } + + private async Task ImportSignedModel(Stream modelStream, PersonalizerAdministrationClient client) { - return await client.ImportPersonalizerModelAsync(modelStream); + return await client.ImportPersonalizerSignedModelAsync(modelStream); } private async Task ResetModel(PersonalizerAdministrationClient client) From 30aca4cf455c07f1537ad8ed6adb13c745c9bba7 Mon Sep 17 00:00:00 2001 From: John Huang <90279783+johnhuang01@users.noreply.github.com> Date: Wed, 23 Feb 2022 11:18:30 -0800 Subject: [PATCH 27/33] Johnhuang/13170630 address thick client sdk review (#18) * 13170630: Address comments from SDK review * Update API view file * Remove unnecessary file under Gerated folder * Add more test for RLObjectConverter * Remove unused parameter * Remove unneeded comment --- .../Azure.AI.Personalizer.netstandard2.0.cs | 101 +---------- .../Models/PersonalizerRankResult.cs | 2 +- .../src/Generated/RankClient.cs | 168 ------------------ .../src/Models/ActionProbabilityWrapper.cs | 2 +- .../src/Models/DecisionContext.cs | 2 +- .../src/Models/DecisionContextDocument.cs | 16 +- .../src/Models/EventResponse.cs | 2 +- .../src/Models/ILiveModel.cs | 30 ---- .../src/Models/LiveModelAdapter.cs | 18 +- .../src/Models/LiveModelBase.cs | 30 ++++ .../MultiSlotResponseDetailedWrapper.cs | 6 +- .../src/Models/PersonalizerClient.cs | 30 +--- .../PersonalizerClientOptions.cs | 20 ++- .../src/Models/RankClient.cs | 10 -- .../src/Models/RankingResponseWrapper.cs | 2 +- .../src/Models/RlNetProcessor.cs | 4 +- .../src/Models/RlObjectConverter.cs | 10 +- ...sponseWrapper.cs => SlotRankingWrapper.cs} | 8 +- .../src/Properties/AssemblyInfo.cs | 1 + .../Infrastructure/PersonalizerTestBase.cs | 26 +-- .../Personalizer/DecisionContextTests.cs | 6 +- .../Personalizer/PersonalizerClientForTest.cs | 2 +- .../Personalizer/RlObjectConverterTests.cs | 115 ++++++++++++ 23 files changed, 220 insertions(+), 391 deletions(-) delete mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs delete mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/ILiveModel.cs create mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelBase.cs rename sdk/personalizer/Azure.AI.Personalizer/src/{Generated => Models}/PersonalizerClientOptions.cs (59%) delete mode 100644 sdk/personalizer/Azure.AI.Personalizer/src/Models/RankClient.cs rename sdk/personalizer/Azure.AI.Personalizer/src/Models/{SlotRankingResponseWrapper.cs => SlotRankingWrapper.cs} (84%) diff --git a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs index 1c28136a47a1..47bcdceab0fd 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs @@ -1,81 +1,5 @@ namespace Azure.AI.Personalizer { - public partial class ActionProbabilityWrapper - { - public ActionProbabilityWrapper() { } - public ActionProbabilityWrapper(Rl.Net.ActionProbability actionProbability) { } - public virtual long ActionIndex { get { throw null; } } - public virtual float Probability { get { throw null; } } - } - public partial class DecisionContext - { - public DecisionContext() { } - public DecisionContext(Azure.AI.Personalizer.PersonalizerRankMultiSlotOptions rankRequest, System.Collections.Generic.Dictionary> slotIdToFeatures) { } - public DecisionContext(System.Collections.Generic.IEnumerable contextFeatures, System.Collections.Generic.List rankableActions) { } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("FromUrl")] - public System.Collections.Generic.List ContextFeatures { get { throw null; } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("_multi")] - public System.Collections.Generic.IList Documents { get { throw null; } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("_slots")] - public System.Collections.Generic.IList Slots { get { throw null; } } - } - public partial class DecisionContextDocument - { - public DecisionContextDocument(string id, System.Collections.Generic.List actionFeatureJsonList, string slotId, System.Collections.Generic.List slotFeatureJsonList) { } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("j")] - public System.Collections.Generic.List ActionFeatureJsonList { get { throw null; } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("_tag")] - public string Id { get { throw null; } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("sj")] - public System.Collections.Generic.List SlotFeatureJsonList { get { throw null; } } - [System.Text.Json.Serialization.JsonIgnoreAttribute(Condition=System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)] - [System.Text.Json.Serialization.JsonPropertyNameAttribute("_id")] - public string SlotId { get { throw null; } } - } - public partial class EventResponse : Azure.Response - { - public EventResponse(int status, string reasonPhrase = null) { } - public override string ClientRequestId { get { throw null; } set { } } - public override System.IO.Stream ContentStream { get { throw null; } set { } } - public override string ReasonPhrase { get { throw null; } } - public override int Status { get { throw null; } } - protected override bool ContainsHeader(string name) { throw null; } - public override void Dispose() { } - protected override System.Collections.Generic.IEnumerable EnumerateHeaders() { throw null; } - protected override bool TryGetHeader(string name, out string value) { throw null; } - protected override bool TryGetHeaderValues(string name, out System.Collections.Generic.IEnumerable values) { throw null; } - } - public partial interface ILiveModel - { - Azure.AI.Personalizer.RankingResponseWrapper ChooseRank(string eventId, string contextJson, Rl.Net.ActionFlags flags); - void Init(); - void QueueActionTakenEvent(string eventId); - void QueueOutcomeEvent(string eventId, float outcome); - void QueueOutcomeEvent(string eventId, string slotId, float outcome); - Azure.AI.Personalizer.MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, Rl.Net.ActionFlags flags, int[] baselineActions); - } - public partial class LiveModelAdapter : Azure.AI.Personalizer.ILiveModel - { - public LiveModelAdapter(Rl.Net.LiveModel liveModel) { } - public Azure.AI.Personalizer.RankingResponseWrapper ChooseRank(string eventId, string contextJson, Rl.Net.ActionFlags flags) { throw null; } - public void Init() { } - public void QueueActionTakenEvent(string eventId) { } - public void QueueOutcomeEvent(string eventId, float outcome) { } - public void QueueOutcomeEvent(string eventId, string slotId, float outcome) { } - public Azure.AI.Personalizer.MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, Rl.Net.ActionFlags flags, int[] baselineActions) { throw null; } - } - public partial class MultiSlotResponseDetailedWrapper : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - public MultiSlotResponseDetailedWrapper() { } - public MultiSlotResponseDetailedWrapper(Rl.Net.MultiSlotResponseDetailed multiSlotResponse) { } - public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } public partial class PersonalizerAdministrationClient { protected PersonalizerAdministrationClient() { } @@ -119,10 +43,8 @@ public partial class PersonalizerClient protected PersonalizerClient() { } public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential) { } public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } - public PersonalizerClient(System.Uri endpoint, Azure.AzureKeyCredential credential, bool isLocalInference, float subsampleRate = 1f, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } - public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, bool isLocalInference, float subsampleRate = 1f, Azure.AI.Personalizer.PersonalizerClientOptions options = null) { } public virtual Azure.Response Activate(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ActivateAsync(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ActivateMultiSlot(string eventId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -144,10 +66,10 @@ public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential creden } public partial class PersonalizerClientOptions : Azure.Core.ClientOptions { - public PersonalizerClientOptions(Azure.AI.Personalizer.PersonalizerClientOptions.ServiceVersion version = Azure.AI.Personalizer.PersonalizerClientOptions.ServiceVersion.V1_1_preview_1) { } + public PersonalizerClientOptions(Azure.AI.Personalizer.PersonalizerClientOptions.ServiceVersion version = Azure.AI.Personalizer.PersonalizerClientOptions.ServiceVersion.V1_1_preview_3, bool isLocalInference = false, float subsampleRate = 1f) { } public enum ServiceVersion { - V1_1_preview_1 = 1, + V1_1_preview_3 = 1, } } public partial class PersonalizerCreateEvaluationOperation : Azure.Operation @@ -371,7 +293,7 @@ public partial class PersonalizerRankResult { internal PersonalizerRankResult() { } public string EventId { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Ranking { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList Ranking { get { throw null; } } public string RewardActionId { get { throw null; } } } public partial class PersonalizerRewardMultiSlotOptions @@ -423,21 +345,4 @@ public PersonalizerSlotReward(string slotId, float value) { } public string SlotId { get { throw null; } } public float Value { get { throw null; } } } - public partial class RankingResponseWrapper : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - public RankingResponseWrapper() { } - public RankingResponseWrapper(Rl.Net.RankingResponse rankResponse) { } - public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class SlotRankingResponseWrapper : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - public SlotRankingResponseWrapper() { } - public SlotRankingResponseWrapper(Rl.Net.SlotRanking slotRanking) { } - public virtual long ChosenAction { get { throw null; } } - public virtual long Count { get { throw null; } } - public virtual string SlotId { get { throw null; } } - public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs index 9eb32219a975..bfa9a6de6ccb 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs @@ -35,7 +35,7 @@ internal PersonalizerRankResult(IReadOnlyList ranking, } /// The calculated ranking for the current request. - public IReadOnlyList Ranking { get; set; } + public IReadOnlyList Ranking { get; } /// The eventId for the round trip from request to response. public string EventId { get; } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs deleted file mode 100644 index f5a56abb28f3..000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Rl.Net; - -namespace Azure.AI.Personalizer -{ - /// The Rank service client. - internal partial class RankClient - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - private readonly bool _isLocalInference; - private readonly RlNetProcessor _rlNetProcessor; - internal RankRestClient RestClient { get; } - - /// Initializes a new instance of RankClient for mocking. - protected RankClient() - { - } - - /// Initializes a new instance of RankClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public RankClient(string endpoint, TokenCredential credential, PersonalizerClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new PersonalizerClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - string[] scopes = { "https://cognitiveservices.azure.com/.default" }; - _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes)); - RestClient = new RankRestClient(_clientDiagnostics, _pipeline, endpoint); - } - - /// Initializes a new instance of PersonalizerClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local inference. - /// A configuration to use local reference. - /// The options for configuring the client. - public RankClient(string endpoint, TokenCredential credential, bool isLocalInference = false, Configuration configuration = null, PersonalizerClientOptions options = null) : - this(endpoint, credential, options) - { - _isLocalInference = isLocalInference; - if (isLocalInference) - { - LiveModel liveModel = new LiveModel(configuration); - liveModel.Init(); - ILiveModel liveModelAdapter = new LiveModelAdapter(liveModel); - _rlNetProcessor = new RlNetProcessor(liveModelAdapter); - } - } - - /// Initializes a new instance of RankClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public RankClient(string endpoint, AzureKeyCredential credential, PersonalizerClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new PersonalizerClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - _pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key")); - RestClient = new RankRestClient(_clientDiagnostics, _pipeline, endpoint); - } - - /// Initializes a new instance of PersonalizerClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local reference. - /// A configuration to use local reference. - /// The options for configuring the client. - public RankClient(string endpoint, AzureKeyCredential credential, bool isLocalInference = false, Configuration configuration = null, PersonalizerClientOptions options = null) : - this(endpoint, credential, options) - { - _isLocalInference = isLocalInference; - if (isLocalInference) - { - LiveModel liveModel = new LiveModel(configuration); - liveModel.Init(); - LiveModelAdapter liveModelAdapter = new LiveModelAdapter(liveModel); - _rlNetProcessor = new RlNetProcessor(liveModelAdapter); - } - - } - - /// Initializes a new instance of RankClient. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// Supported Cognitive Services endpoint. - internal RankClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint) - { - RestClient = new RankRestClient(clientDiagnostics, pipeline, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Submit a Personalizer rank request. Receives a context and a list of actions. Returns which of the provided actions should be used by your application, in rewardActionId. - /// A Personalizer Rank request. - /// The cancellation token to use. - public virtual async Task> RankAsync(PersonalizerRankOptions rankRequest, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("RankClient.Rank"); - scope.Start(); - try - { - if (_isLocalInference) - { - return _rlNetProcessor.Rank(rankRequest); - } - else - { - return await RestClient.RankAsync(rankRequest, cancellationToken).ConfigureAwait(false); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Submit a Personalizer rank request. Receives a context and a list of actions. Returns which of the provided actions should be used by your application, in rewardActionId. - /// A Personalizer Rank request. - /// The cancellation token to use. - public virtual Response Rank(PersonalizerRankOptions rankRequest, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("RankClient.Rank"); - scope.Start(); - try - { - return RestClient.Rank(rankRequest, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs index 53b51e4deeb1..2a6fc2321b28 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs @@ -6,7 +6,7 @@ namespace Azure.AI.Personalizer { /// The Wrapper for Rl.Net.ActionProbability - public class ActionProbabilityWrapper + internal class ActionProbabilityWrapper { private readonly ActionProbability _actionProbability; diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs index a3f302278da1..87f4567390f8 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs @@ -9,7 +9,7 @@ namespace Azure.AI.Personalizer { /// The Decision Context. - public class DecisionContext + internal class DecisionContext { /// The Decision Context used to serialize an object. public DecisionContext() diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs index 51c2d16161dd..4a4d7e404e39 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs @@ -7,19 +7,19 @@ namespace Azure.AI.Personalizer { /// The Decision Context Document. - public class DecisionContextDocument + internal class DecisionContextDocument { /// Initializes a new instance of DecisionContextDocument. /// Id of the decision context document - /// The json list of action features + /// The json list of action features /// The slot Id - /// The json list of slot features - public DecisionContextDocument(string id, List actionFeatureJsonList, string slotId, List slotFeatureJsonList) + /// The json list of slot features + public DecisionContextDocument(string id, List actionFeatures, string slotId, List slotFeatures) { Id = id; - ActionFeatureJsonList = actionFeatureJsonList; + ActionFeatures = actionFeatures; SlotId = slotId; - SlotFeatureJsonList = slotFeatureJsonList; + SlotFeatures = slotFeatures; } /// @@ -35,7 +35,7 @@ public DecisionContextDocument(string id, List actionFeatureJsonList, st [JsonPropertyName("j")] [JsonConverter(typeof(JsonRawStringListConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public List ActionFeatureJsonList { get; } + public List ActionFeatures { get; } /// /// Slot ID. @@ -50,6 +50,6 @@ public DecisionContextDocument(string id, List actionFeatureJsonList, st [JsonPropertyName("sj")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonConverter(typeof(JsonRawStringListConverter))] - public List SlotFeatureJsonList { get; } + public List SlotFeatures { get; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/EventResponse.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/EventResponse.cs index 41ebad8d525e..50d709ff3fcc 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/EventResponse.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/EventResponse.cs @@ -11,7 +11,7 @@ namespace Azure.AI.Personalizer { /// Response of an event operation - public class EventResponse : Response + internal class EventResponse : Response { private readonly Dictionary> _headers = new Dictionary>(StringComparer.OrdinalIgnoreCase); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/ILiveModel.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ILiveModel.cs deleted file mode 100644 index 4ad02796042b..000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/ILiveModel.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Rl.Net; -using System; - -namespace Azure.AI.Personalizer -{ - /// An interface for Rl.Net.LiveModel - public interface ILiveModel - { - /// Init LiveModel - void Init(); - - /// Wrapper method of ChooseRank - RankingResponseWrapper ChooseRank(string eventId, string contextJson, ActionFlags flags); - - /// Wrapper method of RequestMultiSlotDecisionDetailed - MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, ActionFlags flags, int[] baselineActions); - - /// Wrapper method of QueueOutcomeEvent - void QueueOutcomeEvent(string eventId, float outcome); - - /// Wrapper method of RequestMultiSlotDecisionDetailed - void QueueOutcomeEvent(string eventId, string slotId, float outcome); - - /// Wrapper method of QueueActionTakenEvent - void QueueActionTakenEvent(string eventId); - } -} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs index 81a1edbecd98..120ef15b56d1 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs @@ -7,33 +7,33 @@ namespace Azure.AI.Personalizer { /// An adapter class of Rl.Net.LiveModel - public class LiveModelAdapter : ILiveModel + internal class LiveModelAdapter : LiveModelBase { private readonly LiveModel liveModel; /// Initializes a new instance of LiveModelAdapter. - public LiveModelAdapter(LiveModel liveModel) + internal LiveModelAdapter(LiveModel liveModel) { this.liveModel = liveModel ?? throw new ArgumentNullException(nameof(liveModel)); } /// Init LiveModel - public void Init() + public override void Init() { liveModel.Init(); } /// Wrapper method of ChooseRank - public RankingResponseWrapper ChooseRank(string eventId, string contextJson, ActionFlags flags) + public override RankingResponseWrapper ChooseRank(string eventId, string contextJson, ActionFlags actionFlags) { - RankingResponse rankingResponse = liveModel.ChooseRank(eventId, contextJson, flags); + RankingResponse rankingResponse = liveModel.ChooseRank(eventId, contextJson, actionFlags); RankingResponseWrapper rankingResponseWrapper = rankingResponse == null ? null : new RankingResponseWrapper(rankingResponse); return rankingResponseWrapper; } /// Wrapper method of RequestMultiSlotDecisionDetailed - public MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, ActionFlags flags, int[] baselineActions) + public override MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, ActionFlags flags, int[] baselineActions) { MultiSlotResponseDetailed multiSlotResponse = liveModel.RequestMultiSlotDecisionDetailed(eventId, contextJson, flags, baselineActions); MultiSlotResponseDetailedWrapper multiSlotResponseDetailedWrapper = multiSlotResponse == null ? null : new MultiSlotResponseDetailedWrapper(multiSlotResponse); @@ -41,19 +41,19 @@ public MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string } /// Wrapper method of QueueOutcomeEvent - public void QueueOutcomeEvent(string eventId, float outcome) + public override void QueueOutcomeEvent(string eventId, float outcome) { liveModel.QueueOutcomeEvent(eventId, outcome); } /// Wrapper method of RequestMultiSlotDecisionDetailed - public void QueueOutcomeEvent(string eventId, string slotId, float outcome) + public override void QueueOutcomeEvent(string eventId, string slotId, float outcome) { liveModel.QueueOutcomeEvent(eventId, slotId, outcome); } /// Wrapper method of QueueActionTakenEvent - public void QueueActionTakenEvent(string eventId) + public override void QueueActionTakenEvent(string eventId) { liveModel.QueueActionTakenEvent(eventId); } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelBase.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelBase.cs new file mode 100644 index 000000000000..90233361afee --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelBase.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; +using System; + +namespace Azure.AI.Personalizer +{ + /// An abstract class for Rl.Net.LiveModel + internal abstract class LiveModelBase + { + /// Init LiveModel + public abstract void Init(); + + /// Wrapper method of ChooseRank + public abstract RankingResponseWrapper ChooseRank(string eventId, string contextJson, ActionFlags flags); + + /// Wrapper method of RequestMultiSlotDecisionDetailed + public abstract MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, ActionFlags flags, int[] baselineActions); + + /// Wrapper method of QueueOutcomeEvent + public abstract void QueueOutcomeEvent(string eventId, float outcome); + + /// Wrapper method of RequestMultiSlotDecisionDetailed + public abstract void QueueOutcomeEvent(string eventId, string slotId, float outcome); + + /// Wrapper method of QueueActionTakenEvent + public abstract void QueueActionTakenEvent(string eventId); + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs index 86846431563f..5dab77a6c28b 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs @@ -9,7 +9,7 @@ namespace Azure.AI.Personalizer { /// The Wrapper for Rl.Net.MultiSlotResponseDetailed - public class MultiSlotResponseDetailedWrapper : IEnumerable + internal class MultiSlotResponseDetailedWrapper : IEnumerable { private readonly MultiSlotResponseDetailed _multiSlotResponse; @@ -25,12 +25,12 @@ public MultiSlotResponseDetailedWrapper(MultiSlotResponseDetailed multiSlotRespo } /// Get the enumerator - public virtual IEnumerator GetEnumerator() + public virtual IEnumerator GetEnumerator() { var enu = _multiSlotResponse.GetEnumerator(); while (enu.MoveNext()) { - yield return new SlotRankingResponseWrapper(enu.Current); + yield return new SlotRankingWrapper(enu.Current); } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index f4c236bde5bb..582ef123a22c 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -69,21 +69,11 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer ServiceConfigurationRestClient = new ServiceConfigurationRestClient(clientDiagnostics, pipeline, stringEndpoint); PolicyRestClient = new PolicyRestClient(clientDiagnostics, pipeline, stringEndpoint); tokenCredential = credential; - } - /// Initializes a new instance of PersonalizerClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local inference. - /// Percentage from (0,1] determines how much percentage of interaction and observation events to consider - /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : - this(endpoint, credential, options) - { - this.isLocalInference = isLocalInference; + this.isLocalInference = options.IsLocalInference; if (isLocalInference) { - validateAndAssignSampleRate(subsampleRate); + validateAndAssignSampleRate(options.SubsampleRate); //lazy load Rankprocessor rlNetProcessor = new Lazy(() => GetConfigurationForRankProcessor()); } @@ -119,21 +109,11 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali ServiceConfigurationRestClient = new ServiceConfigurationRestClient(clientDiagnostics, pipeline, stringEndpoint); PolicyRestClient = new PolicyRestClient(clientDiagnostics, pipeline, stringEndpoint); azureKeyCredential = credential; - } - /// Initializes a new instance of PersonalizerClient. - /// Supported Cognitive Services endpoint. - /// A credential used to authenticate to an Azure Service. - /// A flag to determine whether to use local inference. - /// Percentage from (0,1] determines how much percentage of interaction and observation events to consider - /// The options for configuring the client. - public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : - this(endpoint, credential, options) - { - this.isLocalInference = isLocalInference; + this.isLocalInference = options.IsLocalInference; if (isLocalInference) { - validateAndAssignSampleRate(subsampleRate); + validateAndAssignSampleRate(options.SubsampleRate); //lazy load Rankprocessor rlNetProcessor = new Lazy(() => GetConfigurationForRankProcessor()); } @@ -653,7 +633,7 @@ internal virtual RlNetProcessor GetConfigurationForRankProcessor(CancellationTok config["rank.learning.mode"] = Convert.ToString(personalizerServiceProperties.LearningMode, CultureInfo.InvariantCulture); LiveModel liveModel = new LiveModel(config); liveModel.Init(); - ILiveModel liveModelAdapter = new LiveModelAdapter(liveModel); + LiveModelBase liveModelAdapter = new LiveModelAdapter(liveModel); liveModelLastRefresh = DateTimeOffset.UtcNow; return new RlNetProcessor(liveModelAdapter); } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/PersonalizerClientOptions.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClientOptions.cs similarity index 59% rename from sdk/personalizer/Azure.AI.Personalizer/src/Generated/PersonalizerClientOptions.cs rename to sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClientOptions.cs index 643a4e1a15c8..1331f68cd215 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/PersonalizerClientOptions.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClientOptions.cs @@ -13,27 +13,35 @@ namespace Azure.AI.Personalizer /// Client options for PersonalizerClient. public partial class PersonalizerClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V1_1_preview_1; + private bool isLocalInference; + private float subsampleRate; + private const ServiceVersion LatestVersion = ServiceVersion.V1_1_preview_3; /// The version of the service to use. public enum ServiceVersion { - /// Service version "1.1-preview.1". - V1_1_preview_1 = 1, + /// Service version "v1.1-preview.3". + V1_1_preview_3 = 1, } internal string Version { get; } - /// Initializes new instance of PersonalizerClientOptions. - public PersonalizerClientOptions(ServiceVersion version = LatestVersion) + /// Initializes new instance of PersonalizerClientV1Preview3ClientOptions. + public PersonalizerClientOptions(ServiceVersion version = LatestVersion, bool isLocalInference = false, float subsampleRate = 1) { + this.isLocalInference = isLocalInference; + this.subsampleRate = subsampleRate; + Version = version switch { - ServiceVersion.V1_1_preview_1 => "1.1-preview.1", + ServiceVersion.V1_1_preview_3 => "v1.1-preview.3", _ => throw new NotSupportedException() }; Retry.NetworkTimeout = TimeSpan.FromMinutes(8); } + + internal float SubsampleRate { get => subsampleRate; } + internal bool IsLocalInference { get => isLocalInference; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankClient.cs deleted file mode 100644 index fdd734a83b92..000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankClient.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.AI.Personalizer -{ - [CodeGenClient("PersonalizerClient")] - internal partial class RankClient {} -} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankingResponseWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankingResponseWrapper.cs index 0d5b0014432a..d081fd900491 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankingResponseWrapper.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankingResponseWrapper.cs @@ -9,7 +9,7 @@ namespace Azure.AI.Personalizer { /// A wrapper class of Rl.Net.RankingResponse - public class RankingResponseWrapper : IEnumerable + internal class RankingResponseWrapper : IEnumerable { private readonly RankingResponse _rankingResponse; diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs index 0463554b40da..088f1eaca3c7 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs @@ -14,11 +14,11 @@ namespace Azure.AI.Personalizer /// The Rl.Net Processor. internal class RlNetProcessor { - private readonly ILiveModel liveModel; + private readonly LiveModelBase liveModel; internal PolicyRestClient RestClient { get; } /// Initializes a new instance of RlNetProcessor. - public RlNetProcessor(ILiveModel liveModel) + public RlNetProcessor(LiveModelBase liveModel) { this.liveModel = liveModel; } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs index cfdba535e44b..941bff7dcbea 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs @@ -37,13 +37,11 @@ public static PersonalizerRankResult GenerateRankResult(List originalActions, - List rankableActions, List excludedActions, int[] rankedIndices, float[] rankingProbabilities, string eventId, int multiSlotChosenActionIndex = -1) + List rankableActions, List excludedActions, int[] rankedIndices, float[] rankingProbabilities, string eventId) { // excluded actions are not passed into VW // rankedIndices[0] is the index of the VW chosen action (1 based index) - // ccb response that is converted into a cb response: the chosen action index is a field in the vw response. - // multiSlotChosenActionIndex is part of the multi slot response (0 based index) - int chosenActionIndex = multiSlotChosenActionIndex == -1 ? rankedIndices[0] - 1 : multiSlotChosenActionIndex; + int chosenActionIndex = rankedIndices[0] - 1; // take care of actions that are excluded in their original positions if (excludedActions != null && excludedActions.Count > 0) @@ -69,14 +67,14 @@ private static PersonalizerRankResult GenerateRankResultInner(List + var rankings = rankedIndices?.Select((index, i) => { var action = originalActions[index - 1]; return new PersonalizerRankedAction(action.Id, rankingProbabilities[i]); }).ToList(); // setting RewardActionId to be the VW chosen action. - var personalizerRankResult = new PersonalizerRankResult(ranking, eventId, originalActions.ElementAt(chosenActionIndex)?.Id); + var personalizerRankResult = new PersonalizerRankResult(rankings, eventId, rankableActions.ElementAt(chosenActionIndex)?.Id); return personalizerRankResult; } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingResponseWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingWrapper.cs similarity index 84% rename from sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingResponseWrapper.cs rename to sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingWrapper.cs index 9e806ca4eada..de48f5b3da27 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingResponseWrapper.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingWrapper.cs @@ -8,17 +8,17 @@ namespace Azure.AI.Personalizer { - /// The Wrapper for Rl.Net.SlotRankingResponse - public class SlotRankingResponseWrapper : IEnumerable + /// The Wrapper for Rl.Net.SlotRanking + internal class SlotRankingWrapper : IEnumerable { private readonly SlotRanking _slotRanking; /// Initializes a new instance of SlotRankingResponseWrapper. - public SlotRankingResponseWrapper() + public SlotRankingWrapper() {} /// Initializes a new instance of SlotRankingResponseWrapper. - public SlotRankingResponseWrapper(SlotRanking slotRanking) + public SlotRankingWrapper(SlotRanking slotRanking) { _slotRanking = slotRanking ?? throw new ArgumentNullException(nameof(slotRanking)); } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Properties/AssemblyInfo.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Properties/AssemblyInfo.cs index 761a8aba1112..2e1a71977d10 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Properties/AssemblyInfo.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Properties/AssemblyInfo.cs @@ -6,4 +6,5 @@ [assembly: InternalsVisibleTo( "Azure.AI.Personalizer.Tests," + " PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] [assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.CognitiveServices")] diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs index 254a2837bd38..2f197a9a45a4 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs @@ -15,7 +15,7 @@ public abstract class PersonalizerTestBase : RecordedTestBase ranking; private readonly long actionIndex; @@ -40,7 +40,7 @@ private class SlotRankingWrapperForTest : SlotRankingResponseWrapper public override string SlotId { get { return this.slotId; } } - public SlotRankingWrapperForTest(long actionIndex, string slotId, IEnumerable ranked) : base() + internal SlotRankingWrapperForTest(long actionIndex, string slotId, IEnumerable ranked) : base() { this.actionIndex = actionIndex; this.slotId = slotId; @@ -53,7 +53,7 @@ public override IEnumerator GetEnumerator() } } - private class RankingResponseWrapperForTest : RankingResponseWrapper + internal class RankingResponseWrapperForTest : RankingResponseWrapper { private IEnumerable rank; @@ -68,16 +68,16 @@ public override IEnumerator GetEnumerator() } } - private class MultiSlotResponseWrapperForTest : MultiSlotResponseDetailedWrapper + internal class MultiSlotResponseWrapperForTest : MultiSlotResponseDetailedWrapper { - private IEnumerable slotRank; + private IEnumerable slotRank; - public MultiSlotResponseWrapperForTest(IEnumerable rankedSlot) : base() + public MultiSlotResponseWrapperForTest(IEnumerable rankedSlot) : base() { slotRank = rankedSlot; } - public override IEnumerator GetEnumerator() + public override IEnumerator GetEnumerator() { return slotRank.GetEnumerator(); } @@ -100,7 +100,7 @@ protected async Task GetPersonalizerClientAsync(bool isSingl await EnableMultiSlot(adminClient); } var credential = new AzureKeyCredential(apiKey); - var options = InstrumentClientOptions(new PersonalizerClientOptions()); + var options = InstrumentClientOptions(new PersonalizerClientOptions(isLocalInference: isLocalInference, subsampleRate: subsampleRate)); PersonalizerClient personalizerClient = null; if (isLocalInference) { @@ -112,7 +112,7 @@ protected async Task GetPersonalizerClientAsync(bool isSingl } else { - personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options: options, subsampleRate: subsampleRate); + personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, options: options); } } else @@ -148,7 +148,7 @@ private async Task EnableMultiSlot(PersonalizerAdministrationClient adminClient) private RlNetProcessor SetupRlNetProcessor() { - Mock mockLiveModel = new Mock(); + Mock mockLiveModel = new Mock(); List actionProbability = new List { @@ -159,7 +159,7 @@ private RlNetProcessor SetupRlNetProcessor() mockLiveModel.Setup(m => m.ChooseRank(It.IsAny(), It.IsAny(), ActionFlags.Default)).Returns(responseWrapper); Dictionary> slotRankedActions = GetSlotActionProbabilityList(); - List rankedSlots = new List(); + List rankedSlots = new List(); foreach (var item in slotRankedActions) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs index 67d5a45a6c2c..3b7f67017837 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs @@ -25,9 +25,9 @@ public void DecisionContextConstructorTest() Assert.AreEqual(decisionContext.ContextFeatures.Count, 1); Assert.IsTrue(decisionContext.ContextFeatures[0].Equals("{\"Features\":{\"day\":\"Monday\",\"time\":\"morning\",\"weather\":\"sunny\"}}")); Assert.AreEqual(decisionContext.Documents.Count, 1); - Assert.AreEqual(decisionContext.Documents[0].ActionFeatureJsonList.Count, 2); - Assert.IsTrue(decisionContext.Documents[0].ActionFeatureJsonList[0].Equals("{\"videoType\":\"documentary\",\"videoLength\":35,\"director\":\"CarlSagan\"}")); - Assert.IsTrue(decisionContext.Documents[0].ActionFeatureJsonList[1].Equals("{\"mostWatchedByAge\":\"30-35\"}")); + Assert.AreEqual(decisionContext.Documents[0].ActionFeatures.Count, 2); + Assert.IsTrue(decisionContext.Documents[0].ActionFeatures[0].Equals("{\"videoType\":\"documentary\",\"videoLength\":35,\"director\":\"CarlSagan\"}")); + Assert.IsTrue(decisionContext.Documents[0].ActionFeatures[1].Equals("{\"mostWatchedByAge\":\"30-35\"}")); } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs index b551f79c358d..4bf337e80603 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs @@ -12,7 +12,7 @@ internal class PersonalizerClientForTest : PersonalizerClient private RlNetProcessor rlNetProcessor; public PersonalizerClientForTest(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, RlNetProcessor rlNetProcessor, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : - base(endpoint, credential, isLocalInference, subsampleRate, options) + base(endpoint, credential, options) { this.rlNetProcessor = rlNetProcessor; } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs index b51b62c94194..4ea12a539a24 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using NUnit.Framework; +using static Azure.AI.Personalizer.Tests.PersonalizerTestBase; namespace Azure.AI.Personalizer.Tests { @@ -86,5 +87,119 @@ public void GetActionIdToIndexMappingTest() Assert.AreEqual(idToIndex["SportsArticle"], 1); Assert.AreEqual(idToIndex["EntertainmentArticle"], 2); } + + [Test] + public void GenerateRankResultTest() + { + List originalActions = GetActions(); + List rankableActions = new List(); + List excludedActions = new List(); + rankableActions.Add(originalActions[1]); + rankableActions.Add(originalActions[2]); + rankableActions.Add(originalActions[3]); + excludedActions.Add(originalActions[0]); + + List rankedActions = new List + { + new ActionProbabilityWrapperForTest(0, 0.7f), + new ActionProbabilityWrapperForTest(1, 0.2f), + new ActionProbabilityWrapperForTest(2, 0.1f) + }; + + RankingResponseWrapper responseWrapper = new RankingResponseWrapperForTest(rankedActions); + + string eventId = "testEventId"; + + PersonalizerRankResult rankResponse = RlObjectConverter.GenerateRankResult(originalActions, rankableActions, excludedActions, responseWrapper, eventId); + Assert.AreEqual("action1", rankResponse.RewardActionId); + Assert.AreEqual(originalActions.Count, rankResponse.Ranking.Count); + for (int i = 0; i < rankResponse.Ranking.Count; i++) + { + Assert.AreEqual(originalActions[i].Id, rankResponse.Ranking[i].Id); + } + } + + [Test] + public void GenerateMultiSlotRankResponseTest() + { + string eventId = "testEventId"; + List actions = GetActions(); + + List rankedActionsSlot1 = new List + { + new ActionProbabilityWrapperForTest(1, 0.8f), + new ActionProbabilityWrapperForTest(2, 0.1f), + new ActionProbabilityWrapperForTest(0, 0.1f) + }; + + List rankedActionsSlot2 = new List + { + new ActionProbabilityWrapperForTest(2, 0.9f), + new ActionProbabilityWrapperForTest(0, 0.1f) + }; + + List rankedActionsSlot3 = new List + { + new ActionProbabilityWrapperForTest(0, 1.0f) + }; + + // setup response + List rankedSlots = new List + { + new SlotRankingWrapperForTest(1, "slot1", rankedActionsSlot1), + new SlotRankingWrapperForTest(2, "slot2", rankedActionsSlot2), + new SlotRankingWrapperForTest(0, "slot3", rankedActionsSlot3) + }; + + MultiSlotResponseDetailedWrapper multiSlotResponseWrapper = new MultiSlotResponseWrapperForTest(rankedSlots); + + PersonalizerMultiSlotRankResult response = RlObjectConverter.GenerateMultiSlotRankResponse(actions, multiSlotResponseWrapper, eventId); + + int actionCount = rankedSlots.Count; + Assert.AreEqual(actionCount, response.Slots.Count); + for (int i = 0; i < actionCount; i++) + { + // Assert indices were assigned correctly + var rankedAction = actions[(int)rankedSlots[i].ChosenAction]; + Assert.AreEqual(rankedAction.Id, response.Slots[i].RewardActionId); + } + + Assert.AreEqual(eventId, response.EventId); + } + + private List GetActions() + { + var action0 = new PersonalizerRankableAction( + id: "action0", + features: + new List() { new { SiteId = "testId0" } } + ); + action0.Index = 0; + var action1 = new PersonalizerRankableAction( + id: "action1", + features: + new List() { new { SiteId = "testId1" } } + ); + action1.Index = 1; + var action2 = new PersonalizerRankableAction( + id: "action2", + features: + new List() { new { SiteId = "testId2" } } + ); + action2.Index = 2; + var action3 = new PersonalizerRankableAction( + id: "action3", + features: + new List() { new { SiteId = "testId3" } } + ); + action3.Index = 3; + List actions = new List(); + actions.Add(action0); + actions.Add(action1); + actions.Add(action2); + actions.Add(action3); + + return actions; + } } } From 0de97f59577ca4f02e47dc733f86293f27d4bf7e Mon Sep 17 00:00:00 2001 From: Sharath Malladi Date: Thu, 24 Feb 2022 11:16:42 -0800 Subject: [PATCH 28/33] Update recording sessions for tests that were changed in earlier commit. (#19) Co-authored-by: Personalizer Team --- .../PersonalizerAdministrationClient.cs | 28 +++++- .../ModelTests/ExportImportModelTest.json | 62 ++++++++++++ .../ExportImportModelTestAsync.json | 62 ++++++++++++ .../SessionRecords/ModelTests/ModelTest.json | 99 ++++++++++++------- .../ModelTests/ModelTestAsync.json | 95 +++++++++++------- 5 files changed, 270 insertions(+), 76 deletions(-) create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTest.json create mode 100644 sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTestAsync.json diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs index b811014ff658..c83fbadd72fe 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs @@ -311,13 +311,33 @@ public virtual Response GetPersonalizerModel(bool isSigned = false, Canc /// Gets the signed Personalizer model. public virtual async Task> ExportPersonalizerSignedModelAsync(CancellationToken cancellationToken = default) { - return await GetPersonalizerModelAsync(true, cancellationToken).ConfigureAwait(false); + using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ExportPersonalizerSignedModel"); + scope.Start(); + try + { + return await GetPersonalizerModelAsync(true, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Export the current model used by Personalizer service. public virtual Response ExportPersonalizerSignedModel(CancellationToken cancellationToken = default) { - return GetPersonalizerModel(isSigned: true, cancellationToken); + using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ExportPersonalizerSignedModel"); + scope.Start(); + try + { + return GetPersonalizerModel(isSigned: true, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Replace the current model used by Personalizer service with an updated model. @@ -325,7 +345,7 @@ public virtual Response ExportPersonalizerSignedModel(CancellationToken /// The cancellation token to use. public virtual async Task ImportPersonalizerSignedModelAsync(Stream modelStream, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerModel"); + using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerSignedModel"); scope.Start(); try { @@ -343,7 +363,7 @@ public virtual async Task ImportPersonalizerSignedModelAsync(Stream mo /// The cancellation token to use. public virtual Response ImportPersonalizerSignedModel(Stream modelStream, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerModel"); + using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerSignedModel"); scope.Start(); try { diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTest.json new file mode 100644 index 000000000000..66cdc411e2c5 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTest.json @@ -0,0 +1,62 @@ +{ + "Entries": [ + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/octet-stream, application/json", + "Connection": "keep-alive", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-04af737f02e4654f80638c1a15d8714c-b9518fc5dbfefb4c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "96be2135c067a067f77e8b137db6c614", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, must-revalidate, no-cache", + "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", + "Content-Length": "2034", + "Content-Type": "application/octet-stream", + "Date": "Thu, 24 Feb 2022 18:43:15 GMT", + "Expires": "0", + "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" + }, + "ResponseBody": "UEsDBBQAAAAIAGhVWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2Bgs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3hbdtJsy0fMULni1qDWx2FnYsdLnlRw3eAWupkcil1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAaFVYVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAaFVYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACABoVVhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "2034", + "Content-Type": "application/octet-stream", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-ca16996a34e5984ba14462945ab6aa6e-4d0b1c86eb161145-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "aff1c30a6933698c4059a169a8520670", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "UEsDBBQAAAAIAGhVWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3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1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAaFVYVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAaFVYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACABoVVhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA", + "StatusCode": 204, + "ResponseHeaders": { + "Cache-Control": "no-store, must-revalidate, no-cache", + "Date": "Thu, 24 Feb 2022 18:43:19 GMT", + "Expires": "0", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" + }, + "ResponseBody": null + } + ], + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1129379997" + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTestAsync.json new file mode 100644 index 000000000000..4d3809e51915 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTestAsync.json @@ -0,0 +1,62 @@ +{ + "Entries": [ + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/octet-stream, application/json", + "Connection": "keep-alive", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-48517a80f445984db63e0ba54447b589-223a96a24f126a44-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "faff3b1e01f32513b0c32437e301c229", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, must-revalidate, no-cache", + "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", + "Content-Length": "2034", + "Content-Type": "application/octet-stream", + "Date": "Thu, 24 Feb 2022 18:52:39 GMT", + "Expires": "0", + "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" + }, + "ResponseBody": "UEsDBBQAAAAIAJRWWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4P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eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAlFZYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACACUVlhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" + }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "2034", + "Content-Type": "application/octet-stream", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-1c93281801a4ce479fb9d2cf193a4fe4-92abc593e092814d-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "19c54291078edd9f922ce7bf612b6a3b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "UEsDBBQAAAAIAJRWWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuR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G1vZGVsLnZ3UEsBAhQAFAAAAAgAlFZYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACACUVlhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA", + "StatusCode": 204, + "ResponseHeaders": { + "Cache-Control": "no-store, must-revalidate, no-cache", + "Date": "Thu, 24 Feb 2022 18:52:44 GMT", + "Expires": "0", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" + }, + "ResponseBody": null + } + ], + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1104649957" + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json index 0497a4d7d192..a296aee3a021 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json @@ -6,9 +6,9 @@ "RequestHeaders": { "Accept": "application/octet-stream, application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-e98e2a58d4059695a3536105883c1aec-8e7f9e21144c7064-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220207.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", - "x-ms-client-request-id": "54fdd3ff4adf4059f9e84c940341c97d", + "traceparent": "00-fec6b630ded17c4f994f4e4e6a934f1a-84375901cec11845-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "7e8cad26e96337520c4192d0d5d573b3", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -18,24 +18,51 @@ "Content-Disposition": "attachment; filename=model.vw; filename*=UTF-8\u0027\u0027model.vw", "Content-Length": "0", "Content-Type": "application/octet-stream", - "Date": "Tue, 08 Feb 2022 04:49:39 GMT", + "Date": "Thu, 24 Feb 2022 18:43:20 GMT", "Expires": "0", - "Last-Modified": "Tue, 08 Feb 2022 04:45:19 GMT", + "Last-Modified": "Thu, 24 Feb 2022 18:43:16 GMT", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" }, "ResponseBody": null }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/octet-stream, application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-730cc6c9f8623a4a8f5599a0bde35d31-fef927118852884a-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "b2fdc9878734be3d9276e50cf803eace", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, must-revalidate, no-cache", + "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", + "Content-Length": "2034", + "Content-Type": "application/octet-stream", + "Date": "Thu, 24 Feb 2022 18:43:53 GMT", + "Expires": "0", + "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" + }, + "ResponseBody": "UEsDBBQAAAAIAHtVWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIg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\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAe1VYVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAe1VYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACAB7VVhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" + }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model/properties", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-90caf7f408d8a595abafe51af3b778ce-72fd30aae43900fd-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220207.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", - "x-ms-client-request-id": "fd9d54f446da306dd532ef8788956a73", + "traceparent": "00-ea6c2c910d05064b90cfac3b496fcb55-c859a36f7a0da74c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "30d94c2196927095cd84bf8c5233c857", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -44,18 +71,16 @@ "Cache-Control": "no-store, must-revalidate, no-cache", "Content-Length": "103", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 08 Feb 2022 04:49:40 GMT", + "Date": "Thu, 24 Feb 2022 18:43:54 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" }, - "ResponseBody": [ - "{\r\n", - " \u0022creationTime\u0022: \u00222021-04-14T18:35:22\u002B00:00\u0022,\r\n", - " \u0022lastModifiedTime\u0022: \u00222022-02-08T04:45:19\u002B00:00\u0022\r\n", - "}" - ] + "ResponseBody": { + "creationTime": "2021-04-19T22:17:21\u002B00:00", + "lastModifiedTime": "2022-02-24T18:43:16\u002B00:00" + } }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=true", @@ -63,9 +88,9 @@ "RequestHeaders": { "Accept": "application/octet-stream, application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-8f8f889f1c89d567aa54b61476b0d70c-fc9369752558c3a7-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220207.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", - "x-ms-client-request-id": "ace92831713032ca11a785e61fc54d73", + "traceparent": "00-3956ae2f46510949a0854d7cda64339c-c8e0e4eee5e75940-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "e68b0b6169d39e6f6fcdebec03453e08", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -73,35 +98,35 @@ "ResponseHeaders": { "Cache-Control": "no-store, must-revalidate, no-cache", "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", - "Content-Length": "2075", + "Content-Length": "2034", "Content-Type": "application/octet-stream", - "Date": "Tue, 08 Feb 2022 04:49:42 GMT", + "Date": "Thu, 24 Feb 2022 18:44:21 GMT", "Expires": "0", - "Last-Modified": "Mon, 04 Oct 2021 16:47:43 GMT", + "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" }, - "ResponseBody": "UEsDBBQAAAAIADWmR1Qcxu93eAEAAIcCAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYPADMo2SLBPTzMwMLIxNTExS05ItzRKTkgxSU43MTE1TzFPTdC1cC/xT9BNTUyySkk1MTS0Sk0yMDUySDIzM0sxMzE0tTQwNLVJSwcqcGXKBJh4AYgYhEIEEJgOxgq5uclJ8YkoahJFaUZCTX5SKEChOzC3ISYWwSyoLUhUyC4pBPEy1xfmJifE5QHZuaU5JZk5mXipctCgxLxvISS0ozszJz1Mw0DMygAAjSwsDI2MjoFxuYlF6Zl5ijkImAwvQWS\u002BcjE8zojmXgRlKJxxAlnpgDxFMdEh9yoQk/mM/mHKIdahOwCL\u002BIN8BZsqFLy3uDmDWgXwQbWJs/BmkCEqvcYYFIJIaFPAPSsfJI4tKQNQ1pMLVn9FhYMi5M3lv392FjkAJ\u002B8OpDAyFqXaH9NZGWRnyHLbe\u002BYaBYcnLq3uPvwtwAslf4mJE4WtbM6Kof7kWVT7mKCpfi4cJxb69y5kYCqRY9gKdApY3rWNG4QMAUEsDBBQAAAAIADWmR1SQ6SPzWAQAAPcGAAAKAAAAc2lnbmVyLmRlcjNoYvts0MR6ewEzEyMTk3ANg6dXV0iBF8\u002BftMZ\u002BBgYQz4CXjVOrzaPtOy8jIzcrg4GLobCBIBsX5yS1zsmfdFIYJcWY3Z18MAUdfV0NJQzE2JhDWZiF\u002BYE8Bc\u002B8tKJEBWdHBQNTAzlxXiMjAyMDYyNDYwtD8ygg19jA0MgSyjVQNVQ2UITolSooSNUrSC0qzs9LzMmsSi3SS6wqLUrVS87PNWhiVEJ2HyMrA3MTIz8DUJyLqYmRkWHP4n\u002Br69dxNF0tt/jP0xJX9nNzbs7kG9aZ/zVYr1Ux2XGUe51rKXq3TWRVp8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t8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAi1VYVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAi1VYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACACLVVhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", - "Content-Length": "2075", + "Content-Length": "2034", "Content-Type": "application/octet-stream", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-7d94e9d2b6affc07f9e19a6150ed4015-3ee7e4476da8d384-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220207.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", - "x-ms-client-request-id": "0b4b02a7170ab99266cc7fad5ad1b763", + "traceparent": "00-373b720a3874d64aa1ca643c5a057103-78725be545ff4c48-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "89aec45643fcf120338de5b0c8b16c5e", "x-ms-return-client-request-id": "true" }, - "RequestBody": "UEsDBBQAAAAIADWmR1Qcxu93eAEAAIcCAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYPADMo2SLBPTzMwMLIxNTExS05ItzRKTkgxSU43MTE1TzF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AAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAi1VYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACACLVVhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA", "StatusCode": 204, "ResponseHeaders": { "Cache-Control": "no-store, must-revalidate, no-cache", - "Date": "Tue, 08 Feb 2022 04:49:49 GMT", + "Date": "Thu, 24 Feb 2022 18:44:25 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", @@ -115,16 +140,16 @@ "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-6fda99e488640bc8800333e5cd6b9899-ec877c01fc41f794-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220207.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", - "x-ms-client-request-id": "db63d87e1c58834d896aeb33c086100f", + "traceparent": "00-83a741c7f3ea664187d4b17456f37d7c-174b08a00c980848-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "edaa8eae0478b8fadd3ac0c5aaa86c87", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 204, "ResponseHeaders": { "Cache-Control": "no-store, must-revalidate, no-cache", - "Date": "Tue, 08 Feb 2022 04:49:52 GMT", + "Date": "Thu, 24 Feb 2022 18:44:27 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", @@ -133,9 +158,9 @@ "ResponseBody": null } ], - "Variables": { - "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "1090338795" - } + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "526433004" + } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json index 8a64e98e7e3b..b6c8d1d8e34d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json @@ -6,9 +6,9 @@ "RequestHeaders": { "Accept": "application/octet-stream, application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-1bca1a665b4200aa3b128b52273e7e1e-4378f4eec4eb965a-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220208.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", - "x-ms-client-request-id": "c6288841d99b7a7d20062507ca6d38b0", + "traceparent": "00-ace75e2e739bd04199e05579a3a17263-6d9d2dfb806b7d47-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "b2e9eda6779440a0e7d3ecd88d0a9561", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -18,24 +18,51 @@ "Content-Disposition": "attachment; filename=model.vw; filename*=UTF-8\u0027\u0027model.vw", "Content-Length": "0", "Content-Type": "application/octet-stream", - "Date": "Tue, 08 Feb 2022 17:41:57 GMT", + "Date": "Thu, 24 Feb 2022 18:52:45 GMT", "Expires": "0", - "Last-Modified": "Tue, 08 Feb 2022 04:49:50 GMT", + "Last-Modified": "Thu, 24 Feb 2022 18:52:41 GMT", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" }, "ResponseBody": null }, + { + "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/octet-stream, application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-4295e737ca458f47b75b1371bb153af6-9ccc0dc351f4b243-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "31b72bb2a35b3fcca2b5b686bf5b32c2", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, must-revalidate, no-cache", + "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", + "Content-Length": "2034", + "Content-Type": "application/octet-stream", + "Date": "Thu, 24 Feb 2022 18:53:14 GMT", + "Expires": "0", + "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", + "Pragma": "no-cache", + "Server": "Kestrel", + "Timing-Allow-Origin": "*" + }, + "ResponseBody": "UEsDBBQAAAAIAKdWWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\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QIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAp1ZYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACACnVlhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" + }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model/properties", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-70faab57742d911155683a6daedfb1ed-c41c441baef3df4c-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220208.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", - "x-ms-client-request-id": "fa0e2904b60e570f5cae893d1f9d43d7", + "traceparent": "00-ab3ee20089216843a518ec74ae0a6a27-6a78d4ad0584ec46-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "2d9c5821d2d370c520cc39ffcb6ae96a", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -44,18 +71,16 @@ "Cache-Control": "no-store, must-revalidate, no-cache", "Content-Length": "103", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 08 Feb 2022 17:41:58 GMT", + "Date": "Thu, 24 Feb 2022 18:53:15 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" }, - "ResponseBody": [ - "{\r\n", - " \u0022creationTime\u0022: \u00222021-04-14T18:35:22\u002B00:00\u0022,\r\n", - " \u0022lastModifiedTime\u0022: \u00222022-02-08T04:49:50\u002B00:00\u0022\r\n", - "}" - ] + "ResponseBody": { + "creationTime": "2021-04-19T22:17:21\u002B00:00", + "lastModifiedTime": "2022-02-24T18:52:41\u002B00:00" + } }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=true", @@ -63,9 +88,9 @@ "RequestHeaders": { "Accept": "application/octet-stream, application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-65606c3707f3a49510d2f5256e1c525a-5df616de88c3ae74-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220208.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", - "x-ms-client-request-id": "9aba3d9ec478a22e79e7835fe4b0db0f", + "traceparent": "00-a51b50bbdceea344b4c9172b06575de5-43ae872a3256dc4f-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "95b770c5b696024e20aa10dfc019818b", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -73,35 +98,35 @@ "ResponseHeaders": { "Cache-Control": "no-store, must-revalidate, no-cache", "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", - "Content-Length": "2075", + "Content-Length": "2034", "Content-Type": "application/octet-stream", - "Date": "Tue, 08 Feb 2022 17:42:01 GMT", + "Date": "Thu, 24 Feb 2022 18:53:43 GMT", "Expires": "0", - "Last-Modified": "Mon, 04 Oct 2021 16:47:43 GMT", + "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" }, - "ResponseBody": "UEsDBBQAAAAIAEBNSFQcxu93eAEAAIcCAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYPADMo2SLBPTzMwMLIxNTExS05ItzRKTkgxSU43MTE1TzFPTdC1cC/xT9BNTUyySkk1MTS0Sk0yMDUySDIzM0sxMzE0tTQwNLVJSwcqcGXKBJh4AYgYhEIEEJgOxgq5uclJ8YkoahJFa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pZ25lci5kZXJQSwECFAAUAAAACAC2VlhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", - "Content-Length": "2075", + "Content-Length": "2034", "Content-Type": "application/octet-stream", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-6e2a4c546563f8f21c0b195425cd6fab-6c281dd1099d6322-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220208.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", - "x-ms-client-request-id": "bd9e2e6144968a2e79d069ed50405b82", + "traceparent": "00-06399e2f872830499e71903e2c48e906-e5ad73ca8d76aa46-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "34b72aa1676ee08d6647118f69cc7337", "x-ms-return-client-request-id": "true" }, - "RequestBody": "UEsDBBQAAAAIAEBNSFQcxu93eAEAAIcCAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYPADMo2SLBPTzMwMLIxNTExS05ItzRKTkgxSU43MTE1TzFPTdC1cC/xT9BNTUyySkk1MTS0Sk0yMDUySDIzM0sxMzE0tTQwNLVJSwcqcGXKBJh4AYgYhEIEEJgOxgq5uclJ8YkoahJFaUZCTX5SKEChOzC3ISYWwSyoLUhUyC4pBPEy1xfmJifE5QHZuaU5JZk5mXipctCgxLxvISS0ozszJz1Mw0DMygAAjSwsDI2MjoFxuYlF6Zl5ijkImAwvQWS\u002BcjE8zojmXgRlKJxxAlnpgDxFMdEh9yoQk/mM/mHKIdahOwCL\u002BIN8BZsqFLy3uDmDWgXwQbWJs/BmkCEqvcYYFIJIaFPAPSsfJI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z2/G3pizre6QdjO5q3VkrcIOtp7wqLXbi1a16MWsfyS7zeBU18aTf1xbrkDNPNNa/2nlN8sGDlwL1rqfyN8x8dM5A\u002B\u002BK7n6bbt6qbfIzpLP55ReqnwFvL2xMMW\u002Bbor2ZZUSu/y\u002BWn5\u002Bp32qm12hdbbsb\u002BXvOpcUPF2ec7zvA8jDPVZDdWklyzqHKnocWSCZoF27syT7K82nLh4QpW5YcVaTYhZnWsR35WKz1kfenDdaiNcVrm6wupNtoTN/kBAFBLAwQUAAAACAC2VlhUn0EdYgUBAAAAAQAAFAAAAHNoYTUxMl9zaWduYXR1cmUuYmluAQAB//6BQO2NdjZ3hbdtJsy0fMULni1qDWx2FnYsdLnlRw3eAWupkcil1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAtlZYVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAtlZYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACAC2VlhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA", "StatusCode": 204, "ResponseHeaders": { "Cache-Control": "no-store, must-revalidate, no-cache", - "Date": "Tue, 08 Feb 2022 17:42:08 GMT", + "Date": "Thu, 24 Feb 2022 18:53:46 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", @@ -115,16 +140,16 @@ "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-a69cb0a0dc75fd620597075b26cfeef4-f734f184d167c1f9-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220208.1 (.NET 6.0.1; Microsoft Windows 10.0.19044)", - "x-ms-client-request-id": "8c684ec29db34037fb6c802733af73ab", + "traceparent": "00-0645f4a43e643b4a83d50040463e4162-db13ea0e30ff7046-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", + "x-ms-client-request-id": "4ec04bcc9ca36b2c0a990c29c2e6af06", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 204, "ResponseHeaders": { "Cache-Control": "no-store, must-revalidate, no-cache", - "Date": "Tue, 08 Feb 2022 17:42:11 GMT", + "Date": "Thu, 24 Feb 2022 18:53:48 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", @@ -134,8 +159,8 @@ } ], "Variables": { - "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "1431761393" + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "712314448" } } From cbac31f5bc53170e9439d32e70b4ac42df4900e3 Mon Sep 17 00:00:00 2001 From: John Huang <90279783+johnhuang01@users.noreply.github.com> Date: Thu, 24 Feb 2022 12:06:18 -0800 Subject: [PATCH 29/33] Update api view file after model api change (#20) --- .../api/Azure.AI.Personalizer.netstandard2.0.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs index 47bcdceab0fd..993129185548 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs @@ -13,6 +13,8 @@ public PersonalizerAdministrationClient(System.Uri endpoint, Azure.Core.TokenCre public virtual System.Threading.Tasks.Task DeletePersonalizerEvaluationAsync(string evaluationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DeletePersonalizerLogs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeletePersonalizerLogsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ExportPersonalizerSignedModel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExportPersonalizerSignedModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerEvaluation(string evaluationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerEvaluationAsync(string evaluationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetPersonalizerEvaluations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -27,8 +29,8 @@ public PersonalizerAdministrationClient(System.Uri endpoint, Azure.Core.TokenCre public virtual System.Threading.Tasks.Task> GetPersonalizerPolicyAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ImportPersonalizerModel(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ImportPersonalizerModelAsync(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ImportPersonalizerSignedModel(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ImportPersonalizerSignedModelAsync(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ResetPersonalizerModel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ResetPersonalizerModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ResetPersonalizerPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } From cee47a8202ba965e906e4307bf8b5306293841a1 Mon Sep 17 00:00:00 2001 From: John Huang <90279783+johnhuang01@users.noreply.github.com> Date: Fri, 25 Feb 2022 10:24:58 -0800 Subject: [PATCH 30/33] Rename modelStream to modelBody (#21) --- .../api/Azure.AI.Personalizer.netstandard2.0.cs | 4 ++-- .../src/Models/PersonalizerAdministrationClient.cs | 12 ++++++------ .../tests/Personalizer/ModelTests.cs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs index 993129185548..7cd06aa5951d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs @@ -29,8 +29,8 @@ public PersonalizerAdministrationClient(System.Uri endpoint, Azure.Core.TokenCre public virtual System.Threading.Tasks.Task> GetPersonalizerPolicyAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ImportPersonalizerSignedModel(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ImportPersonalizerSignedModelAsync(System.IO.Stream modelStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ImportPersonalizerSignedModel(System.IO.Stream modelBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ImportPersonalizerSignedModelAsync(System.IO.Stream modelBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ResetPersonalizerModel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ResetPersonalizerModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ResetPersonalizerPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs index c83fbadd72fe..19e92c756c0c 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs @@ -341,15 +341,15 @@ public virtual Response ExportPersonalizerSignedModel(CancellationToken } /// Replace the current model used by Personalizer service with an updated model. - /// Stream representing the digitally signed model zip archive. + /// Stream representing the digitally signed model zip archive. /// The cancellation token to use. - public virtual async Task ImportPersonalizerSignedModelAsync(Stream modelStream, CancellationToken cancellationToken = default) + public virtual async Task ImportPersonalizerSignedModelAsync(Stream modelBody, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerSignedModel"); scope.Start(); try { - return await ModelRestClient.ImportAsync(modelStream, cancellationToken).ConfigureAwait(false); + return await ModelRestClient.ImportAsync(modelBody, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -359,15 +359,15 @@ public virtual async Task ImportPersonalizerSignedModelAsync(Stream mo } /// Replace the current model used by Personalizer service with an updated model. - /// Stream representing the digitally signed model zip archive. + /// Stream representing the digitally signed model zip archive. /// The cancellation token to use. - public virtual Response ImportPersonalizerSignedModel(Stream modelStream, CancellationToken cancellationToken = default) + public virtual Response ImportPersonalizerSignedModel(Stream modelBody, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerSignedModel"); scope.Start(); try { - return ModelRestClient.Import(modelStream, cancellationToken); + return ModelRestClient.Import(modelBody, cancellationToken); } catch (Exception e) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs index c151c9507099..052b84b6ae5f 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs @@ -43,9 +43,9 @@ private async Task> ExportSignedModel(PersonalizerAdministratio return await client.ExportPersonalizerSignedModelAsync(); } - private async Task ImportSignedModel(Stream modelStream, PersonalizerAdministrationClient client) + private async Task ImportSignedModel(Stream modelBody, PersonalizerAdministrationClient client) { - return await client.ImportPersonalizerSignedModelAsync(modelStream); + return await client.ImportPersonalizerSignedModelAsync(modelBody); } private async Task ResetModel(PersonalizerAdministrationClient client) From eebc3576138afdb1408a121fe438f52a0e6d6e88 Mon Sep 17 00:00:00 2001 From: John Huang Date: Sun, 27 Feb 2022 22:34:37 -0800 Subject: [PATCH 31/33] Update Microsoft.RL version --- .../Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj | 2 +- .../tests/Azure.AI.Personalizer.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj b/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj index b5d425649ea8..8143d322bda0 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj @@ -32,7 +32,7 @@ - + diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj index 84690522839b..afdbb0492095 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj @@ -6,7 +6,7 @@ $(NoWarn);CS1591 - + From fda656a25f04b92ba21f01d6c0af269888f4b30b Mon Sep 17 00:00:00 2001 From: John Huang <90279783+johnhuang01@users.noreply.github.com> Date: Mon, 28 Feb 2022 12:46:34 -0800 Subject: [PATCH 32/33] 13678440: Some cosmetic change to address comments from DotNet team (#22) --- .../Azure.AI.Personalizer.netstandard2.0.cs | 3 +- .../src/Models/PersonalizerClient.cs | 34 +++++++++---------- .../src/Models/PersonalizerClientOptions.cs | 8 ++--- .../src/Models/PersonalizerRankableAction.cs | 2 +- .../Infrastructure/PersonalizerTestBase.cs | 6 ++-- .../tests/Personalizer/EventsTests.cs | 2 +- .../tests/Personalizer/MultiSlotTests.cs | 6 ++-- .../Personalizer/PersonalizerClientForTest.cs | 2 +- .../tests/Personalizer/RankTests.cs | 6 ++-- 9 files changed, 34 insertions(+), 35 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs index 7cd06aa5951d..e53545c1b88b 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs @@ -68,7 +68,7 @@ public PersonalizerClient(System.Uri endpoint, Azure.Core.TokenCredential creden } public partial class PersonalizerClientOptions : Azure.Core.ClientOptions { - public PersonalizerClientOptions(Azure.AI.Personalizer.PersonalizerClientOptions.ServiceVersion version = Azure.AI.Personalizer.PersonalizerClientOptions.ServiceVersion.V1_1_preview_3, bool isLocalInference = false, float subsampleRate = 1f) { } + public PersonalizerClientOptions(Azure.AI.Personalizer.PersonalizerClientOptions.ServiceVersion version = Azure.AI.Personalizer.PersonalizerClientOptions.ServiceVersion.V1_1_preview_3, bool useLocalInference = false, float subsampleRate = 1f) { } public enum ServiceVersion { V1_1_preview_3 = 1, @@ -261,7 +261,6 @@ public partial class PersonalizerRankableAction public PersonalizerRankableAction(string id, System.Collections.Generic.IEnumerable features) { } public System.Collections.Generic.IList Features { get { throw null; } } public string Id { get { throw null; } } - public int Index { get { throw null; } set { } } } public partial class PersonalizerRankedAction { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index 582ef123a22c..4f207a44524e 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -18,7 +18,7 @@ public class PersonalizerClient { private readonly ClientDiagnostics clientDiagnostics; private readonly HttpPipeline pipeline; - private readonly bool isLocalInference; + private readonly bool useLocalInference; private string stringEndpoint; private AzureKeyCredential azureKeyCredential; private TokenCredential tokenCredential; @@ -70,8 +70,8 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer PolicyRestClient = new PolicyRestClient(clientDiagnostics, pipeline, stringEndpoint); tokenCredential = credential; - this.isLocalInference = options.IsLocalInference; - if (isLocalInference) + this.useLocalInference = options.UseLocalInference; + if (useLocalInference) { validateAndAssignSampleRate(options.SubsampleRate); //lazy load Rankprocessor @@ -110,8 +110,8 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali PolicyRestClient = new PolicyRestClient(clientDiagnostics, pipeline, stringEndpoint); azureKeyCredential = credential; - this.isLocalInference = options.IsLocalInference; - if (isLocalInference) + this.useLocalInference = options.UseLocalInference; + if (useLocalInference) { validateAndAssignSampleRate(options.SubsampleRate); //lazy load Rankprocessor @@ -148,7 +148,7 @@ public virtual async Task> RankAsync(Personaliz scope.Start(); try { - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.Rank(options); @@ -199,7 +199,7 @@ public virtual Response Rank(PersonalizerRankOptions opt scope.Start(); try { - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.Rank(options); @@ -250,7 +250,7 @@ public virtual async Task> RankMultiSl scope.Start(); try { - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.Rank(options); @@ -308,7 +308,7 @@ public virtual Response RankMultiSlot(Personali scope.Start(); try { - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.Rank(options); @@ -368,7 +368,7 @@ public virtual async Task RewardAsync(string eventId, float reward, Ca try { PersonalizerRewardOptions rewardOptions = new PersonalizerRewardOptions(reward); - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.Reward(eventId, reward); @@ -395,7 +395,7 @@ public virtual Response Reward(string eventId, float reward, CancellationToken c scope.Start(); try { - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.Reward(eventId, reward); @@ -423,7 +423,7 @@ public virtual async Task RewardMultiSlotAsync(string eventId, Persona scope.Start(); try { - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.RewardMultiSlot(eventId, options.Reward); @@ -461,7 +461,7 @@ public virtual Response RewardMultiSlot(string eventId, PersonalizerRewardMultiS scope.Start(); try { - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.RewardMultiSlot(eventId, options.Reward); @@ -498,7 +498,7 @@ public virtual async Task ActivateAsync(string eventId, CancellationTo scope.Start(); try { - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.Activate(eventId); @@ -524,7 +524,7 @@ public virtual Response Activate(string eventId, CancellationToken cancellationT scope.Start(); try { - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.Activate(eventId); @@ -550,7 +550,7 @@ public virtual async Task ActivateMultiSlotAsync(string eventId, Cance scope.Start(); try { - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.Activate(eventId); @@ -576,7 +576,7 @@ public virtual Response ActivateMultiSlot(string eventId, CancellationToken canc scope.Start(); try { - if (isLocalInference) + if (useLocalInference) { validateAndUpdateLiveModelConfig(); return rlNetProcessor.Value.Activate(eventId); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClientOptions.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClientOptions.cs index 1331f68cd215..42684fe0d00d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClientOptions.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClientOptions.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Personalizer /// Client options for PersonalizerClient. public partial class PersonalizerClientOptions : ClientOptions { - private bool isLocalInference; + private bool useLocalInference; private float subsampleRate; private const ServiceVersion LatestVersion = ServiceVersion.V1_1_preview_3; @@ -27,9 +27,9 @@ public enum ServiceVersion internal string Version { get; } /// Initializes new instance of PersonalizerClientV1Preview3ClientOptions. - public PersonalizerClientOptions(ServiceVersion version = LatestVersion, bool isLocalInference = false, float subsampleRate = 1) + public PersonalizerClientOptions(ServiceVersion version = LatestVersion, bool useLocalInference = false, float subsampleRate = 1) { - this.isLocalInference = isLocalInference; + this.useLocalInference = useLocalInference; this.subsampleRate = subsampleRate; Version = version switch @@ -42,6 +42,6 @@ public PersonalizerClientOptions(ServiceVersion version = LatestVersion, bool is } internal float SubsampleRate { get => subsampleRate; } - internal bool IsLocalInference { get => isLocalInference; } + internal bool UseLocalInference { get => useLocalInference; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerRankableAction.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerRankableAction.cs index b0dd9493f2c6..0a4bdf4d801f 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerRankableAction.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerRankableAction.cs @@ -19,6 +19,6 @@ public partial class PersonalizerRankableAction /// /// The index of the action in the original request /// - public int Index { get; set; } + internal int Index { get; set; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs index 2f197a9a45a4..bb157a39861e 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs @@ -90,7 +90,7 @@ public PersonalizerTestBase(bool isAsync) : base(isAsync) Sanitizer = new PersonalizerRecordedTestSanitizer(); } - protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false, bool isLocalInference = false, float subsampleRate = 1.0f) + protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false, bool useLocalInference = false, float subsampleRate = 1.0f) { string endpoint = isSingleSlot ? TestEnvironment.SingleSlotEndpoint : TestEnvironment.MultiSlotEndpoint; string apiKey = isSingleSlot ? TestEnvironment.SingleSlotApiKey : TestEnvironment.MultiSlotApiKey; @@ -100,9 +100,9 @@ protected async Task GetPersonalizerClientAsync(bool isSingl await EnableMultiSlot(adminClient); } var credential = new AzureKeyCredential(apiKey); - var options = InstrumentClientOptions(new PersonalizerClientOptions(isLocalInference: isLocalInference, subsampleRate: subsampleRate)); + var options = InstrumentClientOptions(new PersonalizerClientOptions(useLocalInference: useLocalInference, subsampleRate: subsampleRate)); PersonalizerClient personalizerClient = null; - if (isLocalInference) + if (useLocalInference) { if (Mode == RecordedTestMode.Playback) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/EventsTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/EventsTests.cs index acd8e30eb64d..65345e6e2a19 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/EventsTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/EventsTests.cs @@ -22,7 +22,7 @@ public async Task SingleSlotEventsTests() [Test] public async Task SingleSlotEventsLocalInferenceTests() { - PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true); + PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true, useLocalInference: true); await SingleSlotEventsTests(client); } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs index d864bdac32aa..a13102a8a96e 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs @@ -83,9 +83,9 @@ public async Task MultiSlotTest() [Test] public async Task MultiSlotLocalInferenceTest() { - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, subsampleRate: 1.01f)); - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true, subsampleRate: 0f)); - PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: false, isLocalInference: true); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, useLocalInference: true, subsampleRate: 1.01f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: false, useLocalInference: true, subsampleRate: 0f)); + PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: false, useLocalInference: true); await MultiSlotTestInner(client); } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs index 4bf337e80603..502e09df6a10 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs @@ -11,7 +11,7 @@ internal class PersonalizerClientForTest : PersonalizerClient { private RlNetProcessor rlNetProcessor; - public PersonalizerClientForTest(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, RlNetProcessor rlNetProcessor, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : + public PersonalizerClientForTest(Uri endpoint, AzureKeyCredential credential, bool useLocalInference, RlNetProcessor rlNetProcessor, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : base(endpoint, credential, options) { this.rlNetProcessor = rlNetProcessor; diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs index 86e9b55482d6..f0ae8268d306 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs @@ -24,9 +24,9 @@ public async Task SingleSlotRankTests() [Test] public async Task SingleSlotRankLocalInferenceTests() { - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, subsampleRate: 1.01f)); - Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true, subsampleRate: 0f)); - PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true, isLocalInference: true); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, useLocalInference: true, subsampleRate: 1.01f)); + Assert.ThrowsAsync(async () => await GetPersonalizerClientAsync(isSingleSlot: true, useLocalInference: true, subsampleRate: 0f)); + PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true, useLocalInference: true); await SingleSlotRankTests(client); } From 65e7fa78bd6e51cc66eeda1321cd86340995b06c Mon Sep 17 00:00:00 2001 From: Sharath Malladi Date: Mon, 28 Feb 2022 13:57:38 -0800 Subject: [PATCH 33/33] Update method names for Export/Import models as per suggestions. (#23) * Update method names for Export/Import models as per suggestions. * Updates after running codecheck.ps1 script Co-authored-by: Personalizer Team --- .../Azure.AI.Personalizer.netstandard2.0.cs | 6 +- .../PersonalizerAdministrationClient.cs | 50 ++------- .../tests/Personalizer/ModelTests.cs | 17 +-- .../ModelTests/ExportImportModelTest.json | 30 +++--- .../ExportImportModelTestAsync.json | 30 +++--- .../SessionRecords/ModelTests/ModelTest.json | 100 +++++------------- .../ModelTests/ModelTestAsync.json | 100 +++++------------- 7 files changed, 94 insertions(+), 239 deletions(-) diff --git a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs index e53545c1b88b..af3e4051b669 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/api/Azure.AI.Personalizer.netstandard2.0.cs @@ -13,16 +13,14 @@ public PersonalizerAdministrationClient(System.Uri endpoint, Azure.Core.TokenCre public virtual System.Threading.Tasks.Task DeletePersonalizerEvaluationAsync(string evaluationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DeletePersonalizerLogs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeletePersonalizerLogsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ExportPersonalizerSignedModel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExportPersonalizerSignedModelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ExportPersonalizerModel(bool isSigned, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExportPersonalizerModelAsync(bool isSigned, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerEvaluation(string evaluationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerEvaluationAsync(string evaluationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetPersonalizerEvaluations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetPersonalizerEvaluationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerLogProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerLogPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetPersonalizerModel(bool isSigned = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetPersonalizerModelAsync(bool isSigned = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerModelProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPersonalizerModelPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPersonalizerPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs index 19e92c756c0c..1d00e14014c2 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs @@ -270,12 +270,13 @@ public virtual Response ApplyPersonalizerEvaluation(PersonalizerPolicyReferenceO } } - /// Get the model file generated by Personalizer service. - /// True if requesting digitally signed model zip archive, false otherwise. + /// Export the current model used by Personalizer service. + /// True if requesting signed model zip archive, false otherwise. /// The cancellation token to use. - public virtual async Task> GetPersonalizerModelAsync(bool isSigned = false, CancellationToken cancellationToken = default) + /// Exports the Personalizer model. + public virtual async Task> ExportPersonalizerModelAsync(bool isSigned, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.GetPersonalizerModel"); + using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ExportPersonalizerModel"); scope.Start(); try { @@ -288,12 +289,13 @@ public virtual async Task> GetPersonalizerModelAsync(bool isSig } } - /// Get the model file generated by Personalizer service. + /// Export the current model used by Personalizer service. /// True if requesting signed model zip archive, false otherwise. /// The cancellation token to use. - public virtual Response GetPersonalizerModel(bool isSigned = false, CancellationToken cancellationToken = default) + /// Exports the Personalizer model. + public virtual Response ExportPersonalizerModel(bool isSigned, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.GetPersonalizerModel"); + using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ExportPersonalizerModel"); scope.Start(); try { @@ -306,40 +308,6 @@ public virtual Response GetPersonalizerModel(bool isSigned = false, Canc } } - /// Export the current model used by Personalizer service. - /// The cancellation token to use. - /// Gets the signed Personalizer model. - public virtual async Task> ExportPersonalizerSignedModelAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ExportPersonalizerSignedModel"); - scope.Start(); - try - { - return await GetPersonalizerModelAsync(true, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Export the current model used by Personalizer service. - public virtual Response ExportPersonalizerSignedModel(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ExportPersonalizerSignedModel"); - scope.Start(); - try - { - return GetPersonalizerModel(isSigned: true, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - /// Replace the current model used by Personalizer service with an updated model. /// Stream representing the digitally signed model zip archive. /// The cancellation token to use. diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs index 052b84b6ae5f..fb059fff162d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs @@ -17,11 +17,9 @@ public ModelTests(bool isAsync) : base(isAsync) public async Task ModelTest() { PersonalizerAdministrationClient client = GetAdministrationClient(isSingleSlot: true); - await GetModel(false, client); - await GetModel(true, client); + await ExportModel(false, client); + await ExportModel(true, client); await GetModelProperties(client); - Response response = await ExportSignedModel(client); - await ImportSignedModel(response.Value, client); await ResetModel(client); } @@ -29,18 +27,13 @@ public async Task ModelTest() public async Task ExportImportModelTest() { PersonalizerAdministrationClient client = GetAdministrationClient(isSingleSlot: true); - Response response = await ExportSignedModel(client); + Response response = await ExportModel(true, client); await ImportSignedModel(response.Value, client); } - private async Task> GetModel(bool signed, PersonalizerAdministrationClient client) - { - return await client.GetPersonalizerModelAsync(signed); - } - - private async Task> ExportSignedModel(PersonalizerAdministrationClient client) + private async Task> ExportModel(bool isSigned, PersonalizerAdministrationClient client) { - return await client.ExportPersonalizerSignedModelAsync(); + return await client.ExportPersonalizerModelAsync(isSigned); } private async Task ImportSignedModel(Stream modelBody, PersonalizerAdministrationClient client) diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTest.json index 66cdc411e2c5..9169c085ea93 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTest.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTest.json @@ -7,9 +7,9 @@ "Accept": "application/octet-stream, application/json", "Connection": "keep-alive", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-04af737f02e4654f80638c1a15d8714c-b9518fc5dbfefb4c-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "96be2135c067a067f77e8b137db6c614", + "traceparent": "00-52f54bd76de48949bd2307dce096bf22-1bd943347ff36a42-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "261bedb4be2f213ef03b3e88da15b7d9", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -19,14 +19,14 @@ "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", "Content-Length": "2034", "Content-Type": "application/octet-stream", - "Date": "Thu, 24 Feb 2022 18:43:15 GMT", + "Date": "Mon, 28 Feb 2022 21:09:06 GMT", "Expires": "0", "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" }, - "ResponseBody": "UEsDBBQAAAAIAGhVWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuRuU7HEflz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N8x8dM5A\u002B\u002BK7n6bbt6qbfIzpLP55ReqnwFvL2xMMW\u002Bbor2ZZUSu/y\u002BWn5\u002Bp32qm12hdbbsb\u002BXvOpcUPF2ec7zvA8jDPVZDdWklyzqHKnocWSCZoF27syT7K82nLh4QpW5YcVaTYhZnWsR35WKz1kfenDdaiNcVrm6wupNtoTN/kBAFBLAwQUAAAACAAjaVxUn0EdYgUBAAAAAQAAFAAAAHNoYTUxMl9zaWduYXR1cmUuYmluAQAB//6BQO2NdjZ3hbdtJsy0fMULni1qDWx2FnYsdLnlRw3eAWupkcil1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAI2lcVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAI2lcVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACAAjaVxUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", @@ -36,16 +36,16 @@ "Content-Length": "2034", "Content-Type": "application/octet-stream", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-ca16996a34e5984ba14462945ab6aa6e-4d0b1c86eb161145-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "aff1c30a6933698c4059a169a8520670", + "traceparent": "00-c9033ae14838bf44b339d71ba130cb71-fd4a0f903174244b-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "3d1398f436e1b76731f4f9fc76d14fa7", "x-ms-return-client-request-id": "true" }, - "RequestBody": "UEsDBBQAAAAIAGhVWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuRuU7HEflz7mCal7qU1S\u002BiRYzivoz/swo8qZ1qPxbjajq\u002BW6iyne/RZUHAFBLAwQUAAAACABoVVhUkOkj81gEAAD3BgAACgAAAHNpZ25lci5kZXIzaGL7bNDEensBMxMjE5NwDYOnV1dIgRfPn7TGfgYGEM\u002BAl41Tq82j7TsvIyM3K4OBi6GwgSAbF\u002Bcktc7Jn3RSGCXFmN2dfDAFHX1dDSUMxNiYQ1mYhfmBPAXPvLSiRAVnRwUDUwM5cV4jIwMjA2MjQ2MLQ/MoINfYwNDIEso1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1qDWx2FnYsdLnlRw3eAWupkcil1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAI2lcVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAI2lcVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACAAjaVxUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA", "StatusCode": 204, "ResponseHeaders": { "Cache-Control": "no-store, must-revalidate, no-cache", - "Date": "Thu, 24 Feb 2022 18:43:19 GMT", + "Date": "Mon, 28 Feb 2022 21:09:10 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", @@ -54,9 +54,9 @@ "ResponseBody": null } ], - "Variables": { - "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "1129379997" - } + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1463364058" + } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTestAsync.json index 4d3809e51915..6993e435a0ad 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTestAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTestAsync.json @@ -7,9 +7,9 @@ "Accept": "application/octet-stream, application/json", "Connection": "keep-alive", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-48517a80f445984db63e0ba54447b589-223a96a24f126a44-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "faff3b1e01f32513b0c32437e301c229", + "traceparent": "00-bb5f24d3933ca14ba9ab3053de4240c7-712a722f1fca8848-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "e22b2f4b18085c60bd9445ed25c00468", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -19,14 +19,14 @@ "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", "Content-Length": "2034", "Content-Type": "application/octet-stream", - "Date": "Thu, 24 Feb 2022 18:52:39 GMT", + "Date": "Mon, 28 Feb 2022 21:10:10 GMT", "Expires": "0", "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" }, - "ResponseBody": "UEsDBBQAAAAIAJRWWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp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5kZXJQSwECFAAUAAAACABFaVxUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", @@ -36,16 +36,16 @@ "Content-Length": "2034", "Content-Type": "application/octet-stream", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-1c93281801a4ce479fb9d2cf193a4fe4-92abc593e092814d-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "19c54291078edd9f922ce7bf612b6a3b", + "traceparent": "00-c4e76b7e17d9e04eb6de24a244232f69-7f51eb342806c44a-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "80154d96800113347fb41fc0b04d4be9", "x-ms-return-client-request-id": "true" }, - "RequestBody": "UEsDBBQAAAAIAJRWWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05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8sGDlwL1rqfyN8x8dM5A\u002B\u002BK7n6bbt6qbfIzpLP55ReqnwFvL2xMMW\u002Bbor2ZZUSu/y\u002BWn5\u002Bp32qm12hdbbsb\u002BXvOpcUPF2ec7zvA8jDPVZDdWklyzqHKnocWSCZoF27syT7K82nLh4QpW5YcVaTYhZnWsR35WKz1kfenDdaiNcVrm6wupNtoTN/kBAFBLAwQUAAAACABFaVxUn0EdYgUBAAAAAQAAFAAAAHNoYTUxMl9zaWduYXR1cmUuYmluAQAB//6BQO2NdjZ3hbdtJsy0fMULni1qDWx2FnYsdLnlRw3eAWupkcil1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgARWlcVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgARWlcVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACABFaVxUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA", "StatusCode": 204, "ResponseHeaders": { "Cache-Control": "no-store, must-revalidate, no-cache", - "Date": "Thu, 24 Feb 2022 18:52:44 GMT", + "Date": "Mon, 28 Feb 2022 21:10:13 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", @@ -54,9 +54,9 @@ "ResponseBody": null } ], - "Variables": { - "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "1104649957" - } + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "688701703" + } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json index a296aee3a021..6cc6f6f2020d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTest.json @@ -6,9 +6,9 @@ "RequestHeaders": { "Accept": "application/octet-stream, application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-fec6b630ded17c4f994f4e4e6a934f1a-84375901cec11845-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "7e8cad26e96337520c4192d0d5d573b3", + "traceparent": "00-417c320afeac4540b355d870e7144b7b-8bc18a74ae7a7046-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "cca9ca238df7de6aca60e8432a7912c4", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -18,9 +18,9 @@ "Content-Disposition": "attachment; filename=model.vw; filename*=UTF-8\u0027\u0027model.vw", "Content-Length": "0", "Content-Type": "application/octet-stream", - "Date": "Thu, 24 Feb 2022 18:43:20 GMT", + "Date": "Mon, 28 Feb 2022 21:09:10 GMT", "Expires": "0", - "Last-Modified": "Thu, 24 Feb 2022 18:43:16 GMT", + "Last-Modified": "Mon, 28 Feb 2022 21:09:07 GMT", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" @@ -33,9 +33,9 @@ "RequestHeaders": { "Accept": "application/octet-stream, application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-730cc6c9f8623a4a8f5599a0bde35d31-fef927118852884a-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "b2fdc9878734be3d9276e50cf803eace", + "traceparent": "00-6704f9f18d0d59498384641ab252ee0f-a80c9ba37b580a48-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "4ac74cfad4b60b2ad1dc7e077624257e", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -45,14 +45,14 @@ "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", "Content-Length": "2034", "Content-Type": "application/octet-stream", - "Date": "Thu, 24 Feb 2022 18:43:53 GMT", + "Date": "Mon, 28 Feb 2022 21:09:38 GMT", "Expires": "0", "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" }, - "ResponseBody": "UEsDBBQAAAAIAHtVWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPB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GAAAAAAMAAwCwAAAALAcAAAAA" }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model/properties", @@ -60,9 +60,9 @@ "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-ea6c2c910d05064b90cfac3b496fcb55-c859a36f7a0da74c-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "30d94c2196927095cd84bf8c5233c857", + "traceparent": "00-efcf1f0e351c8046a5305473c014a7c8-973dff85d4f98446-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "fb0227dd3094453188d1e73def38525e", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -71,7 +71,7 @@ "Cache-Control": "no-store, must-revalidate, no-cache", "Content-Length": "103", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 24 Feb 2022 18:43:54 GMT", + "Date": "Mon, 28 Feb 2022 21:09:39 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", @@ -79,77 +79,25 @@ }, "ResponseBody": { "creationTime": "2021-04-19T22:17:21\u002B00:00", - "lastModifiedTime": "2022-02-24T18:43:16\u002B00:00" + "lastModifiedTime": "2022-02-28T21:09:07\u002B00:00" } }, - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=true", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/octet-stream, application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-3956ae2f46510949a0854d7cda64339c-c8e0e4eee5e75940-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "e68b0b6169d39e6f6fcdebec03453e08", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-store, must-revalidate, no-cache", - "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", - "Content-Length": "2034", - "Content-Type": "application/octet-stream", - "Date": "Thu, 24 Feb 2022 18:44:21 GMT", - "Expires": "0", - "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", - "Pragma": "no-cache", - "Server": "Kestrel", - "Timing-Allow-Origin": "*" - }, - "ResponseBody": "UEsDBBQAAAAIAItVWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuRuU7HEflz7mCal7qU1S\u002BiRYzivoz/swo8qZ1qPxbjajq\u002BW6iyne/RZUHAFBLAwQUAAAACACLVVhUkOkj81gEAAD3BgAACgAAAHNpZ25lci5kZXIzaGL7bNDEensBMxMjE5NwDYOnV1dIgRfPn7TGfgYGEM\u002BAl41Tq82j7TsvIyM3K4OBi6GwgSAbF\u002Bcktc7Jn3RSGCXFmN2dfDAFHX1dDSUMxNiYQ1mYhfmBPAXPvLSiRAVnRwUDUwM5cV4jIwMjA2MjQ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JF051D3Hpmx624xCu2tey1d/T/rHydnNvmBz2/G3pizre6QdjO5q3VkrcIOtp7wqLXbi1a16MWsfyS7zeBU18aTf1xbrkDNPNNa/2nlN8sGDlwL1rqfyN8x8dM5A\u002B\u002BK7n6bbt6qbfIzpLP55ReqnwFvL2xMMW\u002Bbor2ZZUSu/y\u002BWn5\u002Bp32qm12hdbbsb\u002BXvOpcUPF2ec7zvA8jDPVZDdWklyzqHKnocWSCZoF27syT7K82nLh4QpW5YcVaTYhZnWsR35WKz1kfenDdaiNcVrm6wupNtoTN/kBAFBLAwQUAAAACACLVVhUn0EdYgUBAAAAAQAAFAAAAHNoYTUxMl9zaWduYXR1cmUuYmluAQAB//6BQO2NdjZ3hbdtJsy0fMULni1qDWx2FnYsdLnlRw3eAWupkcil1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAi1VYVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAi1VYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACACLVVhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" - }, - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", - "RequestMethod": "PUT", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "2034", - "Content-Type": "application/octet-stream", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-373b720a3874d64aa1ca643c5a057103-78725be545ff4c48-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "89aec45643fcf120338de5b0c8b16c5e", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "UEsDBBQAAAAIAItVWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuRuU7HEflz7mCal7qU1S\u002BiRYzivoz/swo8qZ1qPxbjajq\u002BW6iyne/RZUHAFBLAwQUAAAACACLVVhUkOkj81gEAAD3BgAACgAAAHNpZ25lci5kZXIzaGL7bNDEensBMxMjE5NwDYOnV1dIgRfPn7TGfgYGEM\u002BAl41Tq82j7TsvIyM3K4OBi6GwgSAbF\u002Bcktc7Jn3RSGCXFmN2dfDAFHX1dDSUMxNiYQ1mYhfmBPAXPvLSiRAVnRwUDUwM5cV4jIwMjA2MjQ2MLQ/MoINfYwNDIEso1UDVUNlCE6JUqKEjVK0gtKs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djO5q3VkrcIOtp7wqLXbi1a16MWsfyS7zeBU18aTf1xbrkDNPNNa/2nlN8sGDlwL1rqfyN8x8dM5A\u002B\u002BK7n6bbt6qbfIzpLP55ReqnwFvL2xMMW\u002Bbor2ZZUSu/y\u002BWn5\u002Bp32qm12hdbbsb\u002BXvOpcUPF2ec7zvA8jDPVZDdWklyzqHKnocWSCZoF27syT7K82nLh4QpW5YcVaTYhZnWsR35WKz1kfenDdaiNcVrm6wupNtoTN/kBAFBLAwQUAAAACACLVVhUn0EdYgUBAAAAAQAAFAAAAHNoYTUxMl9zaWduYXR1cmUuYmluAQAB//6BQO2NdjZ3hbdtJsy0fMULni1qDWx2FnYsdLnlRw3eAWupkcil1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAi1VYVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAi1VYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACACLVVhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA", - "StatusCode": 204, - "ResponseHeaders": { - "Cache-Control": "no-store, must-revalidate, no-cache", - "Date": "Thu, 24 Feb 2022 18:44:25 GMT", - "Expires": "0", - "Pragma": "no-cache", - "Server": "Kestrel", - "Timing-Allow-Origin": "*" - }, - "ResponseBody": null - }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-83a741c7f3ea664187d4b17456f37d7c-174b08a00c980848-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "edaa8eae0478b8fadd3ac0c5aaa86c87", + "traceparent": "00-74749ac3d41b024991fb21245908247f-d32ffa5cb265514c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "61c97dc14b8c4f469f9efb1b0f6368a5", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 204, "ResponseHeaders": { "Cache-Control": "no-store, must-revalidate, no-cache", - "Date": "Thu, 24 Feb 2022 18:44:27 GMT", + "Date": "Mon, 28 Feb 2022 21:09:41 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", @@ -158,9 +106,9 @@ "ResponseBody": null } ], - "Variables": { - "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "526433004" - } + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1226419524" + } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json index b6c8d1d8e34d..57326272c468 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json @@ -6,9 +6,9 @@ "RequestHeaders": { "Accept": "application/octet-stream, application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-ace75e2e739bd04199e05579a3a17263-6d9d2dfb806b7d47-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "b2e9eda6779440a0e7d3ecd88d0a9561", + "traceparent": "00-f44aa3a75a55ea47acde856e8af500d0-f95fde46c6c86b48-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "b74f3ace4ca85044096dd89db2978238", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -18,9 +18,9 @@ "Content-Disposition": "attachment; filename=model.vw; filename*=UTF-8\u0027\u0027model.vw", "Content-Length": "0", "Content-Type": "application/octet-stream", - "Date": "Thu, 24 Feb 2022 18:52:45 GMT", + "Date": "Mon, 28 Feb 2022 21:10:14 GMT", "Expires": "0", - "Last-Modified": "Thu, 24 Feb 2022 18:52:41 GMT", + "Last-Modified": "Mon, 28 Feb 2022 21:10:11 GMT", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" @@ -33,9 +33,9 @@ "RequestHeaders": { "Accept": "application/octet-stream, application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-4295e737ca458f47b75b1371bb153af6-9ccc0dc351f4b243-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "31b72bb2a35b3fcca2b5b686bf5b32c2", + "traceparent": "00-97fe88c574cb3a4d9cae0f435cc2a712-33da40ca59befd41-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "cfe5a7dc035d2ce04fec99d8b26f2479", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -45,14 +45,14 @@ "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", "Content-Length": "2034", "Content-Type": "application/octet-stream", - "Date": "Thu, 24 Feb 2022 18:53:14 GMT", + "Date": "Mon, 28 Feb 2022 21:10:42 GMT", "Expires": "0", "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", "Pragma": "no-cache", "Server": "Kestrel", "Timing-Allow-Origin": "*" }, - "ResponseBody": "UEsDBBQAAAAIAKdWWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuRuU7HEflz7mCal7qU1S\u002BiRYzivoz/swo8qZ1qPxbjajq\u002BW6iyne/RZUHAFBLAwQUAAAACACnVlhUkOkj81gEAAD3BgAACgAAAHNpZ25lci5kZXIzaGL7bNDEensBMxMjE5NwDYOnV1dIgRfPn7TGfgYGEM\u002BAl41Tq82j7TsvI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Kz1kfenDdaiNcVrm6wupNtoTN/kBAFBLAwQUAAAACABVaVxUn0EdYgUBAAAAAQAAFAAAAHNoYTUxMl9zaWduYXR1cmUuYmluAQAB//6BQO2NdjZ3hbdtJsy0fMULni1qDWx2FnYsdLnlRw3eAWupkcil1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAVWlcVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAVWlcVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACABVaVxUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model/properties", @@ -60,9 +60,9 @@ "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-ab3ee20089216843a518ec74ae0a6a27-6a78d4ad0584ec46-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "2d9c5821d2d370c520cc39ffcb6ae96a", + "traceparent": "00-1358f80d5db26d43906b3f4a83a83bd2-3854a508a2914d47-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "fa513805ab07243ef82440b8accb4eee", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -71,7 +71,7 @@ "Cache-Control": "no-store, must-revalidate, no-cache", "Content-Length": "103", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 24 Feb 2022 18:53:15 GMT", + "Date": "Mon, 28 Feb 2022 21:10:43 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", @@ -79,77 +79,25 @@ }, "ResponseBody": { "creationTime": "2021-04-19T22:17:21\u002B00:00", - "lastModifiedTime": "2022-02-24T18:52:41\u002B00:00" + "lastModifiedTime": "2022-02-28T21:10:11\u002B00:00" } }, - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model?signed=true", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/octet-stream, application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-a51b50bbdceea344b4c9172b06575de5-43ae872a3256dc4f-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "95b770c5b696024e20aa10dfc019818b", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "Cache-Control": "no-store, must-revalidate, no-cache", - "Content-Disposition": "attachment; filename=model.vw.zip; filename*=UTF-8\u0027\u0027model.vw.zip", - "Content-Length": "2034", - "Content-Type": "application/octet-stream", - "Date": "Thu, 24 Feb 2022 18:53:43 GMT", - "Expires": "0", - "Last-Modified": "Fri, 03 Dec 2021 17:47:01 GMT", - "Pragma": "no-cache", - "Server": "Kestrel", - "Timing-Allow-Origin": "*" - }, - "ResponseBody": "UEsDBBQAAAAIALZWWFTd/3iuTwEAAK0CAAA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R1cmUuYmluAQAB//6BQO2NdjZ3hbdtJsy0fMULni1qDWx2FnYsdLnlRw3eAWupkcil1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAtlZYVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAtlZYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACAC2VlhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" - }, - { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", - "RequestMethod": "PUT", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "2034", - "Content-Type": "application/octet-stream", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-06399e2f872830499e71903e2c48e906-e5ad73ca8d76aa46-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "34b72aa1676ee08d6647118f69cc7337", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "UEsDBBQAAAAIALZWWFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\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ni1qDWx2FnYsdLnlRw3eAWupkcil1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAtlZYVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAtlZYVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACAC2VlhUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA", - "StatusCode": 204, - "ResponseHeaders": { - "Cache-Control": "no-store, must-revalidate, no-cache", - "Date": "Thu, 24 Feb 2022 18:53:46 GMT", - "Expires": "0", - "Pragma": "no-cache", - "Server": "Kestrel", - "Timing-Allow-Origin": "*" - }, - "ResponseBody": null - }, { "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/model", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-0645f4a43e643b4a83d50040463e4162-db13ea0e30ff7046-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220224.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )", - "x-ms-client-request-id": "4ec04bcc9ca36b2c0a990c29c2e6af06", + "traceparent": "00-f6726f8ca742154ab4451d75213f642a-1c2988bed692b147-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20220228.1 (.NET Core 3.1.22; Microsoft Windows 10.0.19044)", + "x-ms-client-request-id": "31ad3da58269cb33592368bbb36c9e9a", "x-ms-return-client-request-id": "true" }, "RequestBody": null, "StatusCode": 204, "ResponseHeaders": { "Cache-Control": "no-store, must-revalidate, no-cache", - "Date": "Thu, 24 Feb 2022 18:53:48 GMT", + "Date": "Mon, 28 Feb 2022 21:10:45 GMT", "Expires": "0", "Pragma": "no-cache", "Server": "Kestrel", @@ -158,9 +106,9 @@ "ResponseBody": null } ], - "Variables": { - "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", - "RandomSeed": "712314448" - } + "Variables": { + "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/", + "RandomSeed": "1111349223" + } }