Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Personalizer] Thick client feature and Model Put API #26828

Merged
merged 36 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c9072da
12767912: Add isLocalInference in the public SDK
johnhuang01 Dec 9, 2021
2dc705e
Rename the variable
johnhuang01 Dec 9, 2021
926c450
Thick clent feature (#5)
johnhuang01 Jan 25, 2022
526b2bb
12768045: Add rank processor for single slot (#3)
johnhuang01 Jan 26, 2022
4284717
13009290: Create RankProcessor class to Azure Personalizer client lib…
johnhuang01 Feb 1, 2022
4c40b50
Subsampling
Tparuchuri Feb 3, 2022
63bffb9
Cleanup and added tests
Tparuchuri Feb 3, 2022
625033e
Cleanup and added tests
Tparuchuri Feb 3, 2022
fb0fd6a
cleanup
Tparuchuri Feb 3, 2022
d5058a5
cleanup
Tparuchuri Feb 3, 2022
329c0af
Single SubSample rate
Tparuchuri Feb 3, 2022
954818a
Cleanup
Tparuchuri Feb 3, 2022
43210dd
Cleanup
Tparuchuri Feb 4, 2022
d99d43f
Variable name
Tparuchuri Feb 4, 2022
9b1c3b0
13192221: Point to the Rl.Net nuget package from SDK dev drop (#9)
johnhuang01 Feb 7, 2022
93fd434
Adding test code for Model/Put api and moving to preview.3
Feb 8, 2022
137a442
Merge pull request #13 from sharathmalladi/users/sharathm/model_put
sharathmalladi Feb 8, 2022
740f238
Johnhuang/13216589 reward activate local inference api (#10)
johnhuang01 Feb 9, 2022
35a3120
Add more change after other PRs were merged
johnhuang01 Feb 9, 2022
92e8266
Revert "Add more change after other PRs were merged"
johnhuang01 Feb 9, 2022
1f72191
13225147: Update API view file for thick client (#11)
johnhuang01 Feb 9, 2022
fc8a166
lazy load rank processor, refresh config and relaod token on expiry …
Tparuchuri Feb 10, 2022
356fcbc
13309375: Improve the tests by mocking LiveModel when test mode is (#14)
johnhuang01 Feb 15, 2022
0526ce9
Fix spelling check
johnhuang01 Feb 15, 2022
5a49312
Remove the unneeded warning
johnhuang01 Feb 15, 2022
2b8dd1a
Update live model config
Tparuchuri Feb 15, 2022
b9fcb6f
Merge pull request #16 from johnhuang01/configcorrection
Tparuchuri Feb 16, 2022
98a8ab6
Use similar method names for export and import apis
Feb 18, 2022
3f648fa
Merge pull request #17 from sharathmalladi/users/sharathm/rename_mode…
sharathmalladi Feb 18, 2022
30aca4c
Johnhuang/13170630 address thick client sdk review (#18)
johnhuang01 Feb 23, 2022
0de97f5
Update recording sessions for tests that were changed in earlier comm…
sharathmalladi Feb 24, 2022
cbac31f
Update api view file after model api change (#20)
johnhuang01 Feb 24, 2022
cee47a8
Rename modelStream to modelBody (#21)
johnhuang01 Feb 25, 2022
eebc357
Update Microsoft.RL version
johnhuang01 Feb 28, 2022
fda656a
13678440: Some cosmetic change to address comments from DotNet team (…
johnhuang01 Feb 28, 2022
65e7fa7
Update method names for Export/Import models as per suggestions. (#23)
sharathmalladi Feb 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(RequiredTargetFrameworks);net47</TargetFrameworks>
<NoWarn>$(NoWarn);CS8032</NoWarn>
Mohit-Chakraborty marked this conversation as resolved.
Show resolved Hide resolved
<IncludeGeneratorSharedCode>true</IncludeGeneratorSharedCode>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions sdk/core/Azure.Core.TestFramework/src/TestRecording.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,12 @@ public TestRandom Random
#if NET6_0_OR_GREATER
var liveSeed = RandomNumberGenerator.GetInt32(int.MaxValue);
#else
#pragma warning disable SYSLIB0023
Mohit-Chakraborty marked this conversation as resolved.
Show resolved Hide resolved
var csp = new RNGCryptoServiceProvider();
var bytes = new byte[4];
csp.GetBytes(bytes);
var liveSeed = BitConverter.ToInt32(bytes, 0);
#pragma warning restore SYSLIB0023
#endif
_random = new TestRandom(Mode, liveSeed);
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyTitle>Microsoft Azure.AI.Personalizer client library</AssemblyTitle>
<Version>2.0.0-beta.2</Version>
Expand Down Expand Up @@ -32,6 +32,8 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Microsoft.RL" VersionOverride="1.0.18530001-INTERNAL" />
<PackageReference Include="System.Text.Json" VersionOverride="6.0.1" />
</ItemGroup>

</Project>

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
Expand Up @@ -4,3 +4,5 @@
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 = "<Pending>", Scope = "member", Target = "~P:Azure.AI.Personalizer.DecisionContextDocument.SlotJson")]
[assembly: SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "<Pending>", Scope = "member", Target = "~P:Azure.AI.Personalizer.PersonalizerSlotOptions.Features")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Text.Json;
using System.Text.Json.Serialization;
using System.Collections.Generic;
using System.Linq;

namespace Azure.AI.Personalizer
{
/// <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, null, null);
}).ToArray();
}

/// <summary> Initializes a new instance of DecisionContext. </summary>
/// <param name="rankRequest"> Personalizer multi-slot rank options </param>
/// <param name="slotIdToFeatures"> A map from slot id to its features </param>
public DecisionContext(PersonalizerRankMultiSlotOptions rankRequest, Dictionary<string, IList<object>> slotIdToFeatures)
{
this.ContextFeatures = rankRequest.ContextFeatures.Select(f => JsonSerializer.Serialize(f)).ToList();

this.Documents = rankRequest.Actions
.Select(action =>
{
List<string> actionFeatures = action.Features.Select(f => JsonSerializer.Serialize(f)).ToList();

return new DecisionContextDocument(action.Id, actionFeatures, null, null);
}).ToArray();
this.Slots = rankRequest.Slots?
.Select(
slot => new DecisionContextDocument(null, null, slot.Id, serializeFeatures(slotIdToFeatures[slot.Id]))
).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; }

private static List<string> serializeFeatures(IList<object> features)
{
List<string> result = new List<string>();
foreach (object feature in features)
{
result.Add(JsonSerializer.Serialize(feature));
}

return result;
}
}
}
Loading