My basic understanding of the
VectorStoreIndex
is apparently somewhat confused. The class file
vector_store/base.py
describes it as:
An index that is built on top of an existing vector store.
Key words here being
an existing vector store. As such, I thought a vector store was built when the index is initialized, such as with:
index = VectorStoreIndex(nodes)
index.storage_context.persist(persist_dir = persist_dir)
However, when I try to access the underlying vector store on top of which the index was supposed to be built:
storage_context = StorageContext.from_defaults(persist_dir = persist_dir)
index = load_index_from_storage(storage_context = storage_context)
vector_store = index.from_vector_store()
... it tells me that I need to provide a vector store, and therein lies my confusion. I'm trying to access the vector store from the index which I thought was located in
persist_dir
when
VectorStoreIndex()
was initialized, not build a new one.
Where is the underlying vector store for the index and how can I access it, please? (For context, I want to retrieve the vector store from the index in order to pass it as an argument to
VectorMemory
.)