Find answers from the community

Updated 7 months ago

Question 1:

Question 1:

In a VectorStore, what is the difference between a doc_id and a ref_doc_id (all mine are the same value)?

Question 2:

Given a doc_id or ref_doc_id, how can i get all the nodes from a VectorStore with that id?

I tried:

vector_store.query(VectorStoreQuery(doc_ids=[my_doc_id]))

but i get :

ValueError: Query embedding is required for querying.
L
1 comment
a ref doc id is usually the ID of a parent document (which is also a doc id). Same thing, different name/meaning. Used to track the parent of a node

Only very recently started rolling out an api for this. If you are using the default vector store, it doesn't store text, so you need to do index.docstore.get_document("some node id")

Or index.docstore.get_ref_doc_info("some doc id/ref_doc_id") to get an object with all the node ids linked to that document

If using a vector db integration, there are a few new methods implemented for qdrant and chroma right now, vector_store.get() -- you can pass in node_ids=[id1, ...] or filters=<some filters> for metadata filtering (here you might want to filter for where ref_doc_id equals the id you are looking for)

Lastly, you could also use the underlying vector db client directly, if using some integration
Add a reply
Sign up and join the conversation on Discord