From c2b75409d69c135208359373f80d5feeda6d9a2b Mon Sep 17 00:00:00 2001 From: Travis Wilson Date: Tue, 9 Jul 2024 18:05:34 -0700 Subject: [PATCH] address null purpose check in FileClient GetFiles --- sdk/openai/Azure.AI.OpenAI/CHANGELOG.md | 2 ++ sdk/openai/Azure.AI.OpenAI/assets.json | 2 +- .../src/Custom/Files/AzureFileClient.Protocol.cs | 4 ---- sdk/openai/Azure.AI.OpenAI/tests/FileTests.cs | 8 ++++++++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md b/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md index f7d918b5d635e..09351c6886119 100644 --- a/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md +++ b/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md @@ -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) diff --git a/sdk/openai/Azure.AI.OpenAI/assets.json b/sdk/openai/Azure.AI.OpenAI/assets.json index b2ef2d5a64524..e9352cbb64b55 100644 --- a/sdk/openai/Azure.AI.OpenAI/assets.json +++ b/sdk/openai/Azure.AI.OpenAI/assets.json @@ -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" } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/Files/AzureFileClient.Protocol.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/Files/AzureFileClient.Protocol.cs index 921c3072f064d..60f5fc29764fe 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/Files/AzureFileClient.Protocol.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/Files/AzureFileClient.Protocol.cs @@ -67,8 +67,6 @@ public override async Task 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)); } @@ -76,8 +74,6 @@ public override ClientResult GetFiles(string purpose, RequestOptions options) [EditorBrowsable(EditorBrowsableState.Never)] public override async Task 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)); } diff --git a/sdk/openai/Azure.AI.OpenAI/tests/FileTests.cs b/sdk/openai/Azure.AI.OpenAI/tests/FileTests.cs index ca864a4b4f9f6..00883f195a9d5 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/FileTests.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/FileTests.cs @@ -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)); + } }