Find answers from the community

Home
Members
Jimmy Phan
J
Jimmy Phan
Offline, last seen 3 months ago
Joined September 25, 2024
Hello Community, today I am trying to refresh my vector index and I'm following this tutorial https://docs.llamaindex.ai/en/stable/module_guides/indexing/document_management.html# . However, it happened TypeError as the screenshot 1. I understood that keyword argument 'delete_from_docstore' is duplicated in delete_ref_doc() function. I was trying to go to base llama_index/indices/base.py and commented out delete_from_docstore=True as the screenshot 2. And then, it happened KeyError error as screenshot 3, but I dont understand why it refers to def delete(self, doc_id: str) , and I can't find def delete(self, doc_id: str) in base.py, I only see delete_ref_doc function there. What should I do now, guys? Please help me. Thank you.

Plain Text
documents = SimpleDirectoryReader(input_dir="sleep", filename_as_id=True).load_data()
print(f"No of documents: {len(documents)}")
# rebuild storage context
storage_context = StorageContext.from_defaults(persist_dir="storage/sleep")
# load index from storage
index = load_index_from_storage(storage_context=storage_context)
print("Successfully load index from storage!")
# refresh the index
refreshed_docs = index.refresh_ref_docs(documents=documents, update_kwargs={"delete_kwargs": {"delete_from_docstore": True}})
print(refreshed_docs)  # true values indicate that the value were refreshed
print(f"No of inserted/refreshed documents: {sum(refreshed_docs)}")
65 comments
C
W
J
Hi, I am new to llamaindex and I'm trying to extract metadata of each node at the moment. I'm following tutorial in the documents and is using CustomExtractor as instruction. However, it had an error like this. I have searched solutions on the internet, but there isn't anything helpful. Please help me to solve this.
7 comments
J
W
L