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.35k stars 4.66k forks source link

[BUG] Cannot upload fine tuning files for Azure OpenAI #44710

Open ralph-msft opened 3 months ago

ralph-msft commented 3 months ago

Library name and version

Azure.AI.OpenAI 2.0.0-beta.2

Describe the bug

Uploading fine tuning files using the FileClient fails against Azure OpenAI. It work fine for OpenAI endpoints

Expected behavior

The upload succeeds

Actual behavior

The upload fails since the service rejects the request with an HTTP 4XX error message indicating the Content-Type header was not set for the file part of multipart form content:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Content-Length: 119

{
  "error": {
    "code": "invalidPayload",
    "message": "The file has no or an empty content type specified."
  }
}

Reproduction Steps

var topLevel = new AzureOpenAIClient(
    new Uri("https://your-resource-name.azure.openai.azure.com/"),
    new DefaultAzureCredential());
FileClient client = topLevel.GetFileClient();
OpenAIFileInfo fileInfo = await client.UploadFileAsync("path/to/file", FileUploadPurpose.FineTune);

Environment

No response

phdsaxo commented 1 month ago

Getting the same problem for batch jsonl files. Same file can be uploaded (and processed in a batch job) just fine using Azure AI Studio.