-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Add RankProcessor Remove unused file Remove some key Toggle commented codes so that most tests can pass RankProcessor is working. Still need to clean up the codes Add test json files only construct LiveModel when localInference is true Move rankprocessor to under model Add latest generated files from autorest Add autogenerated files from autorest Fix the setting in DecisionContext Remove wrong comment Revert unexpected auto-generated file changes Addressed a comment Move suppression to GlobalSuppressions.cs Remove the decoration in MultiSlotClient.cs Refactor rankProcessor so that the actions is not modified and restored; added a converter between sdk and Rl.Net; replace Newtonsoft.json with System.Text.Json Address comments Refactor RlObjuectConverter; remove some unneeded setters, etc. Added unit tests for RlObjectConverter, DecisionContext, JsonRawStringListConverter Remove unused using
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Azure.AI.Personalizer | ||
{ | ||
/// <summary> The Decision Context. </summary> | ||
public class DecisionContext | ||
{ | ||
/// <summary> The Decision Context used to serialize an object. </summary> | ||
public DecisionContext() | ||
{ | ||
} | ||
|
||
/// <summary> Initializes a new instance of DecisionContext. </summary> | ||
/// <param name="contextFeatures"> The context feature </param> | ||
/// <param name="rankableActions"> Rankable actions </param> | ||
public DecisionContext(IEnumerable<object> contextFeatures, List<PersonalizerRankableAction> rankableActions) | ||
{ | ||
this.ContextFeatures = contextFeatures.Select(f => JsonSerializer.Serialize(f)).ToList(); | ||
this.Documents = rankableActions | ||
.Select(action => | ||
{ | ||
List<string> actionFeatures = action.Features.Select(f => JsonSerializer.Serialize(f)).ToList(); | ||
return new DecisionContextDocument(action.Id, actionFeatures); | ||
}).ToArray(); | ||
} | ||
|
||
/// <summary> Properties from url </summary> | ||
[JsonPropertyName("FromUrl")] | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
[JsonConverter(typeof(JsonRawStringListConverter))] | ||
public List<string> ContextFeatures { get; } | ||
|
||
/// <summary> Properties of documents </summary> | ||
[JsonPropertyName("_multi")] | ||
public DecisionContextDocument[] Documents { get; set; } | ||
|
||
/// <summary> Properties of slots </summary> | ||
[JsonPropertyName("_slots")] | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public DecisionContextDocument[] Slots { get; set; } | ||
} | ||
} |