fix(js/plugins/pinecone): pass retriever filter to Pinecone query - #5864
Open
a2105z wants to merge 2 commits into
Open
fix(js/plugins/pinecone): pass retriever filter to Pinecone query#5864a2105z wants to merge 2 commits into
a2105z wants to merge 2 commits into
Conversation
The filter option was accepted in the retriever schema but never forwarded to scopedIndex.query(), so metadata filters were silently ignored.
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the Pinecone retriever query construction by introducing a helper function toPineconeQuery in a new file query.ts, adding corresponding unit tests, and updating the package.json with a test script. Feedback highlights the need to safely access queryEmbeddings[0] to prevent potential runtime errors, and suggests forwarding the sparseVector option to support hybrid search, along with adding a unit test for it.
Author
Guard against empty embedder results, forward sparseVector for hybrid search, and cover it in unit tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
filteroption into Pinecone'squery()call so metadata filters are applied instead of silently ignored.toPineconeQueryhelper and unit tests covering filter present/absent cases.Fixes #3677
Test plan
npm testinjs/plugins/pineconefilteragainst a real Pinecone index and confirm matches are filtered