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