Skip to content

ArgumentException: boundary #420

Open
@Monteseu

Description

@Monteseu

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

  1. Create an Empty Unity Project
  2. Connect to openAI API, create apiClient and fileClient.
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCategory: Something isn't working and appears to be a defect in the client library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions