Find answers from the community

Updated 3 months ago

Hey guys I asked this on GH but I think

Hey guys! I asked this on GH, but I think I may have better luck here :).

I'm unable to delete documents from an index in llama-index after updating to version 0.5.2. All I'm doing is:
  1. Breaking a document into smaller documents, all with the same document ID (doc_id)
  2. Calling index.insert(d) on each of these smaller documents
  3. Saving the index to a string and then to my local file system
  4. Loading the index from my file system
  5. Calling index.delete(doc_id)
Before updating, this would delete every document with doc_id from the index. Now, it doesn't seem to do anything. The file size is slightly smaller after deleting, but a majority of the data is still there. I've attached before and after files for an example index.
L
k
5 comments
I think this might be an actual bug πŸ€” Looking at the source code, the delete code seems to be deleting a lot less than before (and clearly not deleting much lol)

Old:
https://github.com/jerryjliu/llama_index/blob/main/gpt_index/data_structs/data_structs.py#L229

New:
https://github.com/jerryjliu/llama_index/blob/main/gpt_index/data_structs/data_structs_v2.py#L201
I'll try a few things locally, maybe it's an easy fix πŸ™‚
Oh wow you're right haha, thanks for looking into it!
This has been fixed! πŸ’ͺ
Thanks for the quick fix @Logan M, you guys are awesome!
Add a reply
Sign up and join the conversation on Discord