Description
Service
OpenAI
Describe the bug
When calling:
uploadFile = await fileClient.UploadFileAsync(memoryStream, "sc.png", FileUploadPurpose.Vision);
Neither fileClient or memoryStream are null and are well setup.
Stacktrace:
ArgumentException: boundary System.Net.Http.MultipartContent..ctor (System.String subtype, System.String boundary) (at <47ef39777a954e11aa742f58c0c8c611>:0) System.Net.Http.MultipartFormDataContent..ctor (System.String boundary) (at <47ef39777a954e11aa742f58c0c8c611>:0) OpenAI.MultiPartFormDataBinaryContent..ctor () (at <66b398140f984e688a86e262f03b0421>:0) OpenAI.Files.InternalFileUploadOptions.ToMultipartContent (System.IO.Stream file, System.String filename) (at <66b398140f984e688a86e262f03b0421>:0) OpenAI.Files.OpenAIFileClient.UploadFileAsync (System.IO.Stream file, System.String filename, OpenAI.Files.FileUploadPurpose purpose, System.Threading.CancellationToken cancellationToken) (at <66b398140f984e688a86e262f03b0421>:0)
Context:
Unity Engine, IL2CPP, .Net Standard 2.1
Same code works on plain C# via Visual Studio.
Steps to reproduce
- Create an Empty Unity Project
- Connect to openAI API, create apiClient and fileClient.
- Use fileClient to upload an image.
Code snippets
OpenAIClient client = new("API KEY");
OpenAIFileClient fileClient = client.GetOpenAIFileClient();
fileClient.UploadFileAsync(memoryStream, "sc.png", FileUploadPurpose.Vision);
OS
winOS
.NET version
2.1
Library version
2.0 and 2.2