Skip to content

Commit

Permalink
Azure OpenAI: 2.0.0-beta.2 release (#44591)
Browse files Browse the repository at this point in the history
* beta.2

* trim unrelated test

* restore flexible dependency version
  • Loading branch information
trrwilson authored Jun 15, 2024
1 parent 2005968 commit 6adc0dc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
8 changes: 6 additions & 2 deletions sdk/openai/Azure.AI.OpenAI/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Release History

## 2.0.0-beta.2 (Unreleased)
## 2.0.0-beta.2 (2024-06-14)

### Features Added

- Per changes to the [OpenAI .NET client library](https://github.com/openai/openai-dotnet), most convenience methods now provide the direct ability to provide optional `CancellationTokens`, removing the need to use protocol methods

### Breaking Changes

- In support of `CancellationToken`s in methods, an overriden method signature for streaming chat completions was changed and a new minimum version dependency of 2.0.0-beta.5 is established for the OpenAI dependency. These styles of breaks will be extraordinarily rare.

### Bugs Fixed

### Other Changes
- See breaking changes: when streaming chat completions, an error of "Unrecognized request argument supplied: stream_options" is introduced when using Azure.AI.OpenAI 2.0.0-beta.1 with OpenAI 2.0.0-beta.5+. This is fixed with the new version.

## 2.0.0-beta.1 (2024-06-07)

Expand Down
8 changes: 4 additions & 4 deletions sdk/openai/Azure.AI.OpenAI/src/Custom/Chat/AzureChatClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ protected AzureChatClient()
{ }

/// <inheritdoc/>
public override AsyncResultCollection<StreamingChatCompletionUpdate> CompleteChatStreamingAsync(IEnumerable<ChatMessage> messages, ChatCompletionOptions options = null)
public override AsyncResultCollection<StreamingChatCompletionUpdate> CompleteChatStreamingAsync(IEnumerable<ChatMessage> messages, ChatCompletionOptions options = null, CancellationToken cancellationToken = default)
{
options ??= new();
options.StreamOptions = null;
return base.CompleteChatStreamingAsync(messages, options);
return base.CompleteChatStreamingAsync(messages, options, cancellationToken);
}

/// <inheritdoc/>
public override ResultCollection<StreamingChatCompletionUpdate> CompleteChatStreaming(IEnumerable<ChatMessage> messages, ChatCompletionOptions options = null)
public override ResultCollection<StreamingChatCompletionUpdate> CompleteChatStreaming(IEnumerable<ChatMessage> messages, ChatCompletionOptions options = null, CancellationToken cancellationToken = default)
{
options ??= new();
options.StreamOptions = null;
return base.CompleteChatStreaming(messages, options);
return base.CompleteChatStreaming(messages, options, cancellationToken);
}
}
6 changes: 3 additions & 3 deletions sdk/openai/Azure.AI.OpenAI/tests/AssistantTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public async Task BasicRunStepFunctionalityWorks()
});
Validate(assistant);

AssistantThread thread = await client.CreateThreadAsync(new()
AssistantThread thread = await client.CreateThreadAsync(new ThreadCreationOptions()
{
InitialMessages = { new(["Please graph the equation y = 3x + 4"]), },
});
Expand Down Expand Up @@ -598,7 +598,7 @@ This file describes the favorite foods of several people.
hasCake |= content.Text?.ToLowerInvariant().Contains("cake") == true;
foreach (TextAnnotation annotation in content.TextAnnotations)
{
Console.WriteLine($" --> From file: {annotation.InputFileId}, quote: {annotation.InputQuote}, replacement: {annotation.TextToReplace}");
Console.WriteLine($" --> From file: {annotation.InputFileId}, replacement: {annotation.TextToReplace}");
}
}
}
Expand All @@ -614,7 +614,7 @@ public async Task StreamingRunWorks()
Assistant assistant = await client.CreateAssistantAsync(modelName);
Validate(assistant);

AssistantThread thread = await client.CreateThreadAsync(new()
AssistantThread thread = await client.CreateThreadAsync(new ThreadCreationOptions()
{
InitialMessages = { new(["Hello there, assistant! How are you today?"]), },
});
Expand Down
4 changes: 2 additions & 2 deletions sdk/openai/Azure.AI.OpenAI/tests/VectorStoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task CanCreateGetAndDeleteVectorStores()

IReadOnlyList<OpenAIFileInfo> testFiles = await GetNewTestFilesAsync(5);

vectorStore = await client.CreateVectorStoreAsync(new()
vectorStore = await client.CreateVectorStoreAsync(new VectorStoreCreationOptions()
{
FileIds = { testFiles[0].Id },
Name = "test vector store",
Expand Down Expand Up @@ -84,7 +84,7 @@ public async Task CanCreateGetAndDeleteVectorStores()
deleted = await client.DeleteVectorStoreAsync(vectorStore.Id);
Assert.That(deleted, Is.True);

vectorStore = await client.CreateVectorStoreAsync(new()
vectorStore = await client.CreateVectorStoreAsync(new VectorStoreCreationOptions()
{
FileIds = testFiles.Select(file => file.Id).ToList()
});
Expand Down

0 comments on commit 6adc0dc

Please sign in to comment.