mirror of
https://github.com/langchain-ai/langchain-postgres.git
synced 2026-07-16 01:33:18 -04:00
Feature Request: Support Deleting Vectors by Metadata in PGVector Class #49
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @shamspias on GitHub (Oct 15, 2024).
Currently, the
PGVectorclass only allows deleting vectors by specifying their IDs through thedeleteandadeletemethods. There is no built-in functionality to delete vectors based on metadata filters.Proposed Solution
Modify the
deleteandadeletemethods to accept an optionalfilterparameter. This parameter would allow users to specify conditions based on metadata fields, enabling the deletion of vectors that match these conditions. Utilize the existing_create_filter_clausemethod to generate the appropriate SQLAlchemy where clauses.Example Usage
Benefits
Additional Context
_create_filter_clausemethod correctly handles all supported operators and edge cases.