Find answers from the community

Updated 2 months ago

Nodes

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