Find answers from the community

Updated 2 years ago

how do i get the ref_doc_id from the docstore

At a glance

The community member @kapa.ai asked how to get the ref_doc_id from the docstore. Another community member, @Raz, responded with a detailed explanation. They stated that to get the ref_doc_id from the docstore in LlamaIndex, you can use the get_all_ref_doc_info() method, which returns a mapping of ref_doc_id to RefDocInfo for all ingested documents. They provided an example of how to use this method and noted that the actual usage may vary depending on how the LlamaIndex environment is set up. They also mentioned that the community member can refer to the LlamaIndex documentation for more details.

@kapa.ai how do i get the ref_doc_id from the docstore
k
2 comments
Please stand by @Raz as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
To get the ref_doc_id from the docstore in LlamaIndex, you can use the get_all_ref_doc_info() method. This method returns a mapping of ref_doc_id to RefDocInfo for all ingested documents.

Here is an example of how you can use it:

Plain Text
ref_doc_info_mapping = docstore.get_all_ref_doc_info()


In this example, docstore is an instance of your document store. The get_all_ref_doc_info() method will return a dictionary where the keys are the ref_doc_ids of all ingested documents.

Please note that the actual usage might vary depending on how you have set up your LlamaIndex environment.

For more details, you can refer to the LlamaIndex documentation ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord