Zack Saadioui
8/26/2024
1
2
3
4
5
python
from llama_index.vector_stores import SimpleVectorStore
vec_store = SimpleVectorStore()
vec_store.persist() # Save existing vector store to disk
load_store = SimpleVectorStore.from_persist_path('path_to_store')
1
2
3
4
5
6
7
python
from llama_index.core import Document, MetadataFilters, ExactMatchFilter
documents = [Document(text="text", metadata={"category": "category1"}),
Document(text="text", metadata={"category": "category2"})]
filters = MetadataFilters(filters=[ExactMatchFilter(key="category", value="category1")])
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine(filters=filters)
1
2
3
python
from llama_index.vector_stores.deeplake import DeepLakeVectorStore
storage_context = StorageContext.from_defaults(vector_store=DeepLakeVectorStore(dataset_path="<path_to_data>",overwrite=True))
1
GPTListIndex
1
MultiModalVectorStoreIndex
1
2
3
4
5
6
7
python
from llama_index import ComposableGraph
all_indices = [index1, index2, index3, index4] # Assuming these are already created
graph = ComposableGraph.from_indices(GPTTreeIndex, all_indices)
graph.save_to_disk(‘path_to_graph’)
...
loaded_graph = ComposableGraph.load_from_disk('path_to_graph')
Copyright © Arsturn 2025