Skip to content

Data store operations

Defines the data store operations for an LM invoker.

Authors

Henry Wicaksono (henry.wicaksono@gdplabs.id)

References

NONE

DataStoreOperations(invoker)

Handles data store operations for an LM invoker.

This class provides a wrapper around the data store operations of an LM invoker. It provides a simple interface to perform data store operations.

Examples:

  1. Create a data store:
data_store = await lm_invoker.data_store.create()
  1. List the data stores:
data_stores = await lm_invoker.data_store.list()
  1. Delete a data store:
await lm_invoker.data_store.delete(data_store)
  1. Upload attachments to a data store:
await lm_invoker.data_store.add_file(data_store, file)

Initializes the data store operations.

Parameters:

Name Type Description Default
invoker BaseLMInvoker

The LM invoker to use for the data store operations.

required

add_file(data_store, file, **kwargs) async

Adds an attachment file to a data store.

Parameters:

Name Type Description Default
data_store AttachmentStore

The data store to add the attachment file to.

required
file Attachment

The attachment file to add.

required
**kwargs Any

Additional keyword arguments to add the attachment file to the data store.

{}

create(**kwargs) async

Creates a new data store.

Parameters:

Name Type Description Default
**kwargs Any

Additional keyword arguments to create a data store.

{}

Returns:

Name Type Description
AttachmentStore AttachmentStore

The created data store.

delete(data_store) async

Deletes a data store.

Parameters:

Name Type Description Default
data_store AttachmentStore

The data store to delete.

required

list() async

Lists the data stores.

Returns:

Type Description
list[AttachmentStore]

list[AttachmentStore]: The list of data stores.