Skip to content

File operations

Defines the file operations for an LM invoker.

Authors

Henry Wicaksono (henry.wicaksono@gdplabs.id)

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:

  1. Upload a file:
uploaded_attachment = await lm_invoker.file.upload(attachment)
  1. List the files:
uploaded_attachments = await lm_invoker.file.list()
  1. 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.