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 4bd20e764f5e0..b5d425649ea8d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Azure.AI.Personalizer.csproj @@ -32,7 +32,7 @@ - + diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs index 629d36afdcb00..9eb32219a9755 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankResult.cs @@ -36,13 +36,14 @@ internal PersonalizerRankResult(IReadOnlyList ranking, /// The calculated ranking for the current request. public IReadOnlyList Ranking { get; set; } + /// The eventId for the round trip from request to response. - public string EventId { get; set; } + public string EventId { get; } /// /// The action chosen by the Personalizer service. /// This is the action your application should display, and for which to report the reward. /// This might not be the first found in 'ranking'. /// - public string RewardActionId { get; set; } + public string RewardActionId { get; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs index 304775da49e61..9d55861dba4d2 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/Models/PersonalizerRankedAction.cs @@ -25,8 +25,8 @@ internal PersonalizerRankedAction(string id, float? probability) } /// Id of the action. - public string Id { get; set; } + public string Id { get; } /// Probability of the action. - public float? Probability { get; set; } + public float? Probability { get; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs index 3cffc6b60d58c..f5a56abb28f32 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Generated/RankClient.cs @@ -65,7 +65,8 @@ public RankClient(string endpoint, TokenCredential credential, bool isLocalInfer { LiveModel liveModel = new LiveModel(configuration); liveModel.Init(); - _rlNetProcessor = new RlNetProcessor(liveModel); + ILiveModel liveModelAdapter = new LiveModelAdapter(liveModel); + _rlNetProcessor = new RlNetProcessor(liveModelAdapter); } } @@ -104,7 +105,8 @@ public RankClient(string endpoint, AzureKeyCredential credential, bool isLocalIn { LiveModel liveModel = new LiveModel(configuration); liveModel.Init(); - _rlNetProcessor = new RlNetProcessor(liveModel); + LiveModelAdapter liveModelAdapter = new LiveModelAdapter(liveModel); + _rlNetProcessor = new RlNetProcessor(liveModelAdapter); } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs b/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs index 1e1c96d255181..227726867313d 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/GlobalSuppressions.cs @@ -4,5 +4,3 @@ using System.Diagnostics.CodeAnalysis; [assembly: SuppressMessage("Usage", "AZC0016:Invalid ServiceVersion member name.", Justification = "Generated code: https://github.com/Azure/autorest.csharp/issues/1524", Scope = "type", Target = "~T:Azure.AI.Personalizer.PersonalizerClientOptions.ServiceVersion")] -[assembly: SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "", Scope = "member", Target = "~P:Azure.AI.Personalizer.DecisionContextDocument.SlotJson")] -[assembly: SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "", Scope = "member", Target = "~P:Azure.AI.Personalizer.PersonalizerSlotOptions.Features")] diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs new file mode 100644 index 0000000000000..53b51e4deeb1a --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ActionProbabilityWrapper.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; + +namespace Azure.AI.Personalizer +{ + /// The Wrapper for Rl.Net.ActionProbability + public class ActionProbabilityWrapper + { + private readonly ActionProbability _actionProbability; + + /// The probability + public virtual float Probability { get { return _actionProbability.Probability; } } + + /// The action index + public virtual long ActionIndex { get { return _actionProbability.ActionIndex; } } + + /// Initializes a new instance of ActionProbabilityWrapper. + public ActionProbabilityWrapper() + { + } + + /// Initializes a new instance of ActionProbabilityWrapper. + /// An action probability + public ActionProbabilityWrapper(ActionProbability actionProbability) + { + _actionProbability = actionProbability; + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs index 9607b94d182b6..a3f302278da1a 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContext.cs @@ -44,11 +44,11 @@ public DecisionContext(PersonalizerRankMultiSlotOptions rankRequest, Dictionary< List actionFeatures = action.Features.Select(f => JsonSerializer.Serialize(f)).ToList(); return new DecisionContextDocument(action.Id, actionFeatures, null, null); - }).ToArray(); + }).ToList(); this.Slots = rankRequest.Slots? .Select( slot => new DecisionContextDocument(null, null, slot.Id, serializeFeatures(slotIdToFeatures[slot.Id])) - ).ToArray(); + ).ToList(); } /// Properties from url @@ -59,12 +59,12 @@ public DecisionContext(PersonalizerRankMultiSlotOptions rankRequest, Dictionary< /// Properties of documents [JsonPropertyName("_multi")] - public DecisionContextDocument[] Documents { get; set; } + public IList Documents { get; } /// Properties of slots [JsonPropertyName("_slots")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public DecisionContextDocument[] Slots { get; set; } + public IList Slots { get; } private static List serializeFeatures(IList features) { diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs index ed7ce55c0b65e..53b17fe1522d9 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocument.cs @@ -11,15 +11,15 @@ public class DecisionContextDocument { /// Initializes a new instance of DecisionContextDocument. /// Id of the decision context document - /// The json features + /// The json list of action features /// The slot Id - /// The slot json features - public DecisionContextDocument(string id, List json, string slotId, List slotJson) + /// The json list of slot features + public DecisionContextDocument(string id, List actionFeatureJsons, string slotId, List slotFeatureJsons) { - ID = id; - JSON = json; + Id = id; + ActionFeatureJsons = actionFeatureJsons; SlotId = slotId; - SlotJson = slotJson; + SlotFeatureJsons = slotFeatureJsons; } /// @@ -27,60 +27,36 @@ public DecisionContextDocument(string id, List json, string slotId, List /// [JsonPropertyName("_tag")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string ID - { - get { return this?.Marginal?.ID; } - set - { - this.Marginal = value == null ? null : new DecisionContextDocumentId - { - ID = value - }; - } - } - - /// - /// Provide feature for marginal feature based on document id. - /// - [JsonPropertyName("i")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public DecisionContextDocumentId Marginal { get; set; } - - /// - /// Provide source set feature. - /// - [JsonPropertyName("s")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public DecisionContextDocumentSource Source { get; set; } + public string Id { get; } /// - /// Generic json features. + /// A list of generic action feature jsons. /// [JsonPropertyName("j")] [JsonConverter(typeof(JsonRawStringListConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public List JSON { get; } + public List ActionFeatureJsons { get; } /// /// Keep as float[] arrays to improve marshalling speed. /// [JsonPropertyName("f")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public Dictionary FloatFeatures { get; } + public Dictionary Features { get; } /// /// Slot ID. /// [JsonPropertyName("_id")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string SlotId { get; set; } + public string SlotId { get; } /// - /// Generic slot json features. + /// A list of generic slot feature jsons. /// [JsonPropertyName("sj")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonConverter(typeof(JsonRawStringListConverter))] - public List SlotJson { get; set; } + public List SlotFeatureJsons { get; } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentId.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentId.cs deleted file mode 100644 index 20880629e4dcf..0000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentId.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Text.Json.Serialization; - -namespace Azure.AI.Personalizer -{ - /// The Decision Context Document. - public class DecisionContextDocumentId - { - /// - /// Required for --marginal - /// - [JsonPropertyName("constant")] - public int Constant { get; set; } = 1; - - /// - /// Included for offline analysis. - /// - [JsonPropertyName("id")] - public string ID { get; set; } - } -} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentSource.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentSource.cs deleted file mode 100644 index b114f161426ba..0000000000000 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/DecisionContextDocumentSource.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Text.Json.Serialization; - -namespace Azure.AI.Personalizer -{ - /// The Decision Context Document Source. - public class DecisionContextDocumentSource - { - /// The set. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string Set { get; set; } - - /// The parameter. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string Parameter { get; set; } - } -} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/ILiveModel.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ILiveModel.cs new file mode 100644 index 0000000000000..4ad02796042b5 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/ILiveModel.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; +using System; + +namespace Azure.AI.Personalizer +{ + /// An interface for Rl.Net.LiveModel + public interface ILiveModel + { + /// Init LiveModel + void Init(); + + /// Wrapper method of ChooseRank + RankingResponseWrapper ChooseRank(string eventId, string contextJson, ActionFlags flags); + + /// Wrapper method of RequestMultiSlotDecisionDetailed + MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, ActionFlags flags, int[] baselineActions); + + /// Wrapper method of QueueOutcomeEvent + void QueueOutcomeEvent(string eventId, float outcome); + + /// Wrapper method of RequestMultiSlotDecisionDetailed + void QueueOutcomeEvent(string eventId, string slotId, float outcome); + + /// Wrapper method of QueueActionTakenEvent + void QueueActionTakenEvent(string eventId); + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs new file mode 100644 index 0000000000000..81a1edbecd98c --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/LiveModelAdapter.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; +using System; + +namespace Azure.AI.Personalizer +{ + /// An adapter class of Rl.Net.LiveModel + public class LiveModelAdapter : ILiveModel + { + private readonly LiveModel liveModel; + + /// Initializes a new instance of LiveModelAdapter. + public LiveModelAdapter(LiveModel liveModel) + { + this.liveModel = liveModel ?? throw new ArgumentNullException(nameof(liveModel)); + } + + /// Init LiveModel + public void Init() + { + liveModel.Init(); + } + + /// Wrapper method of ChooseRank + public RankingResponseWrapper ChooseRank(string eventId, string contextJson, ActionFlags flags) + { + RankingResponse rankingResponse = liveModel.ChooseRank(eventId, contextJson, flags); + RankingResponseWrapper rankingResponseWrapper = rankingResponse == null ? null : new RankingResponseWrapper(rankingResponse); + + return rankingResponseWrapper; + } + + /// Wrapper method of RequestMultiSlotDecisionDetailed + public MultiSlotResponseDetailedWrapper RequestMultiSlotDecisionDetailed(string eventId, string contextJson, ActionFlags flags, int[] baselineActions) + { + MultiSlotResponseDetailed multiSlotResponse = liveModel.RequestMultiSlotDecisionDetailed(eventId, contextJson, flags, baselineActions); + MultiSlotResponseDetailedWrapper multiSlotResponseDetailedWrapper = multiSlotResponse == null ? null : new MultiSlotResponseDetailedWrapper(multiSlotResponse); + return multiSlotResponseDetailedWrapper; + } + + /// Wrapper method of QueueOutcomeEvent + public void QueueOutcomeEvent(string eventId, float outcome) + { + liveModel.QueueOutcomeEvent(eventId, outcome); + } + + /// Wrapper method of RequestMultiSlotDecisionDetailed + public void QueueOutcomeEvent(string eventId, string slotId, float outcome) + { + liveModel.QueueOutcomeEvent(eventId, slotId, outcome); + } + + /// Wrapper method of QueueActionTakenEvent + public void QueueActionTakenEvent(string eventId) + { + liveModel.QueueActionTakenEvent(eventId); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs new file mode 100644 index 0000000000000..86846431563f2 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/MultiSlotResponseDetailedWrapper.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Personalizer +{ + /// The Wrapper for Rl.Net.MultiSlotResponseDetailed + public class MultiSlotResponseDetailedWrapper : IEnumerable + { + private readonly MultiSlotResponseDetailed _multiSlotResponse; + + /// Initializes a new instance of ActionProbabilityWrapper. + public MultiSlotResponseDetailedWrapper() + { + } + + /// Initializes a new instance of ActionProbabilityWrapper. + public MultiSlotResponseDetailedWrapper(MultiSlotResponseDetailed multiSlotResponse) + { + _multiSlotResponse = multiSlotResponse ?? throw new ArgumentNullException(nameof(multiSlotResponse)); + } + + /// Get the enumerator + public virtual IEnumerator GetEnumerator() + { + var enu = _multiSlotResponse.GetEnumerator(); + while (enu.MoveNext()) + { + yield return new SlotRankingResponseWrapper(enu.Current); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs index ded880bbd78fe..53ed73d799888 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerClient.cs @@ -614,7 +614,7 @@ public virtual Response ActivateMultiSlot(string eventId, CancellationToken canc } /// Gets the rank processor initiated with live model to use - private RlNetProcessor GetConfigurationForRankProcessor(CancellationToken cancellationToken = default) + internal virtual RlNetProcessor GetConfigurationForRankProcessor(CancellationToken cancellationToken = default) { Configuration config = new Configuration(); // set up the model @@ -653,8 +653,9 @@ private RlNetProcessor GetConfigurationForRankProcessor(CancellationToken cancel config["rank.learning.mode"] = Convert.ToString(personalizerServiceProperties.LearningMode, CultureInfo.InvariantCulture); LiveModel liveModel = new LiveModel(config); liveModel.Init(); + ILiveModel liveModelAdapter = new LiveModelAdapter(liveModel); liveModelLastRefresh = DateTimeOffset.UtcNow; - return new RlNetProcessor(liveModel); + return new RlNetProcessor(liveModelAdapter); } /// Update the config details periodically based on liveModelRefreshTimeInMinutes or when bearer token is expired diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs index b169f40dc3539..603f39a9950e7 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/PersonalizerSlotOptions.cs @@ -15,7 +15,7 @@ public partial class PersonalizerSlotOptions /// List of dictionaries containing slot features. /// Need to be JSON serializable. https://docs.microsoft.com/azure/cognitive-services/personalizer/concepts-features. /// - public IList Features { get; set; } + public IList Features { get; } /// /// Initializes a new instance of the RankRequest class. diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankingResponseWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankingResponseWrapper.cs new file mode 100644 index 0000000000000..0d5b0014432a6 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RankingResponseWrapper.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Personalizer +{ + /// A wrapper class of Rl.Net.RankingResponse + public class RankingResponseWrapper : IEnumerable + { + private readonly RankingResponse _rankingResponse; + + /// Initializes a new instance of RankingResponseWrapper. + public RankingResponseWrapper() + { + } + + /// Initializes a new instance of RankingResponseWrapper. + /// An rank response + public RankingResponseWrapper(RankingResponse rankResponse) + { + _rankingResponse = rankResponse ?? throw new ArgumentNullException(nameof(rankResponse)); + } + + /// Get the enumerator + public virtual IEnumerator GetEnumerator() + { + var enu = _rankingResponse.GetEnumerator(); + while (enu.MoveNext()) + { + yield return new ActionProbabilityWrapper(enu.Current); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs index 670275b44b4b0..0463554b40da3 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlNetProcessor.cs @@ -14,13 +14,13 @@ namespace Azure.AI.Personalizer /// The Rl.Net Processor. internal class RlNetProcessor { - private readonly LiveModel _liveModel; + private readonly ILiveModel liveModel; internal PolicyRestClient RestClient { get; } /// Initializes a new instance of RlNetProcessor. - public RlNetProcessor(LiveModel liveModel) + public RlNetProcessor(ILiveModel liveModel) { - this._liveModel = liveModel; + this.liveModel = liveModel; } /// Submit a Personalizer rank request. Receives a context and a list of actions. Returns which of the provided actions should be used by your application, in rewardActionId. @@ -61,10 +61,10 @@ public Response Rank(PersonalizerRankOptions options) ActionFlags flags = options.DeferActivation == true ? ActionFlags.Deferred : ActionFlags.Default; // Call ChooseRank of local RL.Net - RankingResponse rankingResponse = _liveModel.ChooseRank(eventId, contextJson, flags); + RankingResponseWrapper rankingResponseWrapper = liveModel.ChooseRank(eventId, contextJson, flags); // Convert response to PersonalizerRankResult - var value = RlObjectConverter.GenerateRankResult(originalActions, rankableActions, excludedActions, rankingResponse, options.EventId); + var value = RlObjectConverter.GenerateRankResult(originalActions, rankableActions, excludedActions, rankingResponseWrapper, options.EventId); return Response.FromValue(value, default); } @@ -93,10 +93,10 @@ public Response Rank(PersonalizerRankMultiSlotO int[] baselineActions = RlObjectConverter.ExtractBaselineActionsFromRankRequest(options); // Call ChooseRank of local RL.Net - MultiSlotResponseDetailed multiSlotResponse = _liveModel.RequestMultiSlotDecisionDetailed(eventId, contextJson, flags, baselineActions); + MultiSlotResponseDetailedWrapper multiSlotResponseDetailedWrapper = liveModel.RequestMultiSlotDecisionDetailed(eventId, contextJson, flags, baselineActions); // Convert response to PersonalizerRankResult - var value = RlObjectConverter.GenerateMultiSlotRankResponse(options.Actions, multiSlotResponse, eventId); + var value = RlObjectConverter.GenerateMultiSlotRankResponse(options.Actions, multiSlotResponseDetailedWrapper, eventId); return Response.FromValue(value, default); } @@ -107,7 +107,7 @@ public Response Rank(PersonalizerRankMultiSlotO public Response Reward(string eventId, float reward) { // Call QueueOutcomeEvent of local RL.Net - _liveModel.QueueOutcomeEvent(eventId, reward); + liveModel.QueueOutcomeEvent(eventId, reward); // Use 204 as there is no return value return new EventResponse(204); @@ -121,7 +121,7 @@ public Response RewardMultiSlot(string eventId, IList sl foreach (PersonalizerSlotReward slotReward in slotRewards) { // Call QueueOutcomeEvent of local RL.Net - _liveModel.QueueOutcomeEvent(eventId, slotReward.SlotId, slotReward.Value); + liveModel.QueueOutcomeEvent(eventId, slotReward.SlotId, slotReward.Value); } // Use 204 as there is no return value @@ -133,7 +133,7 @@ public Response RewardMultiSlot(string eventId, IList sl public Response Activate(string eventId) { // Call ReportActionTaken of local RL.Net - _liveModel.QueueActionTakenEvent(eventId); + liveModel.QueueActionTakenEvent(eventId); // Use 204 as there is no return value return new EventResponse(204); diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs index b6810870f7a09..cfdba535e44bb 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/RlObjectConverter.cs @@ -26,7 +26,7 @@ public static string ConvertToContextJson(IEnumerable contextFeatures, L /// public static PersonalizerRankResult GenerateRankResult(List originalActions, List rankableActions, List excludedActions, - RankingResponse rankingResponse, string eventId) + RankingResponseWrapper rankingResponse, string eventId) { var rankedIndices = rankingResponse?.Select(actionProbability => ((int)actionProbability.ActionIndex + 1)).ToArray(); @@ -68,28 +68,20 @@ private static PersonalizerRankResult GenerateRankResultInner(List + var ranking = rankedIndices?.Select((index, i) => { var action = originalActions[index - 1]; - return new PersonalizerRankedAction() - { - Id = action.Id, - Probability = rankingProbabilities[i] - }; + return new PersonalizerRankedAction(action.Id, rankingProbabilities[i]); }).ToList(); - //setting RewardActionId to be the VW chosen action. - personalizerRankResult.RewardActionId = originalActions.ElementAt(chosenActionIndex)?.Id; + // setting RewardActionId to be the VW chosen action. + var personalizerRankResult = new PersonalizerRankResult(ranking, eventId, originalActions.ElementAt(chosenActionIndex)?.Id); return personalizerRankResult; } - public static PersonalizerMultiSlotRankResult GenerateMultiSlotRankResponse(IList actions, MultiSlotResponseDetailed multiSlotResponse, string eventId) + public static PersonalizerMultiSlotRankResult GenerateMultiSlotRankResponse(IList actions, MultiSlotResponseDetailedWrapper multiSlotResponse, string eventId) { Dictionary actionIndexToActionId = actions .Select((action, index) => new { action, index = (long)index }) diff --git a/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingResponseWrapper.cs b/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingResponseWrapper.cs new file mode 100644 index 0000000000000..9e806ca4eada5 --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/src/Models/SlotRankingResponseWrapper.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Rl.Net; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Personalizer +{ + /// The Wrapper for Rl.Net.SlotRankingResponse + public class SlotRankingResponseWrapper : IEnumerable + { + private readonly SlotRanking _slotRanking; + + /// Initializes a new instance of SlotRankingResponseWrapper. + public SlotRankingResponseWrapper() + {} + + /// Initializes a new instance of SlotRankingResponseWrapper. + public SlotRankingResponseWrapper(SlotRanking slotRanking) + { + _slotRanking = slotRanking ?? throw new ArgumentNullException(nameof(slotRanking)); + } + + /// Id of the slot ranking + public virtual string SlotId { get { return _slotRanking.SlotId; } } + + /// The chosen action id + public virtual long ChosenAction { get { return _slotRanking.ChosenAction; } } + + /// The count of the slot ranking + public virtual long Count { get { return _slotRanking.Count; } } + + /// The enumerator + public virtual IEnumerator GetEnumerator() + { + var enu = _slotRanking.GetEnumerator(); + while (enu.MoveNext()) + { + yield return new ActionProbabilityWrapper(enu.Current); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj index a4ebd5b5462be..19aa876b78d2c 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Azure.AI.Personalizer.Tests.csproj @@ -7,7 +7,7 @@ $(NoWarn);CS8032 - + diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs index 58ede423a35c8..254a2837bd38e 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Infrastructure/PersonalizerTestBase.cs @@ -2,8 +2,12 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Azure.Core.TestFramework; +using Moq; +using Rl.Net; namespace Azure.AI.Personalizer.Tests { @@ -11,6 +15,74 @@ public abstract class PersonalizerTestBase : RecordedTestBase ranking; + private readonly long actionIndex; + private readonly string slotId; + + public override long ChosenAction { get { return this.actionIndex; } } + + public override string SlotId { get { return this.slotId; } } + + public SlotRankingWrapperForTest(long actionIndex, string slotId, IEnumerable ranked) : base() + { + this.actionIndex = actionIndex; + this.slotId = slotId; + this.ranking = ranked; + } + + public override IEnumerator GetEnumerator() + { + return ranking.GetEnumerator(); + } + } + + private class RankingResponseWrapperForTest : RankingResponseWrapper + { + private IEnumerable rank; + + public RankingResponseWrapperForTest(IEnumerable ranked) : base() + { + rank = ranked; + } + + public override IEnumerator GetEnumerator() + { + return rank.GetEnumerator(); + } + } + + private class MultiSlotResponseWrapperForTest : MultiSlotResponseDetailedWrapper + { + private IEnumerable slotRank; + + public MultiSlotResponseWrapperForTest(IEnumerable rankedSlot) : base() + { + slotRank = rankedSlot; + } + + public override IEnumerator GetEnumerator() + { + return slotRank.GetEnumerator(); + } + } + public PersonalizerTestBase(bool isAsync) : base(isAsync) { // TODO: Compare bodies again when https://github.com/Azure/azure-sdk-for-net/issues/22219 is resolved. @@ -32,7 +104,16 @@ protected async Task GetPersonalizerClientAsync(bool isSingl PersonalizerClient personalizerClient = null; if (isLocalInference) { - personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options: options, subsampleRate: subsampleRate); + if (Mode == RecordedTestMode.Playback) + { + RlNetProcessor rlNetProcessor = SetupRlNetProcessor(); + + personalizerClient = new PersonalizerClientForTest(new Uri(endpoint), credential, true, rlNetProcessor, options: options, subsampleRate: subsampleRate); + } + else + { + personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, true, options: options, subsampleRate: subsampleRate); + } } else { @@ -64,5 +145,55 @@ private async Task EnableMultiSlot(PersonalizerAdministrationClient adminClient) //sleep 30 seconds to allow settings to propagate await Delay(30000); } + + private RlNetProcessor SetupRlNetProcessor() + { + Mock mockLiveModel = new Mock(); + + List actionProbability = new List + { + new ActionProbabilityWrapperForTest(0, 1f) + }; + + RankingResponseWrapper responseWrapper = new RankingResponseWrapperForTest(actionProbability); + mockLiveModel.Setup(m => m.ChooseRank(It.IsAny(), It.IsAny(), ActionFlags.Default)).Returns(responseWrapper); + + Dictionary> slotRankedActions = GetSlotActionProbabilityList(); + List rankedSlots = new List(); + + foreach (var item in slotRankedActions) + { + var slotRankingWrapperForTest = new SlotRankingWrapperForTest(item.Value.FirstOrDefault().ActionIndex, item.Key, item.Value); + rankedSlots.Add(slotRankingWrapperForTest); + } + + MultiSlotResponseDetailedWrapper multiSlotResponseWrapper = new MultiSlotResponseWrapperForTest(rankedSlots); + + mockLiveModel.Setup(m => m.RequestMultiSlotDecisionDetailed(It.IsAny(), It.IsAny(), ActionFlags.Default, It.IsAny())).Returns(multiSlotResponseWrapper); + mockLiveModel.Setup(m => m.QueueOutcomeEvent(It.IsAny(), It.IsAny())).Verifiable(); + mockLiveModel.Setup(m => m.QueueOutcomeEvent(It.IsAny(), It.IsAny(), It.IsAny())).Verifiable(); + mockLiveModel.Setup(m => m.QueueActionTakenEvent(It.IsAny())).Verifiable(); + + return new RlNetProcessor(mockLiveModel.Object); + } + + private Dictionary> GetSlotActionProbabilityList() + { + Dictionary> dict = new Dictionary>(); + + List slot1list = new List + { + new ActionProbabilityWrapperForTest(0, 1f) + }; + dict.Add("Main Article", slot1list); + + List slot2list = new List + { + new ActionProbabilityWrapperForTest(1, 1f) + }; + dict.Add("Side Bar", slot2list); + + return dict; + } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs index 88150d6e686eb..6db5675f13590 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/DecisionContextTests.cs @@ -24,10 +24,10 @@ public void DecisionContextConstructorTest() DecisionContext decisionContext = new DecisionContext(contextFeatures, actions); Assert.AreEqual(decisionContext.ContextFeatures.Count, 1); Assert.IsTrue(decisionContext.ContextFeatures[0].Equals("{\"Features\":{\"day\":\"Monday\",\"time\":\"morning\",\"weather\":\"sunny\"}}")); - Assert.AreEqual(decisionContext.Documents.Length, 1); - Assert.AreEqual(decisionContext.Documents[0].JSON.Count, 2); - Assert.IsTrue(decisionContext.Documents[0].JSON[0].Equals("{\"videoType\":\"documentary\",\"videoLength\":35,\"director\":\"CarlSagan\"}")); - Assert.IsTrue(decisionContext.Documents[0].JSON[1].Equals("{\"mostWatchedByAge\":\"30-35\"}")); + Assert.AreEqual(decisionContext.Documents.Count, 1); + Assert.AreEqual(decisionContext.Documents[0].ActionFeatureJsons.Count, 2); + Assert.IsTrue(decisionContext.Documents[0].ActionFeatureJsons[0].Equals("{\"videoType\":\"documentary\",\"videoLength\":35,\"director\":\"CarlSagan\"}")); + Assert.IsTrue(decisionContext.Documents[0].ActionFeatureJsons[1].Equals("{\"mostWatchedByAge\":\"30-35\"}")); } } } diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs new file mode 100644 index 0000000000000..b551f79c358de --- /dev/null +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/PersonalizerClientForTest.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading; +using NUnit.Framework.Constraints; + +namespace Azure.AI.Personalizer.Tests +{ + internal class PersonalizerClientForTest : PersonalizerClient + { + private RlNetProcessor rlNetProcessor; + + public PersonalizerClientForTest(Uri endpoint, AzureKeyCredential credential, bool isLocalInference, RlNetProcessor rlNetProcessor, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : + base(endpoint, credential, isLocalInference, subsampleRate, options) + { + this.rlNetProcessor = rlNetProcessor; + } + + internal override RlNetProcessor GetConfigurationForRankProcessor(CancellationToken cancellationToken = default) + { + return rlNetProcessor; + } + } +} diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs index 85ee4a05be5db..86e9b55482d63 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RankTests.cs @@ -46,7 +46,7 @@ private async Task RankNullParameters(PersonalizerClient client) features: new List() { new { videoType = "documentary", videoLength = 35, director = "CarlSagan" }, new { mostWatchedByAge = "30-35" } } )); - var request = new PersonalizerRankOptions(actions); + var request = new PersonalizerRankOptions(actions, null, null); // Action PersonalizerRankResult response = await client.RankAsync(request); // Assert diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs index 1718f679109cf..b51b62c941940 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/Personalizer/RlObjectConverterTests.cs @@ -44,7 +44,6 @@ public void ConvertToContextJsonTest() "\"weather\":\"sunny\"}}]," + "\"_multi\":[{" + "\"_tag\":\"Person\"," + - "\"i\":{\"constant\":1,\"id\":\"Person\"}," + "\"j\":[{" + "\"videoType\":\"documentary\"," + "\"videoLength\":35," + diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json index c393e2608feaa..7034d19d4afaa 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTest.json @@ -44,6 +44,210 @@ "autoOptimizationStartDate": "2021-10-30T14:41:23" } }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + } + }, { "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", "RequestMethod": "PUT", @@ -244,46 +448,60 @@ "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" } }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + } + }, { "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", - "Content-Length": "771", + "Content-Length": "511", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-dc7d4c7f96b2ef4bbdcb172245f6c48c-b8ca17898f77d54b-00", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "75961857c5237312446a1af9a48fd15c", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", "x-ms-return-client-request-id": "true" }, "RequestBody": { - "contextFeatures": [ - { - "User": { - "ProfileType": "AnonymousUser", - "LatLong": "47.6,-122.1" - } - }, - { - "Environment": { - "DayOfMonth": "28", - "MonthOfYear": "8", - "Weather": "Sunny" - } - }, - { - "Device": { - "Mobile": true, - "Windows": true - } - }, - { - "RecentActivity": { - "ItemsInCart": 3 - } - } - ], "actions": [ { "id": "NewsArticle", @@ -338,12 +556,11 @@ ], "baselineAction": "SportsArticle" } - ], - "deferActivation": false + ] }, "StatusCode": 201, "ResponseHeaders": { - "apim-request-id": "75a2d446-8415-4c5e-8898-ac0d56b05a19", + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", "Cache-Control": [ "no-cache", "no-store", @@ -351,13 +568,13 @@ ], "Content-Length": "166", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:46 GMT", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", "Expires": "0", "pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "timing-allow-origin": "*", "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "656" + "x-envoy-upstream-service-time": "6687" }, "ResponseBody": { "slots": [ @@ -370,7 +587,47 @@ "rewardActionId": "SportsArticle" } ], - "eventId": "3c8158a8634e45938889eef503eca7c1-8Io5Y" + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" } }, { @@ -378,41 +635,15 @@ "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", - "Content-Length": "798", + "Content-Length": "511", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-5ce193a77854fa4f8cbede3b8b961658-db3b4a8ec090dd4e-00", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "1473b19eb49357f9e70e3aade0f0d4cd", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", "x-ms-return-client-request-id": "true" }, "RequestBody": { - "contextFeatures": [ - { - "User": { - "ProfileType": "AnonymousUser", - "LatLong": "47.6,-122.1" - } - }, - { - "Environment": { - "DayOfMonth": "28", - "MonthOfYear": "8", - "Weather": "Sunny" - } - }, - { - "Device": { - "Mobile": true, - "Windows": true - } - }, - { - "RecentActivity": { - "ItemsInCart": 3 - } - } - ], "actions": [ { "id": "NewsArticle", @@ -467,27 +698,25 @@ ], "baselineAction": "SportsArticle" } - ], - "eventId": "sdkTestEventId", - "deferActivation": false + ] }, "StatusCode": 201, "ResponseHeaders": { - "apim-request-id": "5a5ee1b3-3e35-4e59-a67b-1179972d8abb", + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", "Cache-Control": [ "no-cache", "no-store", "must-revalidate" ], - "Content-Length": "142", + "Content-Length": "166", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", "Expires": "0", "pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "timing-allow-origin": "*", "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "438" + "x-envoy-upstream-service-time": "6687" }, "ResponseBody": { "slots": [ @@ -500,116 +729,8 @@ "rewardActionId": "SportsArticle" } ], - "eventId": "sdkTestEventId" + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "44", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-544c75c6622f6042b29c0e5559b2491d-92512bae864a3745-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "dc54762ad9152f5271c05453f7a4ee60", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "reward": [ - { - "slotId": "testSlot", - "value": 1 - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "147e62d7-78a6-4c0b-9712-5d15e21a90a9", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "417" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "44", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-76c0680ef4b76c49a79cd70ba19fdbcd-7b068eb1e129124c-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "3e3c138bed11a2d11f3e8d158a649254", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "reward": [ - { - "slotId": "testSlot", - "value": 1 - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "514ad45a-8228-44b0-b988-833e3f9f6c0c", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "41" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/activate", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-d9cc3eb2ee96b04cbcea9ee817a9e6c7-c6c37aa27c2f804e-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "2dce4d96f53ac4475e43a2d360a66042", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "50174a48-9297-4f7f-bc69-99fd75a90600", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:48 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "40" - }, - "ResponseBody": [] } ], "Variables": { diff --git a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json index a670ef1173cbf..7034d19d4afaa 100644 --- a/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json +++ b/sdk/personalizer/Azure.AI.Personalizer/tests/SessionRecords/MultiSlotTests/MultiSlotLocalInferenceTestAsync.json @@ -1,620 +1,741 @@ { - "Entries": [ - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "350", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:54:18 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "7343" - }, - "ResponseBody": { - "rewardWaitTime": "PT10M", - "defaultReward": 0.0, - "rewardAggregation": "earliest", - "explorationPercentage": 0.2, - "modelExportFrequency": "PT5M", - "logRetentionDays": 90, - "lastConfigurationEditDate": "1601-01-01T00:00:00", - "learningMode": "Online", - "isAutoOptimizationEnabled": false, - "autoOptimizationFrequency": "P28D", - "autoOptimizationStartDate": "2021-10-30T14:41:23" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", - "RequestMethod": "PUT", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "358", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "rewardWaitTime": "PT10M", - "defaultReward": 0, - "rewardAggregation": "earliest", - "explorationPercentage": 0.200000003, - "modelExportFrequency": "PT5M", - "logRetentionDays": 90, - "lastConfigurationEditDate": "1601-01-01T00:00:00Z", - "learningMode": "Online", - "isAutoOptimizationEnabled": false, - "autoOptimizationFrequency": "P28D", - "autoOptimizationStartDate": "2021-10-30T14:41:23Z" - }, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "351", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:54:29 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "10620" - }, - "ResponseBody": { - "rewardWaitTime": "PT10M", - "defaultReward": 0.0, - "rewardAggregation": "earliest", - "explorationPercentage": 0.2, - "modelExportFrequency": "PT5M", - "logRetentionDays": 90, - "lastConfigurationEditDate": "1601-01-01T00:00:00", - "learningMode": "Online", - "isAutoOptimizationEnabled": false, - "autoOptimizationFrequency": "P28D", - "autoOptimizationStartDate": "2021-10-30T14:41:23Z" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", - "RequestMethod": "PUT", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "107", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "name": "multiSlot", - "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" - }, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "130", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:08 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "9284" - }, - "ResponseBody": { - "name": "8c31472ec8f14f65b37a0b1a14d743c7", - "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "511", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "actions": [ - { - "id": "NewsArticle", - "features": [ - { - "Type": "News" - } - ] - }, - { - "id": "SportsArticle", - "features": [ - { - "Type": "Sports" - } - ] - }, - { - "id": "EntertainmentArticle", - "features": [ - { - "Type": "Entertainment" - } - ] - } - ], - "slots": [ - { - "id": "Main Article", - "features": [ - { - "Size": "Large", - "Position": "Top Middle" - } - ], - "excludedActions": [ - "SportsArticle", - "EntertainmentArticle" - ], - "baselineAction": "NewsArticle" - }, - { - "id": "Side Bar", - "features": [ - { - "Size": "Small", - "Position": "Bottom Right" - } - ], - "excludedActions": [ - "EntertainmentArticle" - ], - "baselineAction": "SportsArticle" - } - ] - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "166", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:45 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "6687" - }, - "ResponseBody": { - "slots": [ - { - "id": "Main Article", - "rewardActionId": "NewsArticle" - }, - { - "id": "Side Bar", - "rewardActionId": "SportsArticle" - } - ], - "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "771", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-dc7d4c7f96b2ef4bbdcb172245f6c48c-b8ca17898f77d54b-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "75961857c5237312446a1af9a48fd15c", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "contextFeatures": [ - { - "User": { - "ProfileType": "AnonymousUser", - "LatLong": "47.6,-122.1" + "Entries": [ + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" } - }, - { - "Environment": { - "DayOfMonth": "28", - "MonthOfYear": "8", - "Weather": "Sunny" + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" } - }, - { - "Device": { - "Mobile": true, - "Windows": true + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9c74aaef3c2d614ab5f080d13d24efa5-d8a8ad2a3170a94c-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "77242a1418c89aed2ca4cffffac5f01d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "17aa5251-25e6-42f1-a927-2498bac39e06", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "350", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:18 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "7343" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23" } - }, - { - "RecentActivity": { - "ItemsInCart": 3 + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" } - } - ], - "actions": [ - { - "id": "NewsArticle", - "features": [ - { - "Type": "News" - } - ] - }, - { - "id": "SportsArticle", - "features": [ - { - "Type": "Sports" - } - ] - }, - { - "id": "EntertainmentArticle", - "features": [ - { - "Type": "Entertainment" - } - ] - } - ], - "slots": [ - { - "id": "Main Article", - "features": [ - { - "Size": "Large", - "Position": "Top Middle" - } - ], - "excludedActions": [ - "SportsArticle", - "EntertainmentArticle" - ], - "baselineAction": "NewsArticle" - }, - { - "id": "Side Bar", - "features": [ - { - "Size": "Small", - "Position": "Bottom Right" - } - ], - "excludedActions": [ - "EntertainmentArticle" - ], - "baselineAction": "SportsArticle" - } - ], - "deferActivation": false - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "75a2d446-8415-4c5e-8898-ac0d56b05a19", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "166", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:46 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "656" - }, - "ResponseBody": { - "slots": [ - { - "id": "Main Article", - "rewardActionId": "NewsArticle" - }, - { - "id": "Side Bar", - "rewardActionId": "SportsArticle" - } - ], - "eventId": "3c8158a8634e45938889eef503eca7c1-8Io5Y" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "798", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-5ce193a77854fa4f8cbede3b8b961658-db3b4a8ec090dd4e-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "1473b19eb49357f9e70e3aade0f0d4cd", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "contextFeatures": [ - { - "User": { - "ProfileType": "AnonymousUser", - "LatLong": "47.6,-122.1" + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" } - }, - { - "Environment": { - "DayOfMonth": "28", - "MonthOfYear": "8", - "Weather": "Sunny" + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/service", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "358", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0baceb84bc11f9409b3f6363a2a6e9b8-3de509323a27f945-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "6c2e10c38025c73b07ed276898c74db7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.200000003, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00Z", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "197ee618-d5cd-4381-9438-74969f602adb", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "351", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:54:29 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "10620" + }, + "ResponseBody": { + "rewardWaitTime": "PT10M", + "defaultReward": 0.0, + "rewardAggregation": "earliest", + "explorationPercentage": 0.2, + "modelExportFrequency": "PT5M", + "logRetentionDays": 90, + "lastConfigurationEditDate": "1601-01-01T00:00:00", + "learningMode": "Online", + "isAutoOptimizationEnabled": false, + "autoOptimizationFrequency": "P28D", + "autoOptimizationStartDate": "2021-10-30T14:41:23Z" } - }, - { - "Device": { - "Mobile": true, - "Windows": true + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" } - }, - { - "RecentActivity": { - "ItemsInCart": 3 + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "511", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "166", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "6687" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" } - } - ], - "actions": [ - { - "id": "NewsArticle", - "features": [ - { - "Type": "News" - } - ] - }, - { - "id": "SportsArticle", - "features": [ - { - "Type": "Sports" - } - ] - }, - { - "id": "EntertainmentArticle", - "features": [ - { - "Type": "Entertainment" - } - ] - } - ], - "slots": [ - { - "id": "Main Article", - "features": [ - { - "Size": "Large", - "Position": "Top Middle" - } - ], - "excludedActions": [ - "SportsArticle", - "EntertainmentArticle" - ], - "baselineAction": "NewsArticle" - }, - { - "id": "Side Bar", - "features": [ - { - "Size": "Small", - "Position": "Bottom Right" - } - ], - "excludedActions": [ - "EntertainmentArticle" - ], - "baselineAction": "SportsArticle" - } - ], - "eventId": "sdkTestEventId", - "deferActivation": false - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "5a5ee1b3-3e35-4e59-a67b-1179972d8abb", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "142", - "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "timing-allow-origin": "*", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "438" - }, - "ResponseBody": { - "slots": [ - { - "id": "Main Article", - "rewardActionId": "NewsArticle" - }, - { - "id": "Side Bar", - "rewardActionId": "SportsArticle" - } - ], - "eventId": "sdkTestEventId" - } - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "44", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-544c75c6622f6042b29c0e5559b2491d-92512bae864a3745-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "dc54762ad9152f5271c05453f7a4ee60", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "reward": [ - { - "slotId": "testSlot", - "value": 1 - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "147e62d7-78a6-4c0b-9712-5d15e21a90a9", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "417" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/reward", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "44", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-76c0680ef4b76c49a79cd70ba19fdbcd-7b068eb1e129124c-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "3e3c138bed11a2d11f3e8d158a649254", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "reward": [ - { - "slotId": "testSlot", - "value": 1 - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "514ad45a-8228-44b0-b988-833e3f9f6c0c", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:47 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "41" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/events/123456789/activate", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-d9cc3eb2ee96b04cbcea9ee817a9e6c7-c6c37aa27c2f804e-00", - "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", - "x-ms-client-request-id": "2dce4d96f53ac4475e43a2d360a66042", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "50174a48-9297-4f7f-bc69-99fd75a90600", - "Cache-Control": [ - "no-cache", - "no-store", - "must-revalidate" - ], - "Content-Length": "0", - "Date": "Fri, 15 Oct 2021 14:55:48 GMT", - "Expires": "0", - "pragma": "no-cache", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "x-content-type-options": "nosniff", - "x-envoy-upstream-service-time": "40" - }, - "ResponseBody": [] + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "511", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "166", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "6687" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/configurations/policy", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "107", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-19a0e4612ac1da4581f72b6d18ea8e81-8920b4421300a543-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "2aa28569500ac4cb522cdcabf5ab4e76", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "multiSlot", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + }, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "d64f301a-1d7e-4bca-8b41-bec966ada9d4", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "130", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:08 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "9284" + }, + "ResponseBody": { + "name": "8c31472ec8f14f65b37a0b1a14d743c7", + "arguments": "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::" + } + }, + { + "RequestUri": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/personalizer/v1.1-preview.3/multislot/rank", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "511", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0c60895e3f2edd4697e2bd613367eb10-cdbbc916d02fc949-00", + "User-Agent": "azsdk-net-AI.Personalizer/2.0.0-alpha.20211014.1 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.22000 )", + "x-ms-client-request-id": "983383f511bd939def5d6fdbf0840165", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "actions": [ + { + "id": "NewsArticle", + "features": [ + { + "Type": "News" + } + ] + }, + { + "id": "SportsArticle", + "features": [ + { + "Type": "Sports" + } + ] + }, + { + "id": "EntertainmentArticle", + "features": [ + { + "Type": "Entertainment" + } + ] + } + ], + "slots": [ + { + "id": "Main Article", + "features": [ + { + "Size": "Large", + "Position": "Top Middle" + } + ], + "excludedActions": [ + "SportsArticle", + "EntertainmentArticle" + ], + "baselineAction": "NewsArticle" + }, + { + "id": "Side Bar", + "features": [ + { + "Size": "Small", + "Position": "Bottom Right" + } + ], + "excludedActions": [ + "EntertainmentArticle" + ], + "baselineAction": "SportsArticle" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "eb35cecc-49a1-477d-a636-7542ebca562d", + "Cache-Control": [ + "no-cache", + "no-store", + "must-revalidate" + ], + "Content-Length": "166", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 15 Oct 2021 14:55:45 GMT", + "Expires": "0", + "pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "timing-allow-origin": "*", + "x-content-type-options": "nosniff", + "x-envoy-upstream-service-time": "6687" + }, + "ResponseBody": { + "slots": [ + { + "id": "Main Article", + "rewardActionId": "NewsArticle" + }, + { + "id": "Side Bar", + "rewardActionId": "SportsArticle" + } + ], + "eventId": "2ae3324436df4819aa636316fd5c9e22-8Io5X" + } + } + ], + "Variables": { + "PERSONALIZER_API_KEY_MULTI_SLOT": "Sanitized", + "PERSONALIZER_ENDPOINT_MULTI_SLOT": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/", + "RandomSeed": "2030725436" } - ], - "Variables": { - "PERSONALIZER_API_KEY_MULTI_SLOT": "Sanitized", - "PERSONALIZER_ENDPOINT_MULTI_SLOT": "https://sdktestmultislot.ppe.cognitiveservices.azure.com/", - "RandomSeed": "2030725436" - } -} \ No newline at end of file +}