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

Azure OpenAI: remove incorrect 'purpose' check on FileClient.GetFiles() #44923

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions sdk/openai/Azure.AI.OpenAI/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bugs Fixed

- Removed an inappropriate null check in `FileClient.GetFiles()` (azure-sdk-for-net 44912)

### Other Changes

## 2.0.0-beta.2 (2024-06-14)
Expand Down
2 changes: 1 addition & 1 deletion sdk/openai/Azure.AI.OpenAI/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/openai/Azure.AI.OpenAI",
"Tag": "net/openai/Azure.AI.OpenAI_fc99a87ba7"
"Tag": "net/openai/Azure.AI.OpenAI_b36dc0424a"
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,13 @@ public override async Task<ClientResult> GetFileAsync(string fileId, RequestOpti
[EditorBrowsable(EditorBrowsableState.Never)]
public override ClientResult GetFiles(string purpose, RequestOptions options)
{
Argument.AssertNotNullOrEmpty(purpose, nameof(purpose));

using PipelineMessage message = CreateGetFilesRequestMessage(purpose, options);
return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
}

[EditorBrowsable(EditorBrowsableState.Never)]
public override async Task<ClientResult> GetFilesAsync(string purpose, RequestOptions options)
{
Argument.AssertNotNullOrEmpty(purpose, nameof(purpose));

using PipelineMessage message = CreateGetFilesRequestMessage(purpose, options);
return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
Expand Down
8 changes: 8 additions & 0 deletions sdk/openai/Azure.AI.OpenAI/tests/FileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ public async Task CanUploadAndDeleteFiles()
bool deleted = await client.DeleteFileAsync(file);
Assert.IsTrue(deleted);
}

[RecordedTest]
public async Task CanListFiles()
{
FileClient client = GetTestClient();
OpenAIFileInfoCollection files = await client.GetFilesAsync();
Assert.That(files, Has.Count.GreaterThan(0));
}
}