Is it possible to store a DocumentSummaryIndex in a chroma Vector store? VectorStoreIndex has a
.from_vector_store()
method but documentSummaryIndex does not. When trying to do
load_index_from_storage(storage_context=storage_context, service_context=service_context)
i get an error about no persist_dir as follows
ValueError: No index in storage context, check if you specified the right persist_dir.
and requires me to
.persist()
the documentSummaryIndex to a file.
here is how i load the index:
db = chromadb.PersistentClient(path="./chroma_db")
chroma_collection = db.get_or_create_collection("test")
vector_store = ChromaVectorStore(chroma_collection=chroma_collection, persist_dir="./chroma_db")
storage_context = StorageContext.from_defaults(vector_store=vector_store, persist_dir="./chroma_db")
service_context = ServiceContext.from_defaults(
llm=chatgpt,
transformations=extractors,
embed_model=embedding,
system_prompt=system_prompt)
doc_summary_index = DocumentSummaryIndex.from_documents(documents=docs,
storage_context=storage_context,
service_context=service_context,
show_progress=True)
doc_summary_index.storage_context.persist(persist_dir="./chroma_db")
And then loading it back after
doc_summary_index = load_index_from_storage(storage_context=storage_context, service_context=service_context)
query_engine = doc_summary_index.as_query_engine(
response_mode="tree_summarize", use_async=True, service_context=service_context
)