-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(langchain-community/pgvector): add support for advanced metadata filters in similarity search #8842
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
Conversation
🦋 Changeset detectedLatest commit: 0882997 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
hntrl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! couple of Q's:
- Could we add to the pgvector docs for these filter types?
- Could we rework the
Metadatatype on line 11 to understand these new filter types?
|
Thank you @hntrl for the review. |
- Introduced a new `MetadataFilter` type to define the structure of filter objects. - Implemented a `buildFilterClauses` method to dynamically construct SQL WHERE clauses based on the provided filters. - Updated PGVectorStore documentation Fix: - deleteByFilter method didn't apply complex filters at all, now it uses 'buildFilterClauses' to build the proper query string; New tests: - Expanded integration tests to cover all new filtering functionalities, ensuring correct behavior for each operator. - Refactored existing tests to utilize the new filtering structure, improving test clarity and coverage.
|
… StrictMetadataFilter as a new one
| * { | ||
| * category: "test", // Simple equality | ||
| * score: { gte: 80 }, // Operator filter | ||
| * tags: { in: ["test1", "test2"] } // Another operator filter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Add support for advanced metadata filters in PGVector similarity search
This PR enhances the PGVector vector store integration by adding support for advanced metadata filtering capabilities during similarity search operations.
Changes
Benefits
Testing
This enhancement makes the PGVector integration more powerful and flexible for applications that need to combine semantic similarity with metadata-based filtering.