hmmm.... actually I think to save the entire graph, the sub-indexes cannot be saved in a 3rd party vector db. If they are, you'll have to load each sub-index and re-construct the graph
If they aren't in a vector db, what I meant was something like this
# create
storage_context = StorageContext.from_defaults()
index1 = VectorStoreIndex.from_documents(docs, storage_context=storage_context)
index2 = ListIndex.from_documents(docs, storage_context=storage_context
graph = ComposableGraph.from_indices(
ListIndex,
[index1, index2],
index_summaries=[index1_summary, index2_summary],
storage_context=storage_context,
)
# save
# set the ID
graph.root_index.set_index_id("my_id")
# persist to storage
graph.root_index.storage_context.persist(persist_dir="./storage")
# load
from llama_index import StorageContext, load_graph_from_storage
storage_context = StorageContext.from_defaults(persist_dir="./storage")
graph = load_graph_from_storage(storage_context, root_id="my_id")