M
Mastraโ€ข2mo ago
yantakus

How to clean up embeddings?

Hi there. I'm building a RAG app with Mastra. I create vector embeddings for uploaded documents. I use a separate index per user and add docId to metadata to use when filtering by document. But I can't understand, how do I clean up stale vectors when a user deletes a document? Should I remove each of them in a loop, previously storing all vector ids somewhere? Or maybe I'm missing something? My use case seems to be a pretty standard one for RAG, so I'm a bit confused, why this is not covered in the docs. Just to be clear, I like the docs (for example comparing to Convex Agent/RAG components docs).
3 Replies
Mastra Triager
Mastra Triagerโ€ข2mo ago
๐Ÿ“ Created GitHub issue: https://github.com/mastra-ai/mastra/issues/9503
GitHub
[DISCORD:1433193170182738144] How to clean up embeddings? ยท Issue ...
This issue was created from Discord post: https://discord.com/channels/1309558646228779139/1433193170182738144 Hi there. I'm building a RAG app with Mastra. I create vector embeddings for uploa...
_roamin_
_roamin_โ€ข2mo ago
Hi @yantakus ! I don't think we have the utils to do that available at the moment, you can follow the GH issue for updates, but not sure when this will be worked on. Open for PRs ๐Ÿ˜‰
Abhi Aiyer
Abhi Aiyerโ€ข7d ago
We have this now! deleteVectors can take a metadata filter to delete things https://mastra.ai/docs/v1/rag/vector-databases#deleting-vectors
Storing Embeddings in A Vector Database | RAG | Mastra Docs v1 Beta
Mastra v1 Beta: Guide on vector storage options in Mastra, including embedded and dedicated vector databases for similarity search.

Did you find this page helpful?