Find answers from the community

Updated 3 months ago

Hi, I am tryin to use

Hi, I am tryin to use PrevNextNodePostprocessor to retrieve more nodes from the same document but I get raise ValueError(f"doc_id {doc_id} not found.") ValueError: doc_id e4e59a11-a8d6-4141-b775-9b60d8af1788 not found. whenever I use this option.
This is the code I implemented to use this feature:
node_postprocessors =[ PrevNextNodePostprocessor(docstore=storage_context.docstore,num_nodes=2,mode="both")]
First I thought that maybe some retreived nodes are the first or the last chunk of document and there is no next/prev node related to them but it seems this is not the main problem.
Any I idea what am I doing wrong?
r
H
2 comments
Check if the doc_id exists in your docstore. You can do this by querying the docstore directly. You can do this with the following code:
try:
document = storage_context.docstore.get_document(doc_id)
print(f'Document with ID {doc_id} found in the docstore.')
except ValueError:
print(f'Document with ID {doc_id} not found in the docstore.')
Thanks@rahul for the reply, but it seems that the document with that specific doc_id does not exist. Why does the function gets the wrong doc_id for that node, since i have no control over it and the function should have found the node's document id by itself. What could cause this issue?
Add a reply
Sign up and join the conversation on Discord