Index Manager
Index Manager
llama_utils.indexing.index_manager
Index manager module.
IndexManager
A class to manage multiple indexes, handling updates, deletions, and retrieval operations.
Source code in src/llama_utils/indexing/index_manager.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
ids: List[str]
property
Index IDs.
indexes: List[CustomIndex]
property
writable
Indexes.
__init__(ids: List[str], indexes: List[BaseIndex])
Initialize the index manager.
Source code in src/llama_utils/indexing/index_manager.py
18 19 20 21 |
|
__str__()
String representation of the index manager.
Source code in src/llama_utils/indexing/index_manager.py
23 24 25 26 27 28 |
|
create_from_storage(storage: Storage) -> IndexManager
classmethod
Create a new index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storage
|
Storage
|
The storage object to create the index from. |
required |
Returns:
Type | Description |
---|---|
IndexManager
|
The new index manager object |
Source code in src/llama_utils/indexing/index_manager.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
load_from_storage(storage: Storage) -> IndexManager
classmethod
Read indexes from storage.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storage
|
Storage
|
The storage object to read the indexes from. |
required |
Returns:
Type | Description |
---|---|
IndexManager
|
The index manager object |
Examples:
First we need to load the ConfigLoader
to define the embedding model that was used to create the embeddings
in the index.
>>> from llama_utils.utils.config_loader import ConfigLoader
>>> config_loader = ConfigLoader()
Next, we load the storage object and the index manager object.
>>> storage_dir = "examples/paul-graham-essay-storage"
>>> storage_context = Storage.load(storage_dir)
>>> index_manager = IndexManager.load_from_storage(storage_context) # doctest: +SKIP
>>> print(index_manager) # doctest: +SKIP
<BLANKLINE>
ids=['8d57e294-fd17-43c9-9dec-a12aa7ea0751', 'edd0d507-9100-4cfb-8002-2267449c6668'],
indexes=[
<llama_index.core.indices.vector_store_index.VectorStoreIndex object at 0x7f9f2a1e9d90>,
<llama_index.core.indices.vector_store_index.VectorStoreIndex object at 0x7f9f2a1e9e50>
])
<BLANKLINE>
Source code in src/llama_utils/indexing/index_manager.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|