Index Store#
- class llama_index.storage.index_store.FirestoreKVStore(project: Optional[str] = None, database: str = '(default)')#
Firestore Key-Value store.
- Parameters
project (str) β The project which the client acts on behalf of.
database (str) β The database name that the client targets.
- async adelete(key: str, collection: str = 'data') bool #
Delete a value from the Firestore.
- Parameters
key (str) β key
collection (str) β collection name
- async aget(key: str, collection: str = 'data') Optional[dict] #
Get a key-value pair from the Firestore.
- Parameters
key (str) β key
collection (str) β collection name
- async aget_all(collection: str = 'data') Dict[str, dict] #
Get all values from the Firestore collection.
- Parameters
collection (str) β collection name
- async aput(key: str, val: dict, collection: str = 'data') None #
Put a key-value pair into the Firestore collection.
- Parameters
key (str) β key
val (dict) β value
collection (str) β collection name
- async aput_all(kv_pairs: List[Tuple[str, dict]], collection: str = 'data', batch_size: int = 1) None #
Put a dictionary of key-value pairs into the Firestore collection.
- Parameters
kv_pairs (List[Tuple[str, dict]]) β key-value pairs
collection (str) β collection name
- delete(key: str, collection: str = 'data') bool #
Delete a value from the Firestore.
- Parameters
key (str) β key
collection (str) β collection name
- get(key: str, collection: str = 'data') Optional[dict] #
Get a key-value pair from the Firestore.
- Parameters
key (str) β key
collection (str) β collection name
- get_all(collection: str = 'data') Dict[str, dict] #
Get all values from the Firestore collection.
- Parameters
collection (str) β collection name
- put(key: str, val: dict, collection: str = 'data') None #
Put a key-value pair into the Firestore collection.
- Parameters
key (str) β key
val (dict) β value
collection (str) β collection name
- class llama_index.storage.index_store.KVIndexStore(kvstore: BaseKVStore, namespace: Optional[str] = None)#
Key-Value Index store.
- Parameters
kvstore (BaseKVStore) β key-value store
namespace (str) β namespace for the index store
- add_index_struct(index_struct: IndexStruct) None #
Add an index struct.
- Parameters
index_struct (IndexStruct) β index struct
- delete_index_struct(key: str) None #
Delete an index struct.
- Parameters
key (str) β index struct key
- get_index_struct(struct_id: Optional[str] = None) Optional[IndexStruct] #
Get an index struct.
- Parameters
struct_id (Optional[str]) β index struct id
- index_structs() List[IndexStruct] #
Get all index structs.
- Returns
index structs
- Return type
List[IndexStruct]
- persist(persist_path: str = './storage/index_store.json', fs: Optional[AbstractFileSystem] = None) None #
Persist the index store to disk.
- class llama_index.storage.index_store.MongoIndexStore(mongo_kvstore: MongoDBKVStore, namespace: Optional[str] = None)#
Mongo Index store.
- Parameters
mongo_kvstore (MongoDBKVStore) β MongoDB key-value store
namespace (str) β namespace for the index store
- add_index_struct(index_struct: IndexStruct) None #
Add an index struct.
- Parameters
index_struct (IndexStruct) β index struct
- delete_index_struct(key: str) None #
Delete an index struct.
- Parameters
key (str) β index struct key
- classmethod from_host_and_port(host: str, port: int, db_name: Optional[str] = None, namespace: Optional[str] = None) MongoIndexStore #
Load a MongoIndexStore from a MongoDB host and port.
- classmethod from_uri(uri: str, db_name: Optional[str] = None, namespace: Optional[str] = None) MongoIndexStore #
Load a MongoIndexStore from a MongoDB URI.
- get_index_struct(struct_id: Optional[str] = None) Optional[IndexStruct] #
Get an index struct.
- Parameters
struct_id (Optional[str]) β index struct id
- index_structs() List[IndexStruct] #
Get all index structs.
- Returns
index structs
- Return type
List[IndexStruct]
- persist(persist_path: str = './storage/index_store.json', fs: Optional[AbstractFileSystem] = None) None #
Persist the index store to disk.
- class llama_index.storage.index_store.RedisIndexStore(redis_kvstore: RedisKVStore, namespace: Optional[str] = None)#
Redis Index store.
- Parameters
redis_kvstore (RedisKVStore) β Redis key-value store
namespace (str) β namespace for the index store
- add_index_struct(index_struct: IndexStruct) None #
Add an index struct.
- Parameters
index_struct (IndexStruct) β index struct
- delete_index_struct(key: str) None #
Delete an index struct.
- Parameters
key (str) β index struct key
- classmethod from_host_and_port(host: str, port: int, namespace: Optional[str] = None) RedisIndexStore #
Load a RedisIndexStore from a Redis host and port.
- classmethod from_redis_client(redis_client: Any, namespace: Optional[str] = None) RedisIndexStore #
Load a RedisIndexStore from a Redis Client.
- get_index_struct(struct_id: Optional[str] = None) Optional[IndexStruct] #
Get an index struct.
- Parameters
struct_id (Optional[str]) β index struct id
- index_structs() List[IndexStruct] #
Get all index structs.
- Returns
index structs
- Return type
List[IndexStruct]
- persist(persist_path: str = './storage/index_store.json', fs: Optional[AbstractFileSystem] = None) None #
Persist the index store to disk.
- class llama_index.storage.index_store.SimpleIndexStore(simple_kvstore: Optional[SimpleKVStore] = None)#
Simple in-memory Index store.
- Parameters
simple_kvstore (SimpleKVStore) β simple key-value store
- add_index_struct(index_struct: IndexStruct) None #
Add an index struct.
- Parameters
index_struct (IndexStruct) β index struct
- delete_index_struct(key: str) None #
Delete an index struct.
- Parameters
key (str) β index struct key
- classmethod from_persist_dir(persist_dir: str = './storage', fs: Optional[AbstractFileSystem] = None) SimpleIndexStore #
Create a SimpleIndexStore from a persist directory.
- classmethod from_persist_path(persist_path: str, fs: Optional[AbstractFileSystem] = None) SimpleIndexStore #
Create a SimpleIndexStore from a persist path.
- get_index_struct(struct_id: Optional[str] = None) Optional[IndexStruct] #
Get an index struct.
- Parameters
struct_id (Optional[str]) β index struct id
- index_structs() List[IndexStruct] #
Get all index structs.
- Returns
index structs
- Return type
List[IndexStruct]
- persist(persist_path: str = './storage/index_store.json', fs: Optional[AbstractFileSystem] = None) None #
Persist the store.