AgentsClient.UploadFile Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
UploadFile(RequestContent, String, RequestContext) |
[Protocol Method] Uploads a file for use by other operations.
|
UploadFile(String, AgentFilePurpose, CancellationToken) |
Uploads a file from a local file path accessible to File. |
UploadFile(Stream, AgentFilePurpose, String, CancellationToken) |
Uploads a file for use by other operations. |
UploadFile(RequestContent, String, RequestContext)
- Source:
- AgentsClient.cs
[Protocol Method] Uploads a file for use by other operations.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler UploadFile(Stream, AgentFilePurpose, String, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response UploadFile (Azure.Core.RequestContent content, string contentType, Azure.RequestContext context = default);
abstract member UploadFile : Azure.Core.RequestContent * string * Azure.RequestContext -> Azure.Response
override this.UploadFile : Azure.Core.RequestContent * string * Azure.RequestContext -> Azure.Response
Public Overridable Function UploadFile (content As RequestContent, contentType As String, Optional context As RequestContext = Nothing) As 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
UploadFile(String, AgentFilePurpose, CancellationToken)
- Source:
- AgentsClient.cs
Uploads a file from a local file path accessible to File.
public virtual Azure.Response<Azure.AI.Projects.AgentFile> UploadFile (string filePath, Azure.AI.Projects.AgentFilePurpose purpose, System.Threading.CancellationToken cancellationToken = default);
abstract member UploadFile : string * Azure.AI.Projects.AgentFilePurpose * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Projects.AgentFile>
override this.UploadFile : string * Azure.AI.Projects.AgentFilePurpose * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Projects.AgentFile>
Public Overridable Function UploadFile (filePath As String, purpose As AgentFilePurpose, Optional cancellationToken As CancellationToken = Nothing) As 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
UploadFile(Stream, AgentFilePurpose, String, CancellationToken)
- Source:
- AgentsClient.cs
Uploads a file for use by other operations.
public virtual Azure.Response<Azure.AI.Projects.AgentFile> UploadFile (System.IO.Stream data, Azure.AI.Projects.AgentFilePurpose purpose, string filename, System.Threading.CancellationToken cancellationToken = default);
abstract member UploadFile : System.IO.Stream * Azure.AI.Projects.AgentFilePurpose * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Projects.AgentFile>
override this.UploadFile : System.IO.Stream * Azure.AI.Projects.AgentFilePurpose * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Projects.AgentFile>
Public Overridable Function UploadFile (data As Stream, purpose As AgentFilePurpose, filename As String, Optional cancellationToken As CancellationToken = Nothing) As 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
Azure SDK for .NET