Share via


AssistantsClient.UploadFileAsync Method

Definition

Overloads

UploadFileAsync(String, OpenAIFilePurpose, CancellationToken)

Uploads a file from a local file path accessible to File.

UploadFileAsync(Stream, OpenAIFilePurpose, String, CancellationToken)

Uploads a file for use by other operations.

UploadFileAsync(String, OpenAIFilePurpose, CancellationToken)

Source:
AssistantsClient.cs

Uploads a file from a local file path accessible to File.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.OpenAI.Assistants.OpenAIFile>> UploadFileAsync (string localFilePath, Azure.AI.OpenAI.Assistants.OpenAIFilePurpose purpose, System.Threading.CancellationToken cancellationToken = default);
abstract member UploadFileAsync : string * Azure.AI.OpenAI.Assistants.OpenAIFilePurpose * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.OpenAI.Assistants.OpenAIFile>>
override this.UploadFileAsync : string * Azure.AI.OpenAI.Assistants.OpenAIFilePurpose * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.OpenAI.Assistants.OpenAIFile>>
Public Overridable Function UploadFileAsync (localFilePath As String, purpose As OpenAIFilePurpose, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of OpenAIFile))

Parameters

localFilePath
String

The local file path.

purpose
OpenAIFilePurpose

The intended purpose of the uploaded file.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Applies to

UploadFileAsync(Stream, OpenAIFilePurpose, String, CancellationToken)

Source:
AssistantsClient.cs

Uploads a file for use by other operations.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.OpenAI.Assistants.OpenAIFile>> UploadFileAsync (System.IO.Stream data, Azure.AI.OpenAI.Assistants.OpenAIFilePurpose purpose, string filename = default, System.Threading.CancellationToken cancellationToken = default);
abstract member UploadFileAsync : System.IO.Stream * Azure.AI.OpenAI.Assistants.OpenAIFilePurpose * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.OpenAI.Assistants.OpenAIFile>>
override this.UploadFileAsync : System.IO.Stream * Azure.AI.OpenAI.Assistants.OpenAIFilePurpose * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.OpenAI.Assistants.OpenAIFile>>
Public Overridable Function UploadFileAsync (data As Stream, purpose As OpenAIFilePurpose, Optional filename As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of OpenAIFile))

Parameters

data
Stream

The file data (not filename) to upload.

purpose
OpenAIFilePurpose

The intended purpose of the file.

filename
String

A filename to associate with the uploaded data.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

data is null.

Applies to