Skip to content

Commit

Permalink
.Net: Upgraded OpenAI and Azure OpenAI package versions (#9651)
Browse files Browse the repository at this point in the history
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

Changes in this PR:
- OpenAI and Azure OpenAI package versions upgrade and fix for small
breaking change in citation functionality described here:
https://github.com/Azure/azure-sdk-for-net/blob/bdd48fdb11070045007fcdcea52381dc5f7eda02/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md#breaking-changes-1
- Fix in Azure OpenAI unit tests - removed a test when `apiVersion`
parameter is passed as `null`, since the default value is regularly
changed on Azure OpenAI SDK side. Ideally, the default value behavior
should be tested on Azure OpenAI SDK side, while our tests should verify
that passed non-null value is used in final HTTP request address.

New package versions give access to Realtime API functionality.

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
  • Loading branch information
dmytrostruk authored Nov 12, 2024
1 parent 259c58c commit dcf682e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.VisualStudio.Threading" Version="17.11.20" />
<PackageVersion Include="MSTest.TestFramework" Version="3.6.1" />
<PackageVersion Include="OpenAI" Version="[2.1.0-beta.1]" />
<PackageVersion Include="OpenAI" Version="[2.1.0-beta.2]" />
<PackageVersion Include="Azure.AI.ContentSafety" Version="1.0.0" />
<PackageVersion Include="Azure.AI.OpenAI" Version="[2.1.0-beta.1]" />
<PackageVersion Include="Azure.AI.OpenAI" Version="[2.1.0-beta.2]" />
<PackageVersion Include="Azure.Identity" Version="1.13.1" />
<PackageVersion Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.3.0" />
<PackageVersion Include="Azure.Search.Documents" Version="11.6.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private void OutputCitations(IReadOnlyList<ChatCitation> citations)
Console.WriteLine($"Chunk ID: {citation.ChunkId}");
Console.WriteLine($"Title: {citation.Title}");
Console.WriteLine($"File path: {citation.FilePath}");
Console.WriteLine($"URI: {citation.Uri}");
Console.WriteLine($"URL: {citation.Url}");
Console.WriteLine($"Content: {citation.Content}");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ public async Task GetTextContentGranularitiesWorksCorrectlyAsync(string[]? granu

public static TheoryData<string?, string?> Versions => new()
{
{ null, "2024-08-01-preview" },
{ "V2024_10_01_preview", "2024-10-01-preview" },
{ "V2024_10_01_PREVIEW", "2024-10-01-preview" },
{ "2024_10_01_Preview", "2024-10-01-preview" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,6 @@ public async Task GetStreamingChatMessageContentsWithFunctionCallAndEmptyArgumen

public static TheoryData<string?, string?> Versions => new()
{
{ null, "2024-08-01-preview" },
{ "V2024_10_01_preview", "2024-10-01-preview" },
{ "V2024_10_01_PREVIEW", "2024-10-01-preview" },
{ "2024_10_01_Preview", "2024-10-01-preview" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public async Task ItTargetsApiVersionAsExpected(string? apiVersion, string? expe

public static TheoryData<string?, string?> Versions => new()
{
{ null, "2024-08-01-preview" },
{ "V2024_10_01_preview", "2024-10-01-preview" },
{ "V2024_10_01_PREVIEW", "2024-10-01-preview" },
{ "2024_10_01_Preview", "2024-10-01-preview" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ public async Task ItTargetsApiVersionAsExpected(string? apiVersion, string? expe

public static TheoryData<string?, string?> Versions => new()
{
{ null, "2024-08-01-preview" },
{ "V2024_10_01_preview", "2024-10-01-preview" },
{ "V2024_10_01_PREVIEW", "2024-10-01-preview" },
{ "2024_10_01_Preview", "2024-10-01-preview" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ public async Task ItTargetsApiVersionAsExpected(string? apiVersion, string? expe

public static TheoryData<string?, string?> Versions => new()
{
{ null, "2024-08-01-preview" },
{ "V2024_10_01_preview", "2024-10-01-preview" },
{ "V2024_10_01_PREVIEW", "2024-10-01-preview" },
{ "2024_10_01_Preview", "2024-10-01-preview" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ public async Task ChatCompletionShouldUseChatHistoryAndReturnMetadataAsync()

foreach (var key in update.Metadata!.Keys)
{
metadata[key] = update.Metadata[key];
if (!metadata.TryGetValue(key, out object? value) || value is null)
{
metadata[key] = update.Metadata[key];
}
}
}

Expand Down Expand Up @@ -123,7 +126,10 @@ public async Task TextGenerationShouldReturnMetadataAsync()

foreach (var key in update.Metadata!.Keys)
{
metadata[key] = update.Metadata[key];
if (!metadata.TryGetValue(key, out object? value) || value is null)
{
metadata[key] = update.Metadata[key];
}
}
}

Expand Down

0 comments on commit dcf682e

Please sign in to comment.