Data Store Management

gllm-inference | Tutorial: Data Store Management | API Reference

What is data store management?

Data store management is a feature that allows the language model to manage built-in data stores to be used as internal knowledge base. This allows the LM invoker to perform built-in RAG (Retrieval-Augmented Generation).

Data store management is only available for certain LM invokers. This feature can be accessed via the data_store attribute of the LM invoker. As an example, let's try to perform a simple built-in RAG using the GoogleLMInvoker!

Init an LM Invoker

First of all, let's create a GoogleLMInvoker that we will use to manage the data store:

from dotenv import load_dotenv
load_dotenv()

from gllm_inference.lm_invoker import GoogleLMInvoker

lm_invoker = GoogleLMInvoker("gemini-2.5-flash-lite")

Create a Data Store

Next, let's create a data store. The create() method will output an AttachmentStore object to be used in later operations.

store = await lm_invoker.data_store.create()

List the Data Stores

We can verify that the data store has been successfully created on the server side by using the list() method.

Add a File to the Data Store

Then, we can add a file to our newly created store using the add_file() method.

Assign the Data Store to an LM invoker

Then, we can assign our store to the LM invoker to be used as an internal knowledge base.

Alternatively, we can also directly assign the store to a new LM invoker:

During invocation, the LM invoker has the capability to retrieve knowledge from the stores that have been assigned to it, effectively enabling a built-in RAG.

Delete the Data Store

Finally, if the store is no longer used, it can be deleted via the delete() method.

Last updated