Openai file operations
Defines the file operations for the OpenAILMInvoker class.
OpenAIFileOperations(invoker)
Bases: FileOperations
Handles file operations for the OpenAILMInvoker class.
Examples:
- Upload a file:
uploaded_attachment = await lm_invoker.file.upload(attachment)
- List the files:
uploaded_attachments = await lm_invoker.file.list()
- Delete a file:
await lm_invoker.file.delete(uploaded_attachment)
Initializes the file operations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invoker
|
OpenAILMInvoker
|
The OpenAILMInvoker to use for the file operations. |
required |
delete(file)
async
Deletes a file from the language model provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
UploadedAttachment
|
The file to delete. |
required |
list()
async
Lists the files from the language model provider.
Returns:
| Type | Description |
|---|---|
list[UploadedAttachment]
|
list[UploadedAttachment]: The list of files. |
upload(file)
async
Uploads a file to the language model provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
Attachment
|
The file to upload. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
UploadedAttachment |
UploadedAttachment
|
The uploaded attachment. |