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..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,20 +13,22 @@ 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 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(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 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; } @@ -64,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 useLocalInference = false, float subsampleRate = 1f) { } public enum ServiceVersion { - V1_1_preview_1 = 1, + V1_1_preview_3 = 1, } } public partial class PersonalizerCreateEvaluationOperation : Azure.Operation 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..8143d322bda0 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 @@ -32,6 +32,8 @@ + + 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 8fa9cdc7fb79..0de6f0376573 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) { @@ -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/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..bfa9a6de6ccb 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs @@ -36,6 +36,7 @@ internal PersonalizerRankResult(IReadOnlyList ranking, /// The calculated ranking for the current request. 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/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 deleted file mode 100644 index 87b0f06f7775..000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/MultiSlotClient.cs +++ /dev/null @@ -1,119 +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; - -namespace Azure.AI.Personalizer -{ - /// The MultiSlot service client. - internal partial class MultiSlotClient - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - 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 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 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/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/RankClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs deleted file mode 100644 index 956b7ff668de..000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs +++ /dev/null @@ -1,119 +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; - -namespace Azure.AI.Personalizer -{ - /// The Rank service client. - internal partial class RankClient - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - 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 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 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 - { - 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/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/ActionProbabilityWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs new file mode 100644 index 000000000000..2a6fc2321b28 --- /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 + internal 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 new file mode 100644 index 000000000000..87f4567390f8 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs @@ -0,0 +1,80 @@ +// 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. + internal 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, 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); + }).ToList(); + this.Slots = rankRequest.Slots? + .Select( + slot => new DecisionContextDocument(null, null, slot.Id, serializeFeatures(slotIdToFeatures[slot.Id])) + ).ToList(); + } + + /// Properties from url + [JsonPropertyName("FromUrl")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonConverter(typeof(JsonRawStringListConverter))] + public List ContextFeatures { get; } + + /// Properties of documents + [JsonPropertyName("_multi")] + public IList Documents { get; } + + /// Properties of slots + [JsonPropertyName("_slots")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public IList Slots { get; } + + private static 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 new file mode 100644 index 000000000000..4a4d7e404e39 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs @@ -0,0 +1,55 @@ +// 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. + internal class DecisionContextDocument + { + /// Initializes a new instance of DecisionContextDocument. + /// Id of the decision context document + /// The json list of action features + /// The slot Id + /// The json list of slot features + public DecisionContextDocument(string id, List actionFeatures, string slotId, List slotFeatures) + { + Id = id; + ActionFeatures = actionFeatures; + SlotId = slotId; + SlotFeatures = slotFeatures; + } + + /// + /// Supply _tag for online evaluation + /// + [JsonPropertyName("_tag")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string Id { get; } + + /// + /// A list of generic action feature jsons. + /// + [JsonPropertyName("j")] + [JsonConverter(typeof(JsonRawStringListConverter))] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public List ActionFeatures { get; } + + /// + /// Slot ID. + /// + [JsonPropertyName("_id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string SlotId { get; } + + /// + /// A list of generic slot feature jsons. + /// + [JsonPropertyName("sj")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonConverter(typeof(JsonRawStringListConverter))] + 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 new file mode 100644 index 000000000000..50d709ff3fcc --- /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 + internal 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/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/LiveModelAdapter.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs new file mode 100644 index 000000000000..120ef15b56d1 --- /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 + internal class LiveModelAdapter : LiveModelBase + { + private readonly LiveModel liveModel; + + /// Initializes a new instance of LiveModelAdapter. + internal LiveModelAdapter(LiveModel liveModel) + { + this.liveModel = liveModel ?? throw new ArgumentNullException(nameof(liveModel)); + } + + /// Init LiveModel + public override void Init() + { + liveModel.Init(); + } + + /// Wrapper method of ChooseRank + public override RankingResponseWrapper ChooseRank(string eventId, string contextJson, ActionFlags actionFlags) + { + RankingResponse rankingResponse = liveModel.ChooseRank(eventId, contextJson, actionFlags); + RankingResponseWrapper rankingResponseWrapper = rankingResponse == null ? null : new RankingResponseWrapper(rankingResponse); + + return rankingResponseWrapper; + } + + /// Wrapper method of RequestMultiSlotDecisionDetailed + 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); + return multiSlotResponseDetailedWrapper; + } + + /// Wrapper method of QueueOutcomeEvent + public override void QueueOutcomeEvent(string eventId, float outcome) + { + liveModel.QueueOutcomeEvent(eventId, outcome); + } + + /// Wrapper method of RequestMultiSlotDecisionDetailed + public override void QueueOutcomeEvent(string eventId, string slotId, float outcome) + { + liveModel.QueueOutcomeEvent(eventId, slotId, outcome); + } + + /// Wrapper method of QueueActionTakenEvent + 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/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/MultiSlotResponseDetailedWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs new file mode 100644 index 000000000000..5dab77a6c28b --- /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 + internal 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 SlotRankingWrapper(enu.Current); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerAdministrationClient.cs index 07ad969801e5..1d00e14014c2 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; @@ -270,15 +270,17 @@ public virtual Response ApplyPersonalizerEvaluation(PersonalizerPolicyReferenceO } } - /// 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 async Task> GetPersonalizerModelAsync(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 { - return await ModelRestClient.GetAsync(cancellationToken).ConfigureAwait(false); + return await ModelRestClient.GetAsync(isSigned, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -287,15 +289,53 @@ public virtual async Task> GetPersonalizerModelAsync(Cancellati } } - /// 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(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 { - 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 ImportPersonalizerSignedModelAsync(Stream modelBody, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerSignedModel"); + scope.Start(); + try + { + return await ModelRestClient.ImportAsync(modelBody, 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 ImportPersonalizerSignedModel(Stream modelBody, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.ImportPersonalizerSignedModel"); + scope.Start(); + try + { + return ModelRestClient.Import(modelBody, 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 94d1ad144b2c..4f207a44524e 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -3,10 +3,12 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; +using Rl.Net; namespace Azure.AI.Personalizer { @@ -14,12 +16,27 @@ namespace Azure.AI.Personalizer /// public class PersonalizerClient { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; + private readonly ClientDiagnostics clientDiagnostics; + private readonly HttpPipeline pipeline; + private readonly bool useLocalInference; + private string stringEndpoint; + 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 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; } /// Initializes a new instance of Personalizer Client for mocking. protected PersonalizerClient() @@ -42,20 +59,30 @@ 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)); - 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 = 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); + tokenCredential = credential; + + this.useLocalInference = options.UseLocalInference; + if (useLocalInference) + { + validateAndAssignSampleRate(options.SubsampleRate); + //lazy load Rankprocessor + rlNetProcessor = new Lazy(() => GetConfigurationForRankProcessor()); + } } /// 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. @@ -71,21 +98,31 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali { throw new ArgumentNullException(nameof(credential)); } - options ??= new PersonalizerClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - _pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key")); - 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 = 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); + azureKeyCredential = credential; + + this.useLocalInference = options.UseLocalInference; + if (useLocalInference) + { + validateAndAssignSampleRate(options.SubsampleRate); + //lazy load Rankprocessor + rlNetProcessor = new Lazy(() => GetConfigurationForRankProcessor()); + } } /// 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. @@ -94,12 +131,12 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential): this(end 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. @@ -107,11 +144,19 @@ 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 { - return await RankRestClient.RankAsync(options, cancellationToken).ConfigureAwait(false); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Rank(options); + } + else + { + return await RankRestClient.RankAsync(options, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -150,11 +195,19 @@ 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 { - return RankRestClient.Rank(options, cancellationToken); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Rank(options); + } + else + { + return RankRestClient.Rank(options, cancellationToken); + } } catch (Exception e) { @@ -193,11 +246,19 @@ 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 { - return await MultiSlotRestClient.RankAsync(options, cancellationToken).ConfigureAwait(false); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Rank(options); + } + else + { + return await MultiSlotRestClient.RankAsync(options, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -243,11 +304,19 @@ 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 { - return MultiSlotRestClient.Rank(options, cancellationToken); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Rank(options); + } + else + { + return MultiSlotRestClient.Rank(options, cancellationToken); + } } catch (Exception e) { @@ -294,12 +363,20 @@ 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); - return await EventsRestClient.RewardAsync(eventId, rewardOptions, cancellationToken).ConfigureAwait(false); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Reward(eventId, reward); + } + else + { + return await EventsRestClient.RewardAsync(eventId, rewardOptions, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -314,12 +391,20 @@ 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 { - PersonalizerRewardOptions rewardOptions = new PersonalizerRewardOptions(reward); - return EventsRestClient.Reward(eventId, rewardOptions, cancellationToken); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Reward(eventId, reward); + } + else + { + PersonalizerRewardOptions rewardOptions = new PersonalizerRewardOptions(reward); + return EventsRestClient.Reward(eventId, rewardOptions, cancellationToken); + } } catch (Exception e) { @@ -334,11 +419,19 @@ 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 { - return await MultiSlotEventsRestClient.RewardAsync(eventId, options, cancellationToken).ConfigureAwait(false); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.RewardMultiSlot(eventId, options.Reward); + } + else + { + return await MultiSlotEventsRestClient.RewardAsync(eventId, options, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -364,11 +457,19 @@ 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 { - return MultiSlotEventsRestClient.Reward(eventId, options, cancellationToken); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.RewardMultiSlot(eventId, options.Reward); + } + else + { + return MultiSlotEventsRestClient.Reward(eventId, options, cancellationToken); + } } catch (Exception e) { @@ -393,11 +494,19 @@ 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 { - return await EventsRestClient.ActivateAsync(eventId, cancellationToken).ConfigureAwait(false); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Activate(eventId); + } + else + { + return await EventsRestClient.ActivateAsync(eventId, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -411,11 +520,19 @@ 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 { - return EventsRestClient.Activate(eventId, cancellationToken); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Activate(eventId); + } + else + { + return EventsRestClient.Activate(eventId, cancellationToken); + } } catch (Exception e) { @@ -429,11 +546,19 @@ 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 { - return await MultiSlotEventsRestClient.ActivateAsync(eventId, cancellationToken).ConfigureAwait(false); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Activate(eventId); + } + else + { + return await MultiSlotEventsRestClient.ActivateAsync(eventId, cancellationToken).ConfigureAwait(false); + } } catch (Exception e) { @@ -447,11 +572,19 @@ 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 { - return MultiSlotEventsRestClient.Activate(eventId, cancellationToken); + if (useLocalInference) + { + validateAndUpdateLiveModelConfig(); + return rlNetProcessor.Value.Activate(eventId); + } + else + { + return MultiSlotEventsRestClient.Activate(eventId, cancellationToken); + } } catch (Exception e) { @@ -459,5 +592,73 @@ public virtual Response ActivateMultiSlot(string eventId, CancellationToken canc throw; } } + + /// Gets the rank processor initiated with live model to use + internal virtual RlNetProcessor GetConfigurationForRankProcessor(CancellationToken cancellationToken = default) + { + Configuration config = new Configuration(); + // set up the model + if (azureKeyCredential != null) + { + config["http.api.key"] = azureKeyCredential.Key; + } + else if (tokenCredential != null) + { + 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; + } + 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.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.3/model"; + config["model.source"] = "HTTP_MODEL_DATA"; + + 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); + LiveModel liveModel = new LiveModel(config); + liveModel.Init(); + LiveModelBase liveModelAdapter = new LiveModelAdapter(liveModel); + liveModelLastRefresh = DateTimeOffset.UtcNow; + return new RlNetProcessor(liveModelAdapter); + } + + /// 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 + private void validateAndAssignSampleRate(float subsampleRate) + { + if (0 >= subsampleRate || subsampleRate > 1) + { + throw new ArgumentOutOfRangeException(nameof(subsampleRate), "Percentage should be between (0,1]"); + } + this.subsampleRate = subsampleRate; + } } } 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..42684fe0d00d 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 useLocalInference; + 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 useLocalInference = false, float subsampleRate = 1) { + this.useLocalInference = useLocalInference; + 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 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 939a97032509..0a4bdf4d801f 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 + /// + internal int Index { get; set; } } } 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 new file mode 100644 index 000000000000..d081fd900491 --- /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 + internal 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 new file mode 100644 index 000000000000..088f1eaca3c7 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs @@ -0,0 +1,142 @@ +// 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.Text.Json; +using Rl.Net; + +namespace Azure.AI.Personalizer +{ + /// The Rl.Net Processor. + internal class RlNetProcessor + { + private readonly LiveModelBase liveModel; + internal PolicyRestClient RestClient { get; } + + /// Initializes a new instance of RlNetProcessor. + public RlNetProcessor(LiveModelBase 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 + RankingResponseWrapper rankingResponseWrapper = liveModel.ChooseRank(eventId, contextJson, flags); + + // Convert response to PersonalizerRankResult + var value = RlObjectConverter.GenerateRankResult(originalActions, rankableActions, excludedActions, rankingResponseWrapper, options.EventId); + + 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 + MultiSlotResponseDetailedWrapper multiSlotResponseDetailedWrapper = liveModel.RequestMultiSlotDecisionDetailed(eventId, contextJson, flags, baselineActions); + + // Convert response to PersonalizerRankResult + var value = RlObjectConverter.GenerateMultiSlotRankResponse(options.Actions, multiSlotResponseDetailedWrapper, eventId); + + 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/src/Models/RlObjectConverter.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs new file mode 100644 index 000000000000..941bff7dcbea --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs @@ -0,0 +1,131 @@ +// 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; +using Azure.Core; + +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, + RankingResponseWrapper 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) + { + // excluded actions are not passed into VW + // rankedIndices[0] is the index of the VW chosen action (1 based index) + int chosenActionIndex = rankedIndices[0] - 1; + + // 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; + } + + // finalize decision response ranking + 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(rankings, eventId, rankableActions.ElementAt(chosenActionIndex)?.Id); + + return personalizerRankResult; + } + + public static PersonalizerMultiSlotRankResult GenerateMultiSlotRankResponse(IList actions, MultiSlotResponseDetailedWrapper 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/src/Models/SlotRankingWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingWrapper.cs new file mode 100644 index 000000000000..de48f5b3da27 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingWrapper.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.SlotRanking + internal class SlotRankingWrapper : IEnumerable + { + private readonly SlotRanking _slotRanking; + + /// Initializes a new instance of SlotRankingResponseWrapper. + public SlotRankingWrapper() + {} + + /// Initializes a new instance of SlotRankingResponseWrapper. + public SlotRankingWrapper(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/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/Azure.AI.Personalizer.Tests.csproj b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj index 67a686a2e33c..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 @@ -5,6 +5,9 @@ $(NoWarn);CS1591 + + + diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs index a27c34534ee9..bb157a39861e 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,14 +15,82 @@ 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; } } + + internal SlotRankingWrapperForTest(long actionIndex, string slotId, IEnumerable ranked) : base() + { + this.actionIndex = actionIndex; + this.slotId = slotId; + this.ranking = ranked; + } + + public override IEnumerator GetEnumerator() + { + return ranking.GetEnumerator(); + } + } + + internal class RankingResponseWrapperForTest : RankingResponseWrapper + { + private IEnumerable rank; + + public RankingResponseWrapperForTest(IEnumerable ranked) : base() + { + rank = ranked; + } + + public override IEnumerator GetEnumerator() + { + return rank.GetEnumerator(); + } + } + + internal 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. Matcher = new RecordMatcher(compareBodies: false); Sanitizer = new PersonalizerRecordedTestSanitizer(); } - protected async Task GetPersonalizerClientAsync(bool isSingleSlot = false) + 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; @@ -28,8 +100,26 @@ protected async Task GetPersonalizerClientAsync(bool isSingl await EnableMultiSlot(adminClient); } var credential = new AzureKeyCredential(apiKey); - var options = InstrumentClientOptions(new PersonalizerClientOptions()); - PersonalizerClient personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, options); + var options = InstrumentClientOptions(new PersonalizerClientOptions(useLocalInference: useLocalInference, subsampleRate: subsampleRate)); + PersonalizerClient personalizerClient = null; + if (useLocalInference) + { + 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, options: options); + } + } + else + { + personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, options); + } + personalizerClient = InstrumentClient(personalizerClient); return personalizerClient; } @@ -55,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 new file mode 100644 index 000000000000..3b7f67017837 --- /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.Count, 1); + 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/EventsTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/EventsTests.cs index bb096b6ec114..65345e6e2a19 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, useLocalInference: 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/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/ModelTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs index 646d939e34dc..fb059fff162d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/ModelTests.cs @@ -17,14 +17,28 @@ public ModelTests(bool isAsync) : base(isAsync) public async Task ModelTest() { PersonalizerAdministrationClient client = GetAdministrationClient(isSingleSlot: true); - await GetModel(client); + await ExportModel(false, client); + await ExportModel(true, client); await GetModelProperties(client); await ResetModel(client); } - private async Task GetModel(PersonalizerAdministrationClient client) + [Test] + public async Task ExportImportModelTest() + { + PersonalizerAdministrationClient client = GetAdministrationClient(isSingleSlot: true); + Response response = await ExportModel(true, client); + await ImportSignedModel(response.Value, client); + } + + private async Task> ExportModel(bool isSigned, PersonalizerAdministrationClient client) + { + return await client.ExportPersonalizerModelAsync(isSigned); + } + + private async Task ImportSignedModel(Stream modelBody, PersonalizerAdministrationClient client) { - await client.GetPersonalizerModelAsync(); + return await client.ImportPersonalizerSignedModelAsync(modelBody); } private async Task ResetModel(PersonalizerAdministrationClient client) diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs index a2cc0f39276b..a13102a8a96e 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/MultiSlotTests.cs @@ -1,8 +1,10 @@ // 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; using NUnit.Framework; namespace Azure.AI.Personalizer.Tests @@ -13,7 +15,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 +59,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 +77,20 @@ public MultiSlotTests(bool isAsync) : base(isAsync) public async Task MultiSlotTest() { PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: false); + await MultiSlotTestInner(client); + } + + [Test] + public async Task MultiSlotLocalInferenceTest() + { + 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); + } + + 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/PersonalizerClientForTest.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs new file mode 100644 index 000000000000..502e09df6a10 --- /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 useLocalInference, RlNetProcessor rlNetProcessor, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : + base(endpoint, credential, 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 259d24e9cdcc..f0ae8268d306 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; @@ -17,6 +18,20 @@ public RankTests(bool isAsync) : base(isAsync) public async Task SingleSlotRankTests() { PersonalizerClient client = await GetPersonalizerClientAsync(isSingleSlot: true); + await SingleSlotRankTests(client); + } + + [Test] + public async Task SingleSlotRankLocalInferenceTests() + { + 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); + } + + private async Task SingleSlotRankTests(PersonalizerClient client) + { await RankNullParameters(client); await RankServerFeatures(client); await RankNullParameters(client); @@ -31,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 new file mode 100644 index 000000000000..4ea12a539a24 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using NUnit.Framework; +using static Azure.AI.Personalizer.Tests.PersonalizerTestBase; + +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() + { + 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)); + } + + [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); + } + + [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; + } + } +} 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/SingleSlotEventsLocalInferenceTests.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json new file mode 100644 index 000000000000..1b0aa39ef532 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json @@ -0,0 +1,89 @@ +{ + "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" + } +} 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..1b0aa39ef532 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json @@ -0,0 +1,89 @@ +{ + "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" + } +} 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/ExportImportModelTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ExportImportModelTest.json new file mode 100644 index 000000000000..9169c085ea93 --- /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-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, + "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": "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": "UEsDBBQAAAAIACNpXFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuRuU7HEflz7mCal7qU1S\u002BiRYzivoz/swo8qZ1qPxbjajq\u002BW6iyne/RZUHAFBLAwQUAAAACAAjaVxUkOkj81gEAAD3BgAACgAAAHNpZ25lci5kZXIzaGL7bNDEensBMxMjE5NwDYOnV1dIgRfPn7TGfgYGEM\u002BAl41Tq82j7TsvIyM3K4OBi6GwgSAbF\u002Bcktc7Jn3RSGCXFmN2dfDAFHX1dDSUMxNiYQ1mYhfmBPAXPvLSiRAVnRwUDUwM5cV4jIwMjA2MjQ2MLQ/MoINfYwNDIEso1UDVUNlCE6JUqKEjVK0gtKs7PS8zJrEot0kusKi1K1UvOzzVoYlRCdh8jKwNzEyM/A1Cci6mJkZFhz\u002BJ/q\u002BvXcTRdLbf4z9MSV/Zzc27O5BvWmf81WK9VMdlxlHudayl6t01kVafLSZXjYW2Md9vfBCTLJabtU1\u002Bes\u002BDsv8pvW4JE5DrO35m7iVvu5v3VAp/fbJU1rrQpKvS0bLI6\u002BmeJAyvbpwV/whglvibc89VZvCO0r8Qr3cvl5eFHtywby18vPRnT\u002BNV89n6NA\u002BEXXx9\u002BklIvylOovE0lTPCt0crCdwdvrb52eZvclAp1lWfRprc9ymLUZrkdnNcxw64i\u002BGD49IX/TbZ9ltr9J6FRRFjrro513p5OwYbzBreq5Ftbpqj7ZR1aJx6d\u002BdpkonP2Z96fDwM2n/67dK2VbEVXOb991/Ffand7\u002BS8yMTMyMC5uYv5t0MT83YAPGKCy/IyM/1lYmJlYFxjIgviqLGIGImwc2myMrKzszIxwFpOBKkhakEXOQKYJXxyATeFjEWMRURbdWJ68xuqDpDXTlLfPOOIPxd\u002BbYyAPklZmASaFBpGqa5KtGpU5hWVyCT8\u002Be79fxOokJguMKzWQEnmWJkYQRxKIRRc0MQoCMW\u002BbfUZJSYGVvn5yUY5ebmZyUX5xfloJyFr9guzMTFCC0ncO8tEHJi9VIwNwAgPSzo5AwsBUD6ipzRBhgKFeYm6qXnpSDohDnBYj0rUYk67FhDgtwIA5DYseRkZgcO0Fiuw0SIaJGTC1hRMRXKlFJcX6zv6GAd6enn4hzo4GhnpAK/WAmTgel9UlBsFIlrhjC9LEzERqGYoIdCoaiogWKhpqQpGhtmycQENZGJvMRdlZDAz02NRgXI62CY95W65uqWj52G3XOvuu2Lm5Qo0JTV\u002B/aTd/uqjAxJjCxMhloI7QzsUiZSBhwIXIxUhsJrQCnBlULnrO4zFcdcr1ywy21R/PR5xeo/vf50Zv91TnjUzOWx52NS/eXsVuXRo8w51RumKr6rH2pNSn0k8mJF051D3Hpmx624xCu2tey1d/T/rHydnNvmBz2/G3pizre6QdjO5q3VkrcIOtp7wqLXbi1a16MWsfyS7zeBU18aTf1xbrkDNPNNa/2nlN8sGDlwL1rqfyN8x8dM5A\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", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "2034", + "Content-Type": "application/octet-stream", + "Ocp-Apim-Subscription-Key": "Sanitized", + "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": "UEsDBBQAAAAIACNpXFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuRuU7HEflz7mCal7qU1S\u002BiRYzivoz/swo8qZ1qPxbjajq\u002BW6iyne/RZUHAFBLAwQUAAAACAAjaVxUkOkj81gEAAD3BgAACgAAAHNpZ25lci5kZXIzaGL7bNDEensBMxMjE5NwDYOnV1dIgRfPn7TGfgYGEM\u002BAl41Tq82j7TsvIyM3K4OBi6GwgSAbF\u002Bcktc7Jn3RSGCXFmN2dfDAFHX1dDSUMxNiYQ1mYhfmBPAXPvLSiRAVnRwUDUwM5cV4jIwMjA2MjQ2MLQ/MoINfYwNDIEso1UDVUNlCE6JUqKEjVK0gtKs7PS8zJrEot0kusKi1K1UvOzzVoYlRCdh8jKwNzEyM/A1Cci6mJkZFhz\u002BJ/q\u002BvXcTRdLbf4z9MSV/Zzc27O5BvWmf81WK9VMdlxlHudayl6t01kVafLSZXjYW2Md9vfBCTLJabtU1\u002Bes\u002BDsv8pvW4JE5DrO35m7iVvu5v3VAp/fbJU1rrQpKvS0bLI6\u002BmeJAyvbpwV/whglvibc89VZvCO0r8Qr3cvl5eFHtywby18vPRnT\u002BNV89n6NA\u002BEXXx9\u002BklIvylOovE0lTPCt0crCdwdvrb52eZvclAp1lWfRprc9ymLUZrkdnNcxw64i\u002BGD49IX/TbZ9ltr9J6FRRFjrro513p5OwYbzBreq5Ftbpqj7ZR1aJx6d\u002BdpkonP2Z96fDwM2n/67dK2VbEVXOb991/Ffand7\u002BS8yMTMyMC5uYv5t0MT83YAPGKCy/IyM/1lYmJlYFxjIgviqLGIGImwc2myMrKzszIxwFpOBKkhakEXOQKYJXxyATeFjEWMRURbdWJ68xuqDpDXTlLfPOOIPxd\u002BbYyAPklZmASaFBpGqa5KtGpU5hWVyCT8\u002Be79fxOokJguMKzWQEnmWJkYQRxKIRRc0MQoCMW\u002BbfUZJSYGVvn5yUY5ebmZyUX5xfloJyFr9guzMTFCC0ncO8tEHJi9VIwNwAgPSzo5AwsBUD6ipzRBhgKFeYm6qXnpSDohDnBYj0rUYk67FhDgtwIA5DYseRkZgcO0Fiuw0SIaJGTC1hRMRXKlFJcX6zv6GAd6enn4hzo4GhnpAK/WAmTgel9UlBsFIlrhjC9LEzERqGYoIdCoaiogWKhpqQpGhtmycQENZGJvMRdlZDAz02NRgXI62CY95W65uqWj52G3XOvuu2Lm5Qo0JTV\u002B/aTd/uqjAxJjCxMhloI7QzsUiZSBhwIXIxUhsJrQCnBlULnrO4zFcdcr1ywy21R/PR5xeo/vf50Zv91TnjUzOWx52NS/eXsVuXRo8w51RumKr6rH2pNSn0k8mJF051D3Hpmx624xCu2tey1d/T/rHydnNvmBz2/G3pizre6QdjO5q3VkrcIOtp7wqLXbi1a16MWsfyS7zeBU18aTf1xbrkDNPNNa/2nlN8sGDlwL1rqfyN8x8dM5A\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", + "StatusCode": 204, + "ResponseHeaders": { + "Cache-Control": "no-store, must-revalidate, no-cache", + "Date": "Mon, 28 Feb 2022 21:09:10 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": "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 new file mode 100644 index 000000000000..6993e435a0ad --- /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-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, + "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": "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": "UEsDBBQAAAAIAEVpXFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuRuU7HEflz7mCal7qU1S\u002BiRYzivoz/swo8qZ1qPxbjajq\u002BW6iyne/RZUHAFBLAwQUAAAACABFaVxUkOkj81gEAAD3BgAACgAAAHNpZ25lci5kZXIzaGL7bNDEensBMxMjE5NwDYOnV1dIgRfPn7TGfgYGEM\u002BAl41Tq82j7TsvIyM3K4OBi6GwgSAbF\u002Bcktc7Jn3RSGCXFmN2dfDAFHX1dDSUMxNiYQ1mYhfmBPAXPvLSiRAVnRwUDUwM5cV4jIwMjA2MjQ2MLQ/MoINfYwNDIEso1UDVUNlCE6JUqKEjVK0gtKs7PS8zJrEot0kusKi1K1UvOzzVoYlRCdh8jKwNzEyM/A1Cci6mJkZFhz\u002BJ/q\u002BvXcTRdLbf4z9MSV/Zzc27O5BvWmf81WK9VMdlxlHudayl6t01kVafLSZXjYW2Md9vfBCTLJabtU1\u002Bes\u002BDsv8pvW4JE5DrO35m7iVvu5v3VAp/fbJU1rrQpKvS0bLI6\u002BmeJAyvbpwV/whglvibc89VZvCO0r8Qr3cvl5eFHtywby18vPRnT\u002BNV89n6NA\u002BEXXx9\u002BklIvylOovE0lTPCt0crCdwdvrb52eZvclAp1lWfRprc9ymLUZrkdnNcxw64i\u002BGD49IX/TbZ9ltr9J6FRRFjrro513p5OwYbzBreq5Ftbpqj7ZR1aJx6d\u002BdpkonP2Z96fDwM2n/67dK2VbEVXOb991/Ffand7\u002BS8yMTMyMC5uYv5t0MT83YAPGKCy/IyM/1lYmJlYFxjIgviqLGIGImwc2myMrKzszIxwFpOBKkhakEXOQKYJXxyATeFjEWMRURbdWJ68xuqDpDXTlLfPOOIPxd\u002BbYyAPklZmASaFBpGqa5KtGpU5hWVyCT8\u002Be79fxOokJguMKzWQEnmWJkYQRxKIRRc0MQoCMW\u002BbfUZJSYGVvn5yUY5ebmZyUX5xfloJyFr9guzMTFCC0ncO8tEHJi9VIwNwAgPSzo5AwsBUD6ipzRBhgKFeYm6qXnpSDohDnBYj0rUYk67FhDgtwIA5DYseRkZgcO0Fiuw0SIaJGTC1hRMRXKlFJcX6zv6GAd6enn4hzo4GhnpAK/WAmTgel9UlBsFIlrhjC9LEzERqGYoIdCoaiogWKhpqQpGhtmycQENZGJvMRdlZDAz02NRgXI62CY95W65uqWj52G3XOvuu2Lm5Qo0JTV\u002B/aTd/uqjAxJjCxMhloI7QzsUiZSBhwIXIxUhsJrQCnBlULnrO4zFcdcr1ywy21R/PR5xeo/vf50Zv91TnjUzOWx52NS/eXsVuXRo8w51RumKr6rH2pNSn0k8mJF051D3Hpmx624xCu2tey1d/T/rHydnNvmBz2/G3pizre6QdjO5q3VkrcIOtp7wqLXbi1a16MWsfyS7zeBU18aTf1xbrkDNPNNa/2nlN8sGDlwL1rqfyN8x8dM5A\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" + }, + { + "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-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": "UEsDBBQAAAAIAEVpXFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuRuU7HEflz7mCal7qU1S\u002BiRYzivoz/swo8qZ1qPxbjajq\u002BW6iyne/RZUHAFBLAwQUAAAACABFaVxUkOkj81gEAAD3BgAACgAAAHNpZ25lci5kZXIzaGL7bNDEensBMxMjE5NwDYOnV1dIgRfPn7TGfgYGEM\u002BAl41Tq82j7TsvIyM3K4OBi6GwgSAbF\u002Bcktc7Jn3RSGCXFmN2dfDAFHX1dDSUMxNiYQ1mYhfmBPAXPvLSiRAVnRwUDUwM5cV4jIwMjA2MjQ2MLQ/MoINfYwNDIEso1UDVUNlCE6JUqKEjVK0gtKs7PS8zJrEot0kusKi1K1UvOzzVoYlRCdh8jKwNzEyM/A1Cci6mJkZFhz\u002BJ/q\u002BvXcTRdLbf4z9MSV/Zzc27O5BvWmf81WK9VMdlxlHudayl6t01kVafLSZXjYW2Md9vfBCTLJabtU1\u002Bes\u002BDsv8pvW4JE5DrO35m7iVvu5v3VAp/fbJU1rrQpKvS0bLI6\u002BmeJAyvbpwV/whglvibc89VZvCO0r8Qr3cvl5eFHtywby18vPRnT\u002BNV89n6NA\u002BEXXx9\u002BklIvylOovE0lTPCt0crCdwdvrb52eZvclAp1lWfRprc9ymLUZrkdnNcxw64i\u002BGD49IX/TbZ9ltr9J6FRRFjrro513p5OwYbzBreq5Ftbpqj7ZR1aJx6d\u002BdpkonP2Z96fDwM2n/67dK2VbEVXOb991/Ffand7\u002BS8yMTMyMC5uYv5t0MT83YAPGKCy/IyM/1lYmJlYFxjIgviqLGIGImwc2myMrKzszIxwFpOBKkhakEXOQKYJXxyATeFjEWMRURbdWJ68xuqDpDXTlLfPOOIPxd\u002BbYyAPklZmASaFBpGqa5KtGpU5hWVyCT8\u002Be79fxOokJguMKzWQEnmWJkYQRxKIRRc0MQoCMW\u002BbfUZJSYGVvn5yUY5ebmZyUX5xfloJyFr9guzMTFCC0ncO8tEHJi9VIwNwAgPSzo5AwsBUD6ipzRBhgKFeYm6qXnpSDohDnBYj0rUYk67FhDgtwIA5DYseRkZgcO0Fiuw0SIaJGTC1hRMRXKlFJcX6zv6GAd6enn4hzo4GhnpAK/WAmTgel9UlBsFIlrhjC9LEzERqGYoIdCoaiogWKhpqQpGhtmycQENZGJvMRdlZDAz02NRgXI62CY95W65uqWj52G3XOvuu2Lm5Qo0JTV\u002B/aTd/uqjAxJjCxMhloI7QzsUiZSBhwIXIxUhsJrQCnBlULnrO4zFcdcr1ywy21R/PR5xeo/vf50Zv91TnjUzOWx52NS/eXsVuXRo8w51RumKr6rH2pNSn0k8mJF051D3Hpmx624xCu2tey1d/T/rHydnNvmBz2/G3pizre6QdjO5q3VkrcIOtp7wqLXbi1a16MWsfyS7zeBU18aTf1xbrkDNPNNa/2nlN8sGDlwL1rqfyN8x8dM5A\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": "Mon, 28 Feb 2022 21:10:13 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": "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 e24d272911f6..6cc6f6f2020d 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,114 @@ { "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-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, "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": "Mon, 28 Feb 2022 21:09:10 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": "Mon, 28 Feb 2022 21:09:07 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?signed=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/octet-stream, application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "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, + "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": "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": "UEsDBBQAAAAIADNpXFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuRuU7HEflz7mCal7qU1S\u002BiRYzivoz/swo8qZ1qPxbjajq\u002BW6iyne/RZUHAFBLAwQUAAAACAAzaVxUkOkj81gEAAD3BgAACgAAAHNpZ25lci5kZXIzaGL7bNDEensBMxMjE5NwDYOnV1dIgRfPn7TGfgYGEM\u002BAl41Tq82j7TsvIyM3K4OBi6GwgSAbF\u002Bcktc7Jn3RSGCXFmN2dfDAFHX1dDSUMxNiYQ1mYhfmBPAXPvLSiRAVnRwUDUwM5cV4jIwMjA2MjQ2MLQ/MoINfYwNDIEso1UDVUNlCE6JUqKEjVK0gtKs7PS8zJrEot0kusKi1K1UvOzzVoYlRCdh8jKwNzEyM/A1Cci6mJkZFhz\u002BJ/q\u002BvXcTRdLbf4z9MSV/Zzc27O5BvWmf81WK9VMdlxlHudayl6t01kVafLSZXjYW2Md9vfBCTLJabtU1\u002Bes\u002BDsv8pvW4JE5DrO35m7iVvu5v3VAp/fbJU1rrQpKvS0bLI6\u002BmeJAyvbpwV/whglvibc89VZvCO0r8Qr3cvl5eFHtywby18vPRnT\u002BNV89n6NA\u002BEXXx9\u002BklIvylOovE0lTPCt0crCdwdvrb52eZvclAp1lWfRprc9ymLUZrkdnNcxw64i\u002BGD49IX/TbZ9ltr9J6FRRFjrro513p5OwYbzBreq5Ftbpqj7ZR1aJx6d\u002BdpkonP2Z96fDwM2n/67dK2VbEVXOb991/Ffand7\u002BS8yMTMyMC5uYv5t0MT83YAPGKCy/IyM/1lYmJlYFxjIgviqLGIGImwc2myMrKzszIxwFpOBKkhakEXOQKYJXxyATeFjEWMRURbdWJ68xuqDpDXTlLfPOOIPxd\u002BbYyAPklZmASaFBpGqa5KtGpU5hWVyCT8\u002Be79fxOokJguMKzWQEnmWJkYQRxKIRRc0MQoCMW\u002BbfUZJSYGVvn5yUY5ebmZyUX5xfloJyFr9guzMTFCC0ncO8tEHJi9VIwNwAgPSzo5AwsBUD6ipzRBhgKFeYm6qXnpSDohDnBYj0rUYk67FhDgtwIA5DYseRkZgcO0Fiuw0SIaJGTC1hRMRXKlFJcX6zv6GAd6enn4hzo4GhnpAK/WAmTgel9UlBsFIlrhjC9LEzERqGYoIdCoaiogWKhpqQpGhtmycQENZGJvMRdlZDAz02NRgXI62CY95W65uqWj52G3XOvuu2Lm5Qo0JTV\u002B/aTd/uqjAxJjCxMhloI7QzsUiZSBhwIXIxUhsJrQCnBlULnrO4zFcdcr1ywy21R/PR5xeo/vf50Zv91TnjUzOWx52NS/eXsVuXRo8w51RumKr6rH2pNSn0k8mJF051D3Hpmx624xCu2tey1d/T/rHydnNvmBz2/G3pizre6QdjO5q3VkrcIOtp7wqLXbi1a16MWsfyS7zeBU18aTf1xbrkDNPNNa/2nlN8sGDlwL1rqfyN8x8dM5A\u002B\u002BK7n6bbt6qbfIzpLP55ReqnwFvL2xMMW\u002Bbor2ZZUSu/y\u002BWn5\u002Bp32qm12hdbbsb\u002BXvOpcUPF2ec7zvA8jDPVZDdWklyzqHKnocWSCZoF27syT7K82nLh4QpW5YcVaTYhZnWsR35WKz1kfenDdaiNcVrm6wupNtoTN/kBAFBLAwQUAAAACAAzaVxUn0EdYgUBAAAAAQAAFAAAAHNoYTUxMl9zaWduYXR1cmUuYmluAQAB//6BQO2NdjZ3hbdtJsy0fMULni1qDWx2FnYsdLnlRw3eAWupkcil1ZcPgXKq7\u002B/t\u002Bi0g8WoXY8\u002BjEvfHUfY/J3bRQXmrI9rRZj0uUmaWq6uDEZvAMUXnFh1GldBaGLhFbsdE0YR2lDlSF\u002BZZh9Fp8wjTmznR1GwTjiEkTxybt8UeILkUbDma/03v2EJ3DZjvP/UZNVS/OPiNnfzT13iOwcDK0iKDNV1mnBUrsyOG3GL6d\u002BLExbQi9tcQUN4zobG\u002BACptlwXrSa32/hQKoP5YNrlSl3EzGBk3DB2V4aR53w6H/oPtu3PPcLmTjroMI9sPJBV8aGcD14s5JryVdjHh/tSIUEsBAhQAFAAAAAgAM2lcVN3/eK5PAQAArQIAAAgAAAAAAAAAAAAAAAAAAAAAAG1vZGVsLnZ3UEsBAhQAFAAAAAgAM2lcVJDpI/NYBAAA9wYAAAoAAAAAAAAAAAAAAAAAdQEAAHNpZ25lci5kZXJQSwECFAAUAAAACAAzaVxUn0EdYgUBAAAAAQAAFAAAAAAAAAAAAAAAAAD1BQAAc2hhNTEyX3NpZ25hdHVyZS5iaW5QSwUGAAAAAAMAAwCwAAAALAcAAAAA" + }, + { + "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-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, "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": "Mon, 28 Feb 2022 21:09: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": "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" + "creationTime": "2021-04-19T22:17:21\u002B00:00", + "lastModifiedTime": "2022-02-28T21:09:07\u002B00:00" } }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/model", + "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-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": { - "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": "Mon, 28 Feb 2022 21:09:41 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": "1226419524" } -} \ 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..57326272c468 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,114 @@ { "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-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, "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": "Mon, 28 Feb 2022 21:10:14 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": "Mon, 28 Feb 2022 21:10:11 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?signed=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/octet-stream, application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "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, + "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": "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": "UEsDBBQAAAAIAFVpXFTd/3iuTwEAAK0CAAAIAAAAbW9kZWwudndjZ2BgsNAzNNQzYGAEMhly\u002Bb/V7wcxhEAEEigHYgVd3eSk\u002BMSUNAgjtaIgJ78oFSFQUlmQqpBbUgTiFecnJsbnAGVyS3NKMnMy81LhokWJedlATmpBcWZOfp6CgZ6RAQQYWVoYGBkbAeUKSxNTihJLMpMVrKwYWIBWhxnY9ZmoQpyS4QWhwQ5m\u002BPEl7NJsRkcwe9Yhh6kh\u002BxzX9W86wPBFLGXVheYDDAwNbjA/wdSgeY0BZrBEDMgqIGiwuBJ\u002BAqbugIMGxCaGJm8Ghq43LnsPMaS6AhXZW4Wg8k8lMzA4vj2854rhHRcQ/3AqqvyPQ6j8qMuo6ne\u002BQZWPOcqIwp/1gxFFvRYPE4PZm6N71px/C\u002BZftkXlxzkxoahvCkSVr05A5QuuRuU7HEflz7mCal7qU1S\u002BiRYzivoz/swo8qZ1qPxbjajq\u002BW6iyne/RZUHAFBLAwQUAAAACABVaVxUkOkj81gEAAD3BgAACgAAAHNpZ25lci5kZXIzaGL7bNDEensBMxMjE5NwDYOnV1dIgRfPn7TGfgYGEM\u002BAl41Tq82j7TsvIyM3K4OBi6GwgSAbF\u002Bcktc7Jn3RSGCXFmN2dfDAFHX1dDSUMxNiYQ1mYhfmBPAXPvLSiRAVnRwUDUwM5cV4jIwMjA2MjQ2MLQ/MoINfYwNDIEso1UDVUNlCE6JUqKEjVK0gtKs7PS8zJrEot0kusKi1K1UvOzzVoYlRCdh8jKwNzEyM/A1Cci6mJkZFhz\u002BJ/q\u002BvXcTRdLbf4z9MSV/Zzc27O5BvWmf81WK9VMdlxlHudayl6t01kVafLSZXjYW2Md9vfBCTLJabtU1\u002Bes\u002BDsv8pvW4JE5DrO35m7iVvu5v3VAp/fbJU1rrQpKvS0bLI6\u002BmeJAyvbpwV/whglvibc89VZvCO0r8Qr3cvl5eFHtywby18vPRnT\u002BNV89n6NA\u002BEXXx9\u002BklIvylOovE0lTPCt0crCdwdvrb52eZvclAp1lWfRprc9ymLUZrkdnNcxw64i\u002BGD49IX/TbZ9ltr9J6FRRFjrro513p5OwYbzBreq5Ftbpqj7ZR1aJx6d\u002BdpkonP2Z96fDwM2n/67dK2VbEVXOb991/Ffand7\u002BS8yMTMyMC5uYv5t0MT83YAPGKCy/IyM/1lYmJlYFxjIgviqLGIGImwc2myMrKzszIxwFpOBKkhakEXOQKYJXxyATeFjEWMRURbdWJ68xuqDpDXTlLfPOOIPxd\u002BbYyAPklZmASaFBpGqa5KtGpU5hWVyCT8\u002Be79fxOokJguMKzWQEnmWJkYQRxKIRRc0MQoCMW\u002BbfUZJSYGVvn5yUY5ebmZyUX5xfloJyFr9guzMTFCC0ncO8tEHJi9VIwNwAgPSzo5AwsBUD6ipzRBhgKFeYm6qXnpSDohDnBYj0rUYk67FhDgtwIA5DYseRkZgcO0Fiuw0SIaJGTC1hRMRXKlFJcX6zv6GAd6enn4hzo4GhnpAK/WAmTgel9UlBsFIlrhjC9LEzERqGYoIdCoaiogWKhpqQpGhtmycQENZGJvMRdlZDAz02NRgXI62CY95W65uqWj52G3XOvuu2Lm5Qo0JTV\u002B/aTd/uqjAxJjCxMhloI7QzsUiZSBhwIXIxUhsJrQCnBlULnrO4zFcdcr1ywy21R/PR5xeo/vf50Zv91TnjUzOWx52NS/eXsVuXRo8w51RumKr6rH2pNSn0k8mJF051D3Hpmx624xCu2tey1d/T/rHydnNvmBz2/G3pizre6QdjO5q3VkrcIOtp7wqLXbi1a16MWsfyS7zeBU18aTf1xbrkDNPNNa/2nlN8sGDlwL1rqfyN8x8dM5A\u002B\u002BK7n6bbt6qbfIzpLP55ReqnwFvL2xMMW\u002Bbor2ZZUSu/y\u002BWn5\u002Bp32qm12hdbbsb\u002BXvOpcUPF2ec7zvA8jDPVZDdWklyzqHKnocWSCZoF27syT7K82nLh4QpW5YcVaTYhZnWsR35WKz1kfenDdaiNcVrm6wupNtoTN/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", "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-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, "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": "Mon, 28 Feb 2022 21:10:43 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" + "creationTime": "2021-04-19T22:17:21\u002B00:00", + "lastModifiedTime": "2022-02-28T21:10:11\u002B00:00" } }, { - "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/model", + "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-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": { - "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": "Mon, 28 Feb 2022 21:10: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": "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": "1111349223" } -} \ 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 new file mode 100644 index 000000000000..7034d19d4afa --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json @@ -0,0 +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": "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", + "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/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" + } +} 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..7034d19d4afa --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json @@ -0,0 +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": "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", + "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/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" + } +} 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 new file mode 100644 index 000000000000..1b0aa39ef532 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json @@ -0,0 +1,89 @@ +{ + "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" + } +} 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..1b0aa39ef532 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json @@ -0,0 +1,89 @@ +{ + "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" + } +} 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",