Find answers from the community

Updated 4 months ago

Nodes

At a glance

The community member is trying to retrieve nodes from a VectorStoreIndex, but index.docstore.docs.values() is always an empty dictionary. Other community members suggest that the issue may be related to using a third-party vector store, such as ChromaVectorStore. They provide some guidance on how to retrieve the nodes, including using vector_store._collection.get() and setting the store_nodes_override parameter to True when creating the VectorStoreIndex. However, there is no explicitly marked answer in the comments.

How do I get nodes from an existing VectorStoreIndex?

index.docstore.docs.values() is always an empty dictionary…
W
a
L
14 comments
Are you using third party vector store?
Im using chromavectorstore
vector_store = ChromaVectorStore(chroma_collection = chroma_collection)
index=VectorStoreIndex.from_vector_store(vector_store, embed_model = embed_model)
@WhiteFang_Jr
hmmm i figured out how to do it for Chroma by vector_store._collection.get()
but im trying to figure out how to do it with the index object which is a VectorStoreIndez
If it is a vectorStoreIndex, once indexing is completed you'll have to persist the index in case you want to have the nodes back when loading from local directory.
@WhiteFang_Jr the index is persisted. whats the correct method to retrieve the nodes from the persist directory?
Third party vector stores disable the docstore by default to simplify storage. You can override this, or use a chroma client directly to get everything
there is also a get_nodes() function for chroma vector store, but you need to provide either node ids or filters
@Logan M thanks for the response. what is the parameter that disables the docstore in chroma?
Sorry, you'd want the parameter to enable it (but note then you should also handle saving/reloading the docstore as well)

VectorStoreIndex(..., store_nodes_override=True)
@Logan M Nice this worked. Thank you!
When using VectorStoreIndex.from_documents() is it possible to extract the nodes here?
Probably some hacky way, but I would just create the nodes first
Add a reply
Sign up and join the conversation on Discord