Skip to content

fix(js/plugins/pinecone): pass retriever filter to Pinecone query - #5864

Open
a2105z wants to merge 2 commits into
genkit-ai:mainfrom
a2105z:fix/js-pinecone-retriever-filter
Open

fix(js/plugins/pinecone): pass retriever filter to Pinecone query#5864
a2105z wants to merge 2 commits into
genkit-ai:mainfrom
a2105z:fix/js-pinecone-retriever-filter

Conversation

@a2105z

@a2105z a2105z commented Jul 30, 2026

Copy link
Copy Markdown

Summary

  • Forward the retriever filter option into Pinecone's query() call so metadata filters are applied instead of silently ignored.
  • Add a small toPineconeQuery helper and unit tests covering filter present/absent cases.

Fixes #3677

Test plan

  • npm test in js/plugins/pinecone
  • Retrieve with a metadata filter against a real Pinecone index and confirm matches are filtered

The filter option was accepted in the retriever schema but never forwarded
to scopedIndex.query(), so metadata filters were silently ignored.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread js/plugins/pinecone/src/index.ts
Comment thread js/plugins/pinecone/src/query.ts
Comment thread js/plugins/pinecone/tests/retriever_test.ts
@a2105z

a2105z commented Jul 30, 2026

Copy link
Copy Markdown
Author

Hi @pavelgj @ifielker — whenever you have a moment, could you take a look at this small JS pinecone fix and approve the pending fork workflows if needed?

It forwards the existing retriever filter option into Pinecone's query() call (Fixes #3677). Thanks!

Guard against empty embedder results, forward sparseVector for hybrid
search, and cover it in unit tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JS] Pinecone plugin: filter option accepted but not passed to query API

1 participant