Skip to content

Data store operations

Modules concerning the data store operations of an LM invoker.

DataStoreOperations(invoker)

Handles data store operations for an LM invoker.

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.

{}

Raises:

Type Description
NotImplementedError

The data store operation is not supported.

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.

Raises:

Type Description
NotImplementedError

The data store operation is not supported.

delete(data_store) async

Deletes a data store.

Parameters:

Name Type Description Default
data_store AttachmentStore

The data store to delete.

required

Raises:

Type Description
NotImplementedError

The data store operation is not supported.

list() async

Lists the data stores.

Returns:

Type Description
list[AttachmentStore]

list[AttachmentStore]: The list of data stores.

Raises:

Type Description
NotImplementedError

The data store operation is not supported.

GoogleDataStoreOperations(invoker)

Bases: DataStoreOperations

Handles data store operations for the GoogleLMInvoker class.

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 GoogleLMInvoker

The GoogleLMInvoker 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.

OpenAIDataStoreOperations(invoker)

Bases: DataStoreOperations

Handles data store operations for the OpenAILMInvoker class.

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 OpenAILMInvoker

The OpenAILMInvoker 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.