Find answers from the community

Updated last year

how do i get the ref_doc_id from the docstore

@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