diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs
index b191ad31ccdd..ded880bbd78f 100644
--- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs
+++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs
@@ -16,23 +16,27 @@ namespace Azure.AI.Personalizer
///
public class PersonalizerClient
{
- private readonly ClientDiagnostics _clientDiagnostics;
- private readonly HttpPipeline _pipeline;
- private readonly bool _isLocalInference;
+ private readonly ClientDiagnostics clientDiagnostics;
+ private readonly HttpPipeline pipeline;
+ private readonly bool isLocalInference;
private string stringEndpoint;
- private string apiKey;
+ private AzureKeyCredential azureKeyCredential;
+ private TokenCredential tokenCredential;
+ private int liveModelRefreshTimeInMinutes = 15;
+ private DateTimeOffset tokenExpiry;
+ private DateTimeOffset liveModelLastRefresh;
+ private string[] scopes = { "https://cognitiveservices.azure.com/.default" };
private float subsampleRate = 1.0f;
- private readonly RlNetProcessor _rlNetProcessor;
-
+ private Lazy rlNetProcessor;
internal RankRestClient RankRestClient { get; set; }
internal EventsRestClient EventsRestClient { get; set; }
internal MultiSlotRestClient MultiSlotRestClient { get; set; }
internal MultiSlotEventsRestClient MultiSlotEventsRestClient { get; set; }
internal ServiceConfigurationRestClient ServiceConfigurationRestClient { get; set; }
internal PolicyRestClient PolicyRestClient { get; set; }
- internal PersonalizerServiceProperties _personalizerServiceProperties { get; set; }
- internal PersonalizerPolicy _personalizerPolicy { get; set; }
+ internal PersonalizerServiceProperties personalizerServiceProperties { get; set; }
+ internal PersonalizerPolicy personalizerPolicy { get; set; }
/// Initializes a new instance of Personalizer Client for mocking.
protected PersonalizerClient()
@@ -55,16 +59,16 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer
}
options ??= new PersonalizerClientOptions();
- _clientDiagnostics = new ClientDiagnostics(options);
- string[] scopes = { "https://cognitiveservices.azure.com/.default" };
- _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes));
+ clientDiagnostics = new ClientDiagnostics(options);
+ pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes));
stringEndpoint = endpoint.AbsoluteUri;
- RankRestClient = new RankRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- EventsRestClient = new EventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- MultiSlotRestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- MultiSlotEventsRestClient = new MultiSlotEventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- ServiceConfigurationRestClient = new ServiceConfigurationRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- PolicyRestClient = new PolicyRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
+ RankRestClient = new RankRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ EventsRestClient = new EventsRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ MultiSlotRestClient = new MultiSlotRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ MultiSlotEventsRestClient = new MultiSlotEventsRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ ServiceConfigurationRestClient = new ServiceConfigurationRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ PolicyRestClient = new PolicyRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ tokenCredential = credential;
}
/// Initializes a new instance of PersonalizerClient.
@@ -76,16 +80,12 @@ public PersonalizerClient(Uri endpoint, TokenCredential credential, Personalizer
public PersonalizerClient(Uri endpoint, TokenCredential credential, bool isLocalInference, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) :
this(endpoint, credential, options)
{
- _isLocalInference = isLocalInference;
+ this.isLocalInference = isLocalInference;
if (isLocalInference)
{
validateAndAssignSampleRate(subsampleRate);
- //Intialize liveModel and call Rank processor
- //ToDo:TASK 13057958: Working on changes to support token authentication in RLClient
- Configuration configuration = GetConfigurationForLiveModel("Token", "token");
- LiveModel liveModel = new LiveModel(configuration);
- liveModel.Init();
- _rlNetProcessor = new RlNetProcessor(liveModel);
+ //lazy load Rankprocessor
+ rlNetProcessor = new Lazy(() => GetConfigurationForRankProcessor());
}
}
@@ -108,17 +108,17 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali
{
throw new ArgumentNullException(nameof(credential));
}
- apiKey = credential.Key;
options ??= new PersonalizerClientOptions();
- _clientDiagnostics = new ClientDiagnostics(options);
- _pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key"));
+ clientDiagnostics = new ClientDiagnostics(options);
+ pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key"));
stringEndpoint = endpoint.AbsoluteUri;
- RankRestClient = new RankRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- EventsRestClient = new EventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- MultiSlotRestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- MultiSlotEventsRestClient = new MultiSlotEventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- ServiceConfigurationRestClient = new ServiceConfigurationRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- PolicyRestClient = new PolicyRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
+ RankRestClient = new RankRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ EventsRestClient = new EventsRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ MultiSlotRestClient = new MultiSlotRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ MultiSlotEventsRestClient = new MultiSlotEventsRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ ServiceConfigurationRestClient = new ServiceConfigurationRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ PolicyRestClient = new PolicyRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ azureKeyCredential = credential;
}
/// Initializes a new instance of PersonalizerClient.
@@ -130,16 +130,12 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, Personali
public PersonalizerClient(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) :
this(endpoint, credential, options)
{
- _isLocalInference = isLocalInference;
+ this.isLocalInference = isLocalInference;
if (isLocalInference)
{
- //Intialize liveModel and RlNetprocessor
validateAndAssignSampleRate(subsampleRate);
- //Intialize liveModel and Rankprocessor
- Configuration configuration = GetConfigurationForLiveModel("apiKey", apiKey);
- LiveModel liveModel = new LiveModel(configuration);
- liveModel.Init();
- _rlNetProcessor = new RlNetProcessor(liveModel);
+ //lazy load Rankprocessor
+ rlNetProcessor = new Lazy(() => GetConfigurationForRankProcessor());
}
}
@@ -155,12 +151,12 @@ public PersonalizerClient(Uri endpoint, AzureKeyCredential credential) : this(en
internal PersonalizerClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint)
{
string stringEndpoint = endpoint.AbsoluteUri;
- RankRestClient = new RankRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- EventsRestClient = new EventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- MultiSlotRestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- MultiSlotEventsRestClient = new MultiSlotEventsRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
- _clientDiagnostics = clientDiagnostics;
- _pipeline = pipeline;
+ RankRestClient = new RankRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ EventsRestClient = new EventsRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ MultiSlotRestClient = new MultiSlotRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ MultiSlotEventsRestClient = new MultiSlotEventsRestClient(clientDiagnostics, pipeline, stringEndpoint);
+ this.clientDiagnostics = clientDiagnostics;
+ this.pipeline = pipeline;
}
/// Submit a Personalizer rank request. Receives a context and a list of actions. Returns which of the provided actions should be used by your application, in rewardActionId.
@@ -168,13 +164,14 @@ internal PersonalizerClient(ClientDiagnostics clientDiagnostics, HttpPipeline pi
/// The cancellation token to use.
public virtual async Task> RankAsync(PersonalizerRankOptions options, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Rank");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Rank");
scope.Start();
try
{
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.Rank(options);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.Rank(options);
}
else
{
@@ -218,13 +215,14 @@ public virtual async Task> RankAsync(IEnumerabl
/// The cancellation token to use.
public virtual Response Rank(PersonalizerRankOptions options, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Rank");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Rank");
scope.Start();
try
{
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.Rank(options);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.Rank(options);
}
else
{
@@ -268,13 +266,14 @@ public virtual Response Rank(IEnumerable The cancellation token to use.
public virtual async Task> RankMultiSlotAsync(PersonalizerRankMultiSlotOptions options, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.RankMultiSlot");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.RankMultiSlot");
scope.Start();
try
{
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.Rank(options);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.Rank(options);
}
else
{
@@ -325,13 +324,14 @@ public virtual async Task> RankMultiSl
/// The cancellation token to use.
public virtual Response RankMultiSlot(PersonalizerRankMultiSlotOptions options, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.RankMultiSlot");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.RankMultiSlot");
scope.Start();
try
{
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.Rank(options);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.Rank(options);
}
else
{
@@ -383,14 +383,15 @@ public virtual Response RankMultiSlot(IEnumerab
/// The cancellation token to use.
public virtual async Task RewardAsync(string eventId, float reward, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Reward");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Reward");
scope.Start();
try
{
PersonalizerRewardOptions rewardOptions = new PersonalizerRewardOptions(reward);
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.Reward(eventId, reward);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.Reward(eventId, reward);
}
else
{
@@ -410,13 +411,14 @@ public virtual async Task RewardAsync(string eventId, float reward, Ca
/// The cancellation token to use.
public virtual Response Reward(string eventId, float reward, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Reward");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Reward");
scope.Start();
try
{
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.Reward(eventId, reward);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.Reward(eventId, reward);
}
else
{
@@ -437,13 +439,14 @@ public virtual Response Reward(string eventId, float reward, CancellationToken c
/// The cancellation token to use.
public virtual async Task RewardMultiSlotAsync(string eventId, PersonalizerRewardMultiSlotOptions options, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.RewardMultiSlot");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.RewardMultiSlot");
scope.Start();
try
{
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.RewardMultiSlot(eventId, options.Reward);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.RewardMultiSlot(eventId, options.Reward);
}
else
{
@@ -474,13 +477,14 @@ public virtual async Task RewardMultiSlotAsync(string eventId, string
/// The cancellation token to use.
public virtual Response RewardMultiSlot(string eventId, PersonalizerRewardMultiSlotOptions options, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.RewardMultiSlot");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.RewardMultiSlot");
scope.Start();
try
{
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.RewardMultiSlot(eventId, options.Reward);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.RewardMultiSlot(eventId, options.Reward);
}
else
{
@@ -510,13 +514,14 @@ public virtual Response RewardMultiSlot(string eventId, string slotId, float rew
/// The cancellation token to use.
public virtual async Task ActivateAsync(string eventId, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Activate");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Activate");
scope.Start();
try
{
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.Activate(eventId);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.Activate(eventId);
}
else
{
@@ -535,13 +540,14 @@ public virtual async Task ActivateAsync(string eventId, CancellationTo
/// The cancellation token to use.
public virtual Response Activate(string eventId, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Activate");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Activate");
scope.Start();
try
{
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.Activate(eventId);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.Activate(eventId);
}
else
{
@@ -560,13 +566,14 @@ public virtual Response Activate(string eventId, CancellationToken cancellationT
/// The cancellation token to use.
public virtual async Task ActivateMultiSlotAsync(string eventId, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.ActivateMultiSlot");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.ActivateMultiSlot");
scope.Start();
try
{
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.Activate(eventId);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.Activate(eventId);
}
else
{
@@ -585,13 +592,14 @@ public virtual async Task ActivateMultiSlotAsync(string eventId, Cance
/// The cancellation token to use.
public virtual Response ActivateMultiSlot(string eventId, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.ActivateMultiSlot");
+ using var scope = clientDiagnostics.CreateScope("PersonalizerClient.ActivateMultiSlot");
scope.Start();
try
{
- if (_isLocalInference)
+ if (isLocalInference)
{
- return _rlNetProcessor.Activate(eventId);
+ validateAndUpdateLiveModelConfig();
+ return rlNetProcessor.Value.Activate(eventId);
}
else
{
@@ -605,34 +613,61 @@ public virtual Response ActivateMultiSlot(string eventId, CancellationToken canc
}
}
- /// Gets the configuration details for the live model to use
- internal Configuration GetConfigurationForLiveModel(string authType, string authValue)
+ /// Gets the rank processor initiated with live model to use
+ private RlNetProcessor GetConfigurationForRankProcessor(CancellationToken cancellationToken = default)
{
- _personalizerServiceProperties = ServiceConfigurationRestClient.Get();
- _personalizerPolicy = PolicyRestClient.Get();
Configuration config = new Configuration();
// set up the model
- if (authType == "apiKey")
+ if (azureKeyCredential != null)
{
- config["http.api.key"] = authValue;
+ config["http.api.key"] = azureKeyCredential.Key;
}
- else
+ else if (tokenCredential != null)
{
- //ToDo: TASK 13057958 Working on changes to support token authentication in RLClient
- //config["http.token.key"] = authValue;
+ var tokenRequestContext = new TokenRequestContext(scopes);
+ AccessToken token = tokenCredential.GetToken(tokenRequestContext, cancellationToken);
+ config["http.api.key"] = "Bearer " + token.Token;
+ config["http.api.header.key.name"] = "Authorization";
+ tokenExpiry = token.ExpiresOn;
}
- config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.3/logs/interactions";
- config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.3/logs/observations";
- config["interaction.subsample.rate"] = Convert.ToString(subsampleRate, CultureInfo.InvariantCulture);
- config["observation.subsample.rate"] = Convert.ToString(subsampleRate, CultureInfo.InvariantCulture);
- //ToDo: TASK 13057958 Working on changes to support model api in RL.Net
- config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.3/model";
- config["vw.commandline"] = _personalizerPolicy.Arguments;
+ else
+ {
+ throw new ApplicationException("PersonalizerClient is neither initalized with Token Credential nor with AzureKey Credential");
+ }
+ personalizerServiceProperties = ServiceConfigurationRestClient.Get(cancellationToken);
+ personalizerPolicy = PolicyRestClient.Get(cancellationToken);
+ //interactions & observations
+ config["interaction.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/interactions";
+ config["observation.http.api.host"] = stringEndpoint + "personalizer/v1.1-preview.2/logs/observations";
+ config["interaction.sender.implementation"] = "INTERACTION_HTTP_API_SENDER";
+ config["observation.sender.implementation"] = "OBSERVATION_HTTP_API_SENDER";
+ config["interaction.subsample.rate"] = Convert.ToString(this.subsampleRate, CultureInfo.InvariantCulture);
+ config["observation.subsample.rate"] = Convert.ToString(this.subsampleRate, CultureInfo.InvariantCulture);
+ //model
+ config["model.blob.uri"] = stringEndpoint + "personalizer/v1.1-preview.1/model";
+ config["model.source"] = "AZURE_STORAGE_BLOB";
+
+ config["model.vw.initial_command_line"] = personalizerPolicy.Arguments;
config["protocol.version"] = "2";
- config["initial_exploration.epsilon"] = Convert.ToString(_personalizerServiceProperties.ExplorationPercentage, CultureInfo.InvariantCulture);
- config["rank.learning.mode"] = Convert.ToString(_personalizerServiceProperties.LearningMode, CultureInfo.InvariantCulture);
- //return the config model
- return config;
+ config["initial_exploration.epsilon"] = Convert.ToString(personalizerServiceProperties.ExplorationPercentage, CultureInfo.InvariantCulture);
+ config["rank.learning.mode"] = Convert.ToString(personalizerServiceProperties.LearningMode, CultureInfo.InvariantCulture);
+ LiveModel liveModel = new LiveModel(config);
+ liveModel.Init();
+ liveModelLastRefresh = DateTimeOffset.UtcNow;
+ return new RlNetProcessor(liveModel);
+ }
+
+ /// Update the config details periodically based on liveModelRefreshTimeInMinutes or when bearer token is expired
+ private void validateAndUpdateLiveModelConfig()
+ {
+ if ((tokenCredential != null &&
+ DateTimeOffset.Compare(tokenExpiry, DateTimeOffset.MinValue) != 0 &&
+ DateTimeOffset.Compare(tokenExpiry, DateTimeOffset.UtcNow) <= 0) ||
+ (DateTimeOffset.Compare(liveModelLastRefresh, DateTimeOffset.MinValue) != 0 &&
+ DateTimeOffset.Compare(liveModelLastRefresh.AddMinutes(liveModelRefreshTimeInMinutes), DateTimeOffset.UtcNow) < 0))
+ {
+ rlNetProcessor = new Lazy(() => GetConfigurationForRankProcessor());
+ }
}
/// validate SubsampleRate input from user and throw exception if not in range
diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json
index b95b5e2a10d7..1b0aa39ef532 100644
--- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json
+++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTests.json
@@ -1,73 +1,89 @@
{
- "Entries": [
- {
- "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/reward",
- "RequestMethod": "POST",
- "RequestHeaders": {
- "Accept": "application/json",
- "Content-Length": "13",
- "Content-Type": "application/json",
- "Ocp-Apim-Subscription-Key": "Sanitized",
- "traceparent": "00-a8125774fa5bf645a4f7f0260dfebc69-7be7bbef03bb984a-00",
- "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
- "x-ms-client-request-id": "bcb1cd876e871b813f8dd9c2cd071bbb",
- "x-ms-return-client-request-id": "true"
- },
- "RequestBody": {
- "value": 0.5
- },
- "StatusCode": 204,
- "ResponseHeaders": {
- "apim-request-id": "12343c91-62ea-43e5-8785-5f7de07f498a",
- "Cache-Control": [
- "no-cache",
- "no-store",
- "must-revalidate"
- ],
- "Content-Length": "0",
- "Date": "Thu, 05 Aug 2021 21:27:47 GMT",
- "Expires": "0",
- "pragma": "no-cache",
- "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
- "x-content-type-options": "nosniff",
- "x-envoy-upstream-service-time": "122"
- },
- "ResponseBody": []
- },
- {
- "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/activate",
- "RequestMethod": "POST",
- "RequestHeaders": {
- "Accept": "application/json",
- "Ocp-Apim-Subscription-Key": "Sanitized",
- "traceparent": "00-59b4a539d938e2488c5450a33c026dfb-660f72fcf097d346-00",
- "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
- "x-ms-client-request-id": "d957b65ffb63f941575b40b059f5292e",
- "x-ms-return-client-request-id": "true"
- },
- "RequestBody": null,
- "StatusCode": 204,
- "ResponseHeaders": {
- "apim-request-id": "41f83543-d485-4713-b6cc-2dda1cafc84d",
- "Cache-Control": [
- "no-cache",
- "no-store",
- "must-revalidate"
- ],
- "Content-Length": "0",
- "Date": "Thu, 05 Aug 2021 21:27:47 GMT",
- "Expires": "0",
- "pragma": "no-cache",
- "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
- "x-content-type-options": "nosniff",
- "x-envoy-upstream-service-time": "243"
- },
- "ResponseBody": []
+ "Entries": [
+ {
+ "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/json",
+ "Ocp-Apim-Subscription-Key": "Sanitized",
+ "traceparent": "00-62c9c02e7f51624ea929794857b34cce-355fc01d53896141-00",
+ "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "x-ms-client-request-id": "0888336647ce5b4d471f554e73523042",
+ "x-ms-return-client-request-id": "true"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "apim-request-id": "32747b42-bbb4-40e0-894b-b05dc162a82b",
+ "Cache-Control": [
+ "no-cache",
+ "no-store",
+ "must-revalidate"
+ ],
+ "Connection": "close",
+ "Content-Length": "355",
+ "Content-Type": "application/json; charset=utf-8",
+ "Date": "Thu, 05 Aug 2021 15:09:09 GMT",
+ "Expires": "0",
+ "pragma": "no-cache",
+ "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
+ "timing-allow-origin": "*",
+ "x-content-type-options": "nosniff",
+ "x-envoy-upstream-service-time": "10"
+ },
+ "ResponseBody": {
+ "rewardWaitTime": "PT4H",
+ "defaultReward": 1.0,
+ "rewardAggregation": "average",
+ "explorationPercentage": 0.2,
+ "modelExportFrequency": "PT3M",
+ "logRetentionDays": 2147483647,
+ "lastConfigurationEditDate": "2021-08-05T14:18:34",
+ "learningMode": "Online",
+ "isAutoOptimizationEnabled": true,
+ "autoOptimizationFrequency": "P28D",
+ "autoOptimizationStartDate": "2021-08-18T21:43:47"
+ }
+ },
+ {
+ "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/json",
+ "Ocp-Apim-Subscription-Key": "Sanitized",
+ "traceparent": "00-b0a9efd8ccf8204aa5a53a2c3c9bdda6-fbc21b761ea0694a-00",
+ "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "x-ms-client-request-id": "0f9e1cde582023b0f88a64306ea7a794",
+ "x-ms-return-client-request-id": "true"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "apim-request-id": "5cc62991-dec4-48cf-ba81-714051bb0a81",
+ "Cache-Control": [
+ "no-cache",
+ "no-store",
+ "must-revalidate"
+ ],
+ "Content-Length": "248",
+ "Content-Type": "application/json; charset=utf-8",
+ "Date": "Thu, 05 Aug 2021 15:14:47 GMT",
+ "Expires": "0",
+ "pragma": "no-cache",
+ "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
+ "timing-allow-origin": "*",
+ "x-content-type-options": "nosniff",
+ "x-envoy-upstream-service-time": "10"
+ },
+ "ResponseBody": {
+ "name": "d578f341411041e19ed83df0e0573a80",
+ "arguments": "--cb_explore_adf --quadratic GT --quadratic MR --quadratic GR --quadratic ME --quadratic OT --quadratic OE --quadratic OR --quadratic MS --quadratic GX --ignore A --cb_type ips --epsilon 0.2"
+ }
+ }
+ ],
+ "Variables": {
+ "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized",
+ "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/",
+ "RandomSeed": "1112192962"
}
- ],
- "Variables": {
- "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized",
- "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/",
- "RandomSeed": "856681796"
- }
-}
\ No newline at end of file
+}
diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json
index b95b5e2a10d7..1b0aa39ef532 100644
--- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json
+++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/EventsTests/SingleSlotEventsLocalInferenceTestsAsync.json
@@ -1,73 +1,89 @@
{
- "Entries": [
- {
- "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/reward",
- "RequestMethod": "POST",
- "RequestHeaders": {
- "Accept": "application/json",
- "Content-Length": "13",
- "Content-Type": "application/json",
- "Ocp-Apim-Subscription-Key": "Sanitized",
- "traceparent": "00-a8125774fa5bf645a4f7f0260dfebc69-7be7bbef03bb984a-00",
- "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
- "x-ms-client-request-id": "bcb1cd876e871b813f8dd9c2cd071bbb",
- "x-ms-return-client-request-id": "true"
- },
- "RequestBody": {
- "value": 0.5
- },
- "StatusCode": 204,
- "ResponseHeaders": {
- "apim-request-id": "12343c91-62ea-43e5-8785-5f7de07f498a",
- "Cache-Control": [
- "no-cache",
- "no-store",
- "must-revalidate"
- ],
- "Content-Length": "0",
- "Date": "Thu, 05 Aug 2021 21:27:47 GMT",
- "Expires": "0",
- "pragma": "no-cache",
- "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
- "x-content-type-options": "nosniff",
- "x-envoy-upstream-service-time": "122"
- },
- "ResponseBody": []
- },
- {
- "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.1/events/123456789/activate",
- "RequestMethod": "POST",
- "RequestHeaders": {
- "Accept": "application/json",
- "Ocp-Apim-Subscription-Key": "Sanitized",
- "traceparent": "00-59b4a539d938e2488c5450a33c026dfb-660f72fcf097d346-00",
- "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
- "x-ms-client-request-id": "d957b65ffb63f941575b40b059f5292e",
- "x-ms-return-client-request-id": "true"
- },
- "RequestBody": null,
- "StatusCode": 204,
- "ResponseHeaders": {
- "apim-request-id": "41f83543-d485-4713-b6cc-2dda1cafc84d",
- "Cache-Control": [
- "no-cache",
- "no-store",
- "must-revalidate"
- ],
- "Content-Length": "0",
- "Date": "Thu, 05 Aug 2021 21:27:47 GMT",
- "Expires": "0",
- "pragma": "no-cache",
- "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
- "x-content-type-options": "nosniff",
- "x-envoy-upstream-service-time": "243"
- },
- "ResponseBody": []
+ "Entries": [
+ {
+ "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/json",
+ "Ocp-Apim-Subscription-Key": "Sanitized",
+ "traceparent": "00-62c9c02e7f51624ea929794857b34cce-355fc01d53896141-00",
+ "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "x-ms-client-request-id": "0888336647ce5b4d471f554e73523042",
+ "x-ms-return-client-request-id": "true"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "apim-request-id": "32747b42-bbb4-40e0-894b-b05dc162a82b",
+ "Cache-Control": [
+ "no-cache",
+ "no-store",
+ "must-revalidate"
+ ],
+ "Connection": "close",
+ "Content-Length": "355",
+ "Content-Type": "application/json; charset=utf-8",
+ "Date": "Thu, 05 Aug 2021 15:09:09 GMT",
+ "Expires": "0",
+ "pragma": "no-cache",
+ "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
+ "timing-allow-origin": "*",
+ "x-content-type-options": "nosniff",
+ "x-envoy-upstream-service-time": "10"
+ },
+ "ResponseBody": {
+ "rewardWaitTime": "PT4H",
+ "defaultReward": 1.0,
+ "rewardAggregation": "average",
+ "explorationPercentage": 0.2,
+ "modelExportFrequency": "PT3M",
+ "logRetentionDays": 2147483647,
+ "lastConfigurationEditDate": "2021-08-05T14:18:34",
+ "learningMode": "Online",
+ "isAutoOptimizationEnabled": true,
+ "autoOptimizationFrequency": "P28D",
+ "autoOptimizationStartDate": "2021-08-18T21:43:47"
+ }
+ },
+ {
+ "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/json",
+ "Ocp-Apim-Subscription-Key": "Sanitized",
+ "traceparent": "00-b0a9efd8ccf8204aa5a53a2c3c9bdda6-fbc21b761ea0694a-00",
+ "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "x-ms-client-request-id": "0f9e1cde582023b0f88a64306ea7a794",
+ "x-ms-return-client-request-id": "true"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "apim-request-id": "5cc62991-dec4-48cf-ba81-714051bb0a81",
+ "Cache-Control": [
+ "no-cache",
+ "no-store",
+ "must-revalidate"
+ ],
+ "Content-Length": "248",
+ "Content-Type": "application/json; charset=utf-8",
+ "Date": "Thu, 05 Aug 2021 15:14:47 GMT",
+ "Expires": "0",
+ "pragma": "no-cache",
+ "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
+ "timing-allow-origin": "*",
+ "x-content-type-options": "nosniff",
+ "x-envoy-upstream-service-time": "10"
+ },
+ "ResponseBody": {
+ "name": "d578f341411041e19ed83df0e0573a80",
+ "arguments": "--cb_explore_adf --quadratic GT --quadratic MR --quadratic GR --quadratic ME --quadratic OT --quadratic OE --quadratic OR --quadratic MS --quadratic GX --ignore A --cb_type ips --epsilon 0.2"
+ }
+ }
+ ],
+ "Variables": {
+ "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized",
+ "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/",
+ "RandomSeed": "1112192962"
}
- ],
- "Variables": {
- "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized",
- "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/",
- "RandomSeed": "856681796"
- }
-}
\ No newline at end of file
+}
diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json
index daefb87e1fc1..8a64e98e7e3b 100644
--- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json
+++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/ModelTests/ModelTestAsync.json
@@ -133,7 +133,9 @@
"ResponseBody": null
}
],
- "Variables": {
- "RandomSeed": "1431761393"
- }
+ "Variables": {
+ "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized",
+ "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/",
+ "RandomSeed": "1431761393"
+ }
}
diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json
index 922b78324427..1b0aa39ef532 100644
--- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json
+++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTests.json
@@ -1,225 +1,89 @@
{
- "Entries": [
- {
- "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank",
- "RequestMethod": "POST",
- "RequestHeaders": {
- "Accept": "application/json",
- "Content-Length": "139",
- "Content-Type": "application/json",
- "Ocp-Apim-Subscription-Key": "Sanitized",
- "traceparent": "00-8a2352f590c938419932183af7ad2039-475eb6f9bad6944a-00",
- "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
- "x-ms-client-request-id": "72fe1c6ec5e1742467bce38ccf58b021",
- "x-ms-return-client-request-id": "true"
- },
- "RequestBody": {
- "actions": [
- {
- "id": "Person",
- "features": [
- {
- "videoType": "documentary",
- "videoLength": 35,
- "director": "CarlSagan"
- },
- {
- "mostWatchedByAge": "30-35"
- }
- ]
- }
- ]
- },
- "StatusCode": 201,
- "ResponseHeaders": {
- "apim-request-id": "a7d4ebf4-e94b-4332-8066-a1936f394b5a",
- "Cache-Control": [
- "no-cache",
- "no-store",
- "must-revalidate"
- ],
- "Content-Length": "124",
- "Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 05 Aug 2021 20:55:04 GMT",
- "Expires": "0",
- "pragma": "no-cache",
- "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
- "timing-allow-origin": "*",
- "x-content-type-options": "nosniff",
- "x-envoy-upstream-service-time": "13492"
- },
- "ResponseBody": {
- "ranking": [
- {
- "id": "Person",
- "probability": 1.0
- }
- ],
- "eventId": "4e9af3e0604e4fc1af091c9e76c0c93d-8iJRK",
- "rewardActionId": "Person"
- }
- },
- {
- "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank",
- "RequestMethod": "POST",
- "RequestHeaders": {
- "Accept": "application/json",
- "Content-Length": "527",
- "Content-Type": "application/json",
- "Ocp-Apim-Subscription-Key": "Sanitized",
- "traceparent": "00-9eed4f0ce6b0c340802623beef2c0a21-5e9e395f17eb1343-00",
- "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
- "x-ms-client-request-id": "f451845d717dfcfd636af66ed165bf61",
- "x-ms-return-client-request-id": "true"
- },
- "RequestBody": {
- "contextFeatures": [
- {
- "Features": {
- "day": "tuesday",
- "time": "night",
- "weather": "rainy"
+ "Entries": [
+ {
+ "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/json",
+ "Ocp-Apim-Subscription-Key": "Sanitized",
+ "traceparent": "00-62c9c02e7f51624ea929794857b34cce-355fc01d53896141-00",
+ "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "x-ms-client-request-id": "0888336647ce5b4d471f554e73523042",
+ "x-ms-return-client-request-id": "true"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "apim-request-id": "32747b42-bbb4-40e0-894b-b05dc162a82b",
+ "Cache-Control": [
+ "no-cache",
+ "no-store",
+ "must-revalidate"
+ ],
+ "Connection": "close",
+ "Content-Length": "355",
+ "Content-Type": "application/json; charset=utf-8",
+ "Date": "Thu, 05 Aug 2021 15:09:09 GMT",
+ "Expires": "0",
+ "pragma": "no-cache",
+ "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
+ "timing-allow-origin": "*",
+ "x-content-type-options": "nosniff",
+ "x-envoy-upstream-service-time": "10"
+ },
+ "ResponseBody": {
+ "rewardWaitTime": "PT4H",
+ "defaultReward": 1.0,
+ "rewardAggregation": "average",
+ "explorationPercentage": 0.2,
+ "modelExportFrequency": "PT3M",
+ "logRetentionDays": 2147483647,
+ "lastConfigurationEditDate": "2021-08-05T14:18:34",
+ "learningMode": "Online",
+ "isAutoOptimizationEnabled": true,
+ "autoOptimizationFrequency": "P28D",
+ "autoOptimizationStartDate": "2021-08-18T21:43:47"
}
- },
- {
- "Features": {
- "userId": "1234",
- "payingUser": true,
- "favoriteGenre": "documentary",
- "hoursOnSite": 0.12,
- "lastwatchedType": "movie"
+ },
+ {
+ "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/json",
+ "Ocp-Apim-Subscription-Key": "Sanitized",
+ "traceparent": "00-b0a9efd8ccf8204aa5a53a2c3c9bdda6-fbc21b761ea0694a-00",
+ "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "x-ms-client-request-id": "0f9e1cde582023b0f88a64306ea7a794",
+ "x-ms-return-client-request-id": "true"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "apim-request-id": "5cc62991-dec4-48cf-ba81-714051bb0a81",
+ "Cache-Control": [
+ "no-cache",
+ "no-store",
+ "must-revalidate"
+ ],
+ "Content-Length": "248",
+ "Content-Type": "application/json; charset=utf-8",
+ "Date": "Thu, 05 Aug 2021 15:14:47 GMT",
+ "Expires": "0",
+ "pragma": "no-cache",
+ "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
+ "timing-allow-origin": "*",
+ "x-content-type-options": "nosniff",
+ "x-envoy-upstream-service-time": "10"
+ },
+ "ResponseBody": {
+ "name": "d578f341411041e19ed83df0e0573a80",
+ "arguments": "--cb_explore_adf --quadratic GT --quadratic MR --quadratic GR --quadratic ME --quadratic OT --quadratic OE --quadratic OR --quadratic MS --quadratic GX --ignore A --cb_type ips --epsilon 0.2"
}
- }
- ],
- "actions": [
- {
- "id": "Person1",
- "features": [
- {
- "videoType": "documentary",
- "videoLength": 35,
- "director": "CarlSagan"
- },
- {
- "mostWatchedByAge": "30-35"
- }
- ]
- },
- {
- "id": "Person2",
- "features": [
- {
- "videoType": "documentary",
- "videoLength": 35,
- "director": "CarlSagan"
- },
- {
- "mostWatchedByAge": "40-45"
- }
- ]
- }
- ],
- "excludedActions": [
- "Person1"
- ],
- "eventId": "123456789"
- },
- "StatusCode": 201,
- "ResponseHeaders": {
- "apim-request-id": "f4625cd9-6ee1-4f1a-b6de-af954ff2465e",
- "Cache-Control": [
- "no-cache",
- "no-store",
- "must-revalidate"
- ],
- "Content-Length": "132",
- "Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 05 Aug 2021 20:55:19 GMT",
- "Expires": "0",
- "pragma": "no-cache",
- "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
- "timing-allow-origin": "*",
- "x-content-type-options": "nosniff",
- "x-envoy-upstream-service-time": "15290"
- },
- "ResponseBody": {
- "ranking": [
- {
- "id": "Person1",
- "probability": 0.0
- },
- {
- "id": "Person2",
- "probability": 1.0
- }
- ],
- "eventId": "123456789",
- "rewardActionId": "Person2"
- }
- },
- {
- "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank",
- "RequestMethod": "POST",
- "RequestHeaders": {
- "Accept": "application/json",
- "Content-Length": "139",
- "Content-Type": "application/json",
- "Ocp-Apim-Subscription-Key": "Sanitized",
- "traceparent": "00-cd2c7cfe73673242856c322a2fa711db-f43e2530c4f71446-00",
- "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
- "x-ms-client-request-id": "66317083bf6f0fc05cfb3b5eae739abb",
- "x-ms-return-client-request-id": "true"
- },
- "RequestBody": {
- "actions": [
- {
- "id": "Person",
- "features": [
- {
- "videoType": "documentary",
- "videoLength": 35,
- "director": "CarlSagan"
- },
- {
- "mostWatchedByAge": "30-35"
- }
- ]
- }
- ]
- },
- "StatusCode": 201,
- "ResponseHeaders": {
- "apim-request-id": "e4c82d6d-7ee8-4eef-85fe-d31735c47995",
- "Cache-Control": [
- "no-cache",
- "no-store",
- "must-revalidate"
- ],
- "Content-Length": "124",
- "Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 05 Aug 2021 20:55:33 GMT",
- "Expires": "0",
- "pragma": "no-cache",
- "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
- "timing-allow-origin": "*",
- "x-content-type-options": "nosniff",
- "x-envoy-upstream-service-time": "13443"
- },
- "ResponseBody": {
- "ranking": [
- {
- "id": "Person",
- "probability": 1.0
- }
- ],
- "eventId": "c638ab102e9f464dbc35f2f102f59f35-8iJSd",
- "rewardActionId": "Person"
- }
+ }
+ ],
+ "Variables": {
+ "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized",
+ "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/",
+ "RandomSeed": "1112192962"
}
- ],
- "Variables": {
- "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized",
- "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/",
- "RandomSeed": "1112192962"
- }
-}
\ No newline at end of file
+}
diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json
index 922b78324427..1b0aa39ef532 100644
--- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json
+++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/RankTests/SingleSlotRankLocalInferenceTestsAsync.json
@@ -1,225 +1,89 @@
{
- "Entries": [
- {
- "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank",
- "RequestMethod": "POST",
- "RequestHeaders": {
- "Accept": "application/json",
- "Content-Length": "139",
- "Content-Type": "application/json",
- "Ocp-Apim-Subscription-Key": "Sanitized",
- "traceparent": "00-8a2352f590c938419932183af7ad2039-475eb6f9bad6944a-00",
- "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
- "x-ms-client-request-id": "72fe1c6ec5e1742467bce38ccf58b021",
- "x-ms-return-client-request-id": "true"
- },
- "RequestBody": {
- "actions": [
- {
- "id": "Person",
- "features": [
- {
- "videoType": "documentary",
- "videoLength": 35,
- "director": "CarlSagan"
- },
- {
- "mostWatchedByAge": "30-35"
- }
- ]
- }
- ]
- },
- "StatusCode": 201,
- "ResponseHeaders": {
- "apim-request-id": "a7d4ebf4-e94b-4332-8066-a1936f394b5a",
- "Cache-Control": [
- "no-cache",
- "no-store",
- "must-revalidate"
- ],
- "Content-Length": "124",
- "Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 05 Aug 2021 20:55:04 GMT",
- "Expires": "0",
- "pragma": "no-cache",
- "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
- "timing-allow-origin": "*",
- "x-content-type-options": "nosniff",
- "x-envoy-upstream-service-time": "13492"
- },
- "ResponseBody": {
- "ranking": [
- {
- "id": "Person",
- "probability": 1.0
- }
- ],
- "eventId": "4e9af3e0604e4fc1af091c9e76c0c93d-8iJRK",
- "rewardActionId": "Person"
- }
- },
- {
- "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank",
- "RequestMethod": "POST",
- "RequestHeaders": {
- "Accept": "application/json",
- "Content-Length": "527",
- "Content-Type": "application/json",
- "Ocp-Apim-Subscription-Key": "Sanitized",
- "traceparent": "00-9eed4f0ce6b0c340802623beef2c0a21-5e9e395f17eb1343-00",
- "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
- "x-ms-client-request-id": "f451845d717dfcfd636af66ed165bf61",
- "x-ms-return-client-request-id": "true"
- },
- "RequestBody": {
- "contextFeatures": [
- {
- "Features": {
- "day": "tuesday",
- "time": "night",
- "weather": "rainy"
+ "Entries": [
+ {
+ "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/json",
+ "Ocp-Apim-Subscription-Key": "Sanitized",
+ "traceparent": "00-62c9c02e7f51624ea929794857b34cce-355fc01d53896141-00",
+ "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "x-ms-client-request-id": "0888336647ce5b4d471f554e73523042",
+ "x-ms-return-client-request-id": "true"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "apim-request-id": "32747b42-bbb4-40e0-894b-b05dc162a82b",
+ "Cache-Control": [
+ "no-cache",
+ "no-store",
+ "must-revalidate"
+ ],
+ "Connection": "close",
+ "Content-Length": "355",
+ "Content-Type": "application/json; charset=utf-8",
+ "Date": "Thu, 05 Aug 2021 15:09:09 GMT",
+ "Expires": "0",
+ "pragma": "no-cache",
+ "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
+ "timing-allow-origin": "*",
+ "x-content-type-options": "nosniff",
+ "x-envoy-upstream-service-time": "10"
+ },
+ "ResponseBody": {
+ "rewardWaitTime": "PT4H",
+ "defaultReward": 1.0,
+ "rewardAggregation": "average",
+ "explorationPercentage": 0.2,
+ "modelExportFrequency": "PT3M",
+ "logRetentionDays": 2147483647,
+ "lastConfigurationEditDate": "2021-08-05T14:18:34",
+ "learningMode": "Online",
+ "isAutoOptimizationEnabled": true,
+ "autoOptimizationFrequency": "P28D",
+ "autoOptimizationStartDate": "2021-08-18T21:43:47"
}
- },
- {
- "Features": {
- "userId": "1234",
- "payingUser": true,
- "favoriteGenre": "documentary",
- "hoursOnSite": 0.12,
- "lastwatchedType": "movie"
+ },
+ {
+ "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/json",
+ "Ocp-Apim-Subscription-Key": "Sanitized",
+ "traceparent": "00-b0a9efd8ccf8204aa5a53a2c3c9bdda6-fbc21b761ea0694a-00",
+ "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "x-ms-client-request-id": "0f9e1cde582023b0f88a64306ea7a794",
+ "x-ms-return-client-request-id": "true"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "apim-request-id": "5cc62991-dec4-48cf-ba81-714051bb0a81",
+ "Cache-Control": [
+ "no-cache",
+ "no-store",
+ "must-revalidate"
+ ],
+ "Content-Length": "248",
+ "Content-Type": "application/json; charset=utf-8",
+ "Date": "Thu, 05 Aug 2021 15:14:47 GMT",
+ "Expires": "0",
+ "pragma": "no-cache",
+ "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
+ "timing-allow-origin": "*",
+ "x-content-type-options": "nosniff",
+ "x-envoy-upstream-service-time": "10"
+ },
+ "ResponseBody": {
+ "name": "d578f341411041e19ed83df0e0573a80",
+ "arguments": "--cb_explore_adf --quadratic GT --quadratic MR --quadratic GR --quadratic ME --quadratic OT --quadratic OE --quadratic OR --quadratic MS --quadratic GX --ignore A --cb_type ips --epsilon 0.2"
}
- }
- ],
- "actions": [
- {
- "id": "Person1",
- "features": [
- {
- "videoType": "documentary",
- "videoLength": 35,
- "director": "CarlSagan"
- },
- {
- "mostWatchedByAge": "30-35"
- }
- ]
- },
- {
- "id": "Person2",
- "features": [
- {
- "videoType": "documentary",
- "videoLength": 35,
- "director": "CarlSagan"
- },
- {
- "mostWatchedByAge": "40-45"
- }
- ]
- }
- ],
- "excludedActions": [
- "Person1"
- ],
- "eventId": "123456789"
- },
- "StatusCode": 201,
- "ResponseHeaders": {
- "apim-request-id": "f4625cd9-6ee1-4f1a-b6de-af954ff2465e",
- "Cache-Control": [
- "no-cache",
- "no-store",
- "must-revalidate"
- ],
- "Content-Length": "132",
- "Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 05 Aug 2021 20:55:19 GMT",
- "Expires": "0",
- "pragma": "no-cache",
- "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
- "timing-allow-origin": "*",
- "x-content-type-options": "nosniff",
- "x-envoy-upstream-service-time": "15290"
- },
- "ResponseBody": {
- "ranking": [
- {
- "id": "Person1",
- "probability": 0.0
- },
- {
- "id": "Person2",
- "probability": 1.0
- }
- ],
- "eventId": "123456789",
- "rewardActionId": "Person2"
- }
- },
- {
- "RequestUri": "https://singleslotrecordsdktests.cognitiveservices.azure.com/personalizer/v1.1-preview.3/rank",
- "RequestMethod": "POST",
- "RequestHeaders": {
- "Accept": "application/json",
- "Content-Length": "139",
- "Content-Type": "application/json",
- "Ocp-Apim-Subscription-Key": "Sanitized",
- "traceparent": "00-cd2c7cfe73673242856c322a2fa711db-f43e2530c4f71446-00",
- "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20210805.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
- "x-ms-client-request-id": "66317083bf6f0fc05cfb3b5eae739abb",
- "x-ms-return-client-request-id": "true"
- },
- "RequestBody": {
- "actions": [
- {
- "id": "Person",
- "features": [
- {
- "videoType": "documentary",
- "videoLength": 35,
- "director": "CarlSagan"
- },
- {
- "mostWatchedByAge": "30-35"
- }
- ]
- }
- ]
- },
- "StatusCode": 201,
- "ResponseHeaders": {
- "apim-request-id": "e4c82d6d-7ee8-4eef-85fe-d31735c47995",
- "Cache-Control": [
- "no-cache",
- "no-store",
- "must-revalidate"
- ],
- "Content-Length": "124",
- "Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 05 Aug 2021 20:55:33 GMT",
- "Expires": "0",
- "pragma": "no-cache",
- "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
- "timing-allow-origin": "*",
- "x-content-type-options": "nosniff",
- "x-envoy-upstream-service-time": "13443"
- },
- "ResponseBody": {
- "ranking": [
- {
- "id": "Person",
- "probability": 1.0
- }
- ],
- "eventId": "c638ab102e9f464dbc35f2f102f59f35-8iJSd",
- "rewardActionId": "Person"
- }
+ }
+ ],
+ "Variables": {
+ "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized",
+ "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/",
+ "RandomSeed": "1112192962"
}
- ],
- "Variables": {
- "PERSONALIZER_API_KEY_SINGLE_SLOT": "Sanitized",
- "PERSONALIZER_ENDPOINT_SINGLE_SLOT": "https://singleslotrecordsdktests.cognitiveservices.azure.com/",
- "RandomSeed": "1112192962"
- }
-}
\ No newline at end of file
+}