Add search and upsert records#440
Merged
jhamon merged 5 commits intorelease-candidate/2025-01from Jan 30, 2025
Merged
Conversation
5068508 to
9fcb8db
Compare
Contributor
austin-denoble
left a comment
There was a problem hiding this comment.
Looks great, thanks again!
| fields: Optional[List[str]] = ["*"], # Default to returning all fields | ||
| ) -> SearchRecordsResponse: | ||
| """Alias of the search() method.""" | ||
| pass |
Contributor
There was a problem hiding this comment.
Should this be calling search()?
| fields: Optional[List[str]] = ["*"], # Default to returning all fields | ||
| ) -> SearchRecordsResponse: | ||
| """Alias of the search() method.""" | ||
| pass |
Contributor
There was a problem hiding this comment.
Maybe I'm just misunderstanding how pass works in this context. 🤔
| from pinecone import RerankModel | ||
|
|
||
|
|
||
| class TestIndexRequestFactory: |
Contributor
There was a problem hiding this comment.
Beautiful coverage, thank you.
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.
Problem
Migrating
search_records(aliased tosearch) andupsert_recordsfrom thepinecone-plugin-recordsplugin.Solution
Working off the content of the records plugin, I have done the following:
_idand_scorerest_urllib3.pyandrest_aiohttp.pyto handle record uploading with content-typeapplication/x-ndjsonupload_recordsandsearch_recordsmethods into the request factory where they could more easily be unit tested. The logic around parsing user inputs into the openapi request objects is surprisingly complicated, so I added quite a lot of new unit tests checking some of those edge cases.searchan alias ofsearch_records.pop()which mutates the input objects; this could be confusing for users if they are using those objects for anything elseRerankModelI already handled disallowing the records plugin in yesterday's PR #438
Usage
These methods also have asyncio variants available
Type of Change