-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
pinecone[patch]: Fix document ID not getting set when returned from PineconeStore #6539
Merged
Conversation
This file contains 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
dosubot
bot
added
the
size:M
This PR changes 30-99 lines, ignoring generated files.
label
Aug 15, 2024
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
dosubot
bot
added
the
auto:improvement
Medium size change to existing code to handle new use-cases
label
Aug 15, 2024
nick-w-nick
changed the title
Fix document ID not getting set when returned from PineconeStore
community[patch]: Fix document ID not getting set when returned from PineconeStore
Aug 15, 2024
bracesproul
previously requested changes
Aug 15, 2024
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.
thanks for pushing this up, well needed update! Could you also push up a commit adding a test for this? Thank you!
bracesproul
changed the title
community[patch]: Fix document ID not getting set when returned from PineconeStore
pinecone[patch]: Fix document ID not getting set when returned from PineconeStore
Aug 15, 2024
dosubot
bot
added
size:L
This PR changes 100-499 lines, ignoring generated files.
and removed
size:M
This PR changes 30-99 lines, ignoring generated files.
labels
Aug 16, 2024
Thank you! |
This was referenced Sep 7, 2024
This was referenced Sep 13, 2024
CarterMorris
pushed a commit
to CarterMorris/langchainjs
that referenced
this pull request
Nov 10, 2024
…ineconeStore (langchain-ai#6539) * added _formatMatches privatemethod * updated similaritySearchVectorWithScore to use _formatMatches * updated maxMarginalRelevanceSearch to use _formatMatches * Add integration test --------- Co-authored-by: jacoblee93 <jacoblee93@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
auto:improvement
Medium size change to existing code to handle new use-cases
size:L
This PR changes 100-499 lines, ignoring generated files.
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.
When querying for documents using the
PineconeStore
via the various search methods, the documents getting returned from Pinecone currently have theirid
property set toundefined
.This is because
id
is omitted when the result is converted to a document prior to being returned, as shown below for each query method respectively:similaritySearchVectorWithScore
langchainjs/libs/langchain-pinecone/src/vectorstores.ts
Lines 424 to 426 in abdcd1f
maxMarginalRelevanceSearch
langchainjs/libs/langchain-pinecone/src/vectorstores.ts
Lines 476 to 478 in abdcd1f
This PR adds a new private method named
_formatMatches
that accepts an array of matches (ScoredPineconeRecord
) from theQueryResponse
interface. This method performs the same logic that was duplicated across the query methods, just with some added deconstruction safety rails as well as the addition of theid
property.Result from
similaritySearchWithScore
before this change (same forsimilaritySearchVectorWithScore
):Result from
similaritySearchWithScore
after this change (same forsimilaritySearchVectorWithScore
):Result from
similaritySearch
before this change (same asmaxMarginalRelevanceSearch
):Result from
similaritySearch
after this change (same asmaxMarginalRelevanceSearch
):