File operations
Defines the file operations for an LM invoker.
References
NONE
FileOperations(invoker)
Handles file operations for an LM invoker.
This class provides a wrapper around the file operations of an LM invoker.
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
|
BaseLMInvoker
|
The LM invoker 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. |