Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support Deleting Vectors by Metadata in PGVector Class #127

Open
shamspias opened this issue Oct 15, 2024 · 0 comments
Open

Comments

@shamspias
Copy link

Currently, the PGVector class only allows deleting vectors by specifying their IDs through the delete and adelete methods. There is no built-in functionality to delete vectors based on metadata filters.

Proposed Solution

Modify the delete and adelete methods to accept an optional filter parameter. 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_clause method to generate the appropriate SQLAlchemy where clauses.

Example Usage

# Delete vectors where the 'category' metadata field equals 'news'
vector_store.delete(filter={"category": {"$eq": "news"}})

Benefits

  • Enhanced Functionality: Allows deletion of vectors based on metadata, improving data management capabilities.
  • Flexibility: Supports complex queries using existing filter mechanisms.
  • Backward Compatibility: The existing functionality of deleting by IDs remains unaffected.

Additional Context

  • Ensure that the _create_filter_clause method correctly handles all supported operators and edge cases.
  • Maintain consistency with the rest of the class's API design.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant