Compartilhar via


AgentsClient.UploadFileAsync Method

Definition

Overloads

UploadFileAsync(String, AgentFilePurpose, CancellationToken)

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

UploadFileAsync(RequestContent, String, RequestContext)

[Protocol Method] Uploads a file for use by other operations.

UploadFileAsync(Stream, AgentFilePurpose, String, CancellationToken)

Uploads a file for use by other operations.

UploadFileAsync(String, AgentFilePurpose, CancellationToken)

Source:
AgentsClient.cs

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

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

Parameters

filePath
String

The local file path.

purpose
AgentFilePurpose

The intended purpose of the uploaded file.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Applies to

UploadFileAsync(RequestContent, String, RequestContext)

Source:
AgentsClient.cs

[Protocol Method] Uploads a file for use by other operations.

public virtual System.Threading.Tasks.Task<Azure.Response> UploadFileAsync (Azure.Core.RequestContent content, string contentType, Azure.RequestContext context = default);
abstract member UploadFileAsync : Azure.Core.RequestContent * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.UploadFileAsync : Azure.Core.RequestContent * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function UploadFileAsync (content As RequestContent, contentType As String, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

content
RequestContent

The content to send as the body of the request.

contentType
String

The name of the file to upload. Allowed values: "multipart/form-data".

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

content is null.

Service returned a non-success status code.

Applies to

UploadFileAsync(Stream, AgentFilePurpose, String, CancellationToken)

Source:
AgentsClient.cs

Uploads a file for use by other operations.

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

Parameters

data
Stream

The file data, in bytes.

purpose
AgentFilePurpose

The intended purpose of the uploaded file. Use assistants for Agents and Message files, vision for Agents image file inputs, batch for Batch API, and fine-tune for Fine-tuning.

filename
String

The name of the file.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

data is null.

Applies to