Skip to content

Commit

Permalink
Merge branch 'main' into openapi-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
moonbox3 authored Nov 21, 2024
2 parents 5400c7f + 96b3595 commit 39f1986
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
14 changes: 7 additions & 7 deletions dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.ML.Tokenizers.Data.Cl100kBase" Version="1.0.0" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="6.34.0" />
<PackageVersion Include="Microsoft.VisualStudio.Threading" Version="17.11.20" />
<PackageVersion Include="Microsoft.VisualStudio.Threading" Version="17.12.19" />
<PackageVersion Include="MSTest.TestFramework" Version="3.6.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Npgsql" Version="8.0.5" />
Expand Down Expand Up @@ -62,9 +62,9 @@
<PackageVersion Include="Microsoft.DeepDev.TokenizerLib" Version="1.3.3" />
<PackageVersion Include="SharpToken" Version="2.0.3" />
<!-- Microsoft.Extensions.* -->
<PackageVersion Include="Microsoft.Extensions.AI" Version="9.0.0-preview.9.24525.1" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="9.0.0-preview.9.24525.1" />
<PackageVersion Include="Microsoft.Extensions.AI.AzureAIInference" Version="9.0.0-preview.9.24525.1" />
<PackageVersion Include="Microsoft.Extensions.AI" Version="9.0.0-preview.9.24556.5" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="9.0.0-preview.9.24556.5" />
<PackageVersion Include="Microsoft.Extensions.AI.AzureAIInference" Version="9.0.0-preview.9.24556.5" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
Expand Down Expand Up @@ -106,8 +106,8 @@
<PackageVersion Include="Microsoft.Identity.Client.Extensions.Msal" Version="[2.28.0, )" />
<PackageVersion Include="Microsoft.OpenApi" Version="1.6.22" />
<PackageVersion Include="Microsoft.OpenApi.Readers" Version="1.6.22" />
<PackageVersion Include="Microsoft.OpenApi.ApiManifest" Version="0.5.5-preview" />
<PackageVersion Include="Microsoft.Plugins.Manifest" Version="1.0.0-preview3" />
<PackageVersion Include="Microsoft.OpenApi.ApiManifest" Version="0.5.6-preview" />
<PackageVersion Include="Microsoft.Plugins.Manifest" Version="1.0.0-rc2" />
<PackageVersion Include="Google.Apis.CustomSearchAPI.v1" Version="[1.60.0.3001, )" />
<PackageVersion Include="Grpc.Net.Client" Version="2.66.0" />
<PackageVersion Include="protobuf-net" Version="3.2.45" />
Expand All @@ -130,7 +130,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.12.19" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ public async IAsyncEnumerable<StreamingChatMessageContent> GetStreamingChatMessa
{
options.TopK = topK;
}
else if (entry.Key.Equals("seed", StringComparison.OrdinalIgnoreCase) &&
TryConvert(entry.Value, out long seed))
{
options.Seed = seed;
}
else if (entry.Key.Equals("max_tokens", StringComparison.OrdinalIgnoreCase) &&
TryConvert(entry.Value, out int maxTokens))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ public void Dispose()
settings.ExtensionData["top_k"] = options.TopK.Value;
}

if (options.Seed is not null)
{
settings.ExtensionData["seed"] = options.Seed.Value;
}

if (options.ResponseFormat is not null)
{
if (options.ResponseFormat is ChatResponseFormatText)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public async Task AsChatCompletionServiceNonStreamingContentConvertedAsExpected(
Assert.Equal(0.5f, actualOptions.FrequencyPenalty);
Assert.Equal(0.75f, actualOptions.TopP);
Assert.Equal(["hello"], actualOptions.StopSequences);
Assert.Equal(42, actualOptions.AdditionalProperties?.TryGetValue("Seed", out int seed) is true ? seed : 0);
Assert.Equal(42, actualOptions.Seed);
Assert.Equal("user123", actualOptions.AdditionalProperties?["User"]);
}

Expand Down Expand Up @@ -621,7 +621,7 @@ public async Task AsChatCompletionServiceStreamingContentConvertedAsExpected()
Assert.Equal(0.5f, actualOptions.FrequencyPenalty);
Assert.Equal(0.75f, actualOptions.TopP);
Assert.Equal(["hello"], actualOptions.StopSequences);
Assert.Equal(42, actualOptions.AdditionalProperties?.TryGetValue("Seed", out int seed) is true ? seed : 0);
Assert.Equal(42, actualOptions.Seed);
Assert.Equal("user123", actualOptions.AdditionalProperties?["User"]);
}

Expand Down

0 comments on commit 39f1986

Please sign in to comment.