Find answers from the community

Updated 3 months ago

Delete

Hey hey! Is it possible to delete vectors from a vector storage (pgvector) without having a specific document ID? Basically, if my customer has a "dataset" and that dataset was an import of a directory with 4,000 files. The customer then wants to delete the dataset, we want to remove all the vectors associated with those 4,000 files. Is there a way to select all documents with some given metadata and "delete" them?

Or, do I have to use SQLAlchemy/SQL calls to select and remove them?
L
d
3 comments
We recently added delete_nodes() to the vector store api (in addition to get_nodes() and clear()), to delete by node ID or metadata filter, but it's not implemented yet for pgvector

So, using sqlalchemy would be the way to go. But also, implementing the new methods is a welcome pr!
Ok, I thought I was losing my mind for a minute, figured since I could create I could delete but I was having a very hard time trying to find the workflow for it or example code. I did have chatGPT write me a routine I was testing now that does engine.connect() and tries to delete them (testing that now)
I'm not sure I have the expertise yet to be able to do the PR, but probably in the future as I get more up to speed
Add a reply
Sign up and join the conversation on Discord