Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.24k stars 4.58k forks source link

[BUG] The AzureFileClient.GetFilesAsync call fails when called with Vision purpose #44913

Open SergeyMenshykh opened 1 month ago

SergeyMenshykh commented 1 month ago

Library name and version

Azure.AI.OpenAI 2.0.0-beta.2

Describe the bug

Calling AzureFileClient.GetFilesAsync method with the OpenAIFilePurpose.Vision purpose fails.

Expected behavior

The method call returns list of files with the Vision purpose if they exist or an empty collection if they don't.

Actual behavior

The method call fails with the exception:

Reproduction Steps

Create an instance of the AzureOpenAIClient class, get the file client, upload a file with Assistance purpose (not sure if it's important) and call the GetFilesAsync method with the Vision purpose:

var azureClient = new AzureOpenAIClient(endpoint, apiKey, options);

await azureClient.GetFileClient().UploadFileAsync(content, "test_content.txt", purpose: FileUploadPurpose.Assistants);

var files = await azureClient.GetFileClient().GetFilesAsync(purpose: OpenAIFilePurpose.Vision);

Environment

Windows 11 .NET8.0 Visual Studio 17.10.2

github-actions[bot] commented 1 month ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

trrwilson commented 1 month ago

Thanks, @SergeyMenshykh! Great catch. The new vision purpose isn't yet supported by Azure OpenAI; you can track that in the REST documentation here: https://learn.microsoft.com/en-us/rest/api/azureopenai/files/upload?view=rest-azureopenai-2024-05-01-preview&tabs=HTTP&preserve-view=true#purpose

Service support work for image input (and Azure content safety integration) is underway and will work seamlessly via the API once it's available.