IOpenAIClient.UploadFileAsync
IOpenAIClient.UploadFileAsync method
Uploads a file asynchronously to the OpenAI server.
public Task<FileResponse> UploadFileAsync(string purpose, string fileName, byte[] fileBytes,
CancellationToken? cancellationToken = default)
Parameter | Type | Description |
---|---|---|
purpose | String | The purpose of the file upload, typically describing how the file will be used. |
fileName | String | The name of the file to upload. |
fileBytes | Byte[] | The byte array containing the file data. |
cancellationToken | Nullable`1 | A token to cancel the operation. |
Return Value
A task that represents the asynchronous operation. The task result contains the response from the file upload.
Exceptions
exception | condition |
---|---|
AIClientException | Thrown when the file purpose is null or empty. |
AIClientException | Thrown when the file name is null or empty. |
See Also
- class FileResponse
- interface IOpenAIClient
- namespace Aspose.Pdf.AI
- assembly Aspose.PDF