PersistentAgentsFiles.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
| Name | Description |
|---|---|
| UploadFile(RequestContent, String, RequestContext) |
[Protocol Method] Uploads a file for use by other operations.
|
| UploadFile(String, PersistentAgentFilePurpose, CancellationToken) |
Uploads a file from a local file path accessible to File. |
| UploadFile(Stream, PersistentAgentFilePurpose, String, CancellationToken) |
Uploads a file for use by other operations. |
UploadFile(RequestContent, String, RequestContext)
- Source:
- PersistentAgentsFiles.cs
- Source:
- PersistentAgentsFiles.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 Azure.AI.Agents.Persistent.PersistentAgentsFiles.UploadFile(Azure.AI.Agents.Persistent.UploadFileRequest,System.Threading.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, PersistentAgentFilePurpose, CancellationToken)
- Source:
- PersistentAgentsFiles.cs
- Source:
- PersistentAgentsFiles.cs
Uploads a file from a local file path accessible to File.
public virtual Azure.Response<Azure.AI.Agents.Persistent.PersistentAgentFileInfo> UploadFile(string filePath, Azure.AI.Agents.Persistent.PersistentAgentFilePurpose purpose, System.Threading.CancellationToken cancellationToken = default);
abstract member UploadFile : string * Azure.AI.Agents.Persistent.PersistentAgentFilePurpose * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Agents.Persistent.PersistentAgentFileInfo>
override this.UploadFile : string * Azure.AI.Agents.Persistent.PersistentAgentFilePurpose * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Agents.Persistent.PersistentAgentFileInfo>
Public Overridable Function UploadFile (filePath As String, purpose As PersistentAgentFilePurpose, Optional cancellationToken As CancellationToken = Nothing) As Response(Of PersistentAgentFileInfo)
Parameters
- filePath
- String
The local file path.
- purpose
- PersistentAgentFilePurpose
The intended purpose of the uploaded file.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Applies to
UploadFile(Stream, PersistentAgentFilePurpose, String, CancellationToken)
- Source:
- PersistentAgentsFiles.cs
- Source:
- PersistentAgentsFiles.cs
Uploads a file for use by other operations.
public virtual Azure.Response<Azure.AI.Agents.Persistent.PersistentAgentFileInfo> UploadFile(System.IO.Stream data, Azure.AI.Agents.Persistent.PersistentAgentFilePurpose purpose, string filename, System.Threading.CancellationToken cancellationToken = default);
abstract member UploadFile : System.IO.Stream * Azure.AI.Agents.Persistent.PersistentAgentFilePurpose * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Agents.Persistent.PersistentAgentFileInfo>
override this.UploadFile : System.IO.Stream * Azure.AI.Agents.Persistent.PersistentAgentFilePurpose * string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Agents.Persistent.PersistentAgentFileInfo>
Public Overridable Function UploadFile (data As Stream, purpose As PersistentAgentFilePurpose, filename As String, Optional cancellationToken As CancellationToken = Nothing) As Response(Of PersistentAgentFileInfo)
Parameters
- data
- Stream
The file data, in bytes.
- purpose
- PersistentAgentFilePurpose
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.