docstore = RedisDocumentStore.from_redis_client(
redis_client=redis_client
)
index_store = RedisIndexStore.from_redis_client(
redis_client=redis_client
)
self.stoarge_context = StorageContext.from_defaults(docstore=docstore, index_store=index_store)
self.index = load_index_from_storage(
storage_context=self.storage_context,
index_id=self.index_id,
service_context=self.service_context)
what kind of index is it?
first generated with .from_documents()
so you'll also need to save/persist a vector store as well I think π€ Which might be why you get empty responses
self.index = DocumentSummaryIndex.from_documents(
documents=self.llamaindex_documents,
service_context=self.service_context,
storage_context=self.storage_context,
show_progress=True,
)
self.index.set_index_id(self.chat_id)
self.redis.add_index(self.chat_id)
self.query_engine = self.index.as_query_engine(
response_mode="tree_summarize",
streaming=True,
use_async=True,
summary_template=self.summary_template,
)
self.index.storage_context.persist("index")
Ah, so the vector store is probably saved locally in the index
folder
self.stoarge_context = StorageContext.from_defaults(docstore=docstore, index_store=index_store, persist_dir="./index")
would probably work
In that example is saved only using the docstore and indexstore
Im trying to persist the index in the RedisIndexStore
it persists automatically actually (except for the vector store, because you did not provide one), so no need to call persist
Now that you say it its true that is making an index folder
yea, that example needs to be updated I guess :PSadge:
lol in the example, the response is empty when querying the loaded vector index too
tbh didnt read until the end
So solution here is to either use the default vector store that was saved to disk, or use some other vector store (redis, qdrant, weaviate, pinecone, etc.)
Will try to add a Redis vector store but i dont see why is needed to work
The summaries of each document are embedded
so that they can be retrieved
Without the vector store, there are no summaries to retrieve
Really? I expected the summary to be saved in the docstore
So the SummaryIndex is just a Vector store index in disguise
Summaries are embedded, but the original documents live in the docstore
I mean, does the community have acces to the make changes in the docs?
definitely! You can fork the repo on github, make changes, and then make a PR with your fork
happy to merge any changes
node_ids = self._index_struct.summary_id_to_node_ids[summary_id]
KeyError: 'llama_index/vector_4e8af3bf-d8ab-4b2b-a268-7b608b6a5010'
Does this error ring any bell? @Logan M
hmm, this tells me maybe the index store did not save/load properly? I should probably try this myself with a redis setup
if i comment line 165 and 166 # if query_result.ids is not None:
# top_k_summary_ids = query_result.ids
on retrievers.py it works
So i guess something is wrong when doing the query of the Reddis vector store