-
Notifications
You must be signed in to change notification settings - Fork 102
Add search and upsert records #440
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
Add search and upsert records #440
Conversation
5068508
to
9fcb8db
Compare
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 great, thanks again!
fields: Optional[List[str]] = ["*"], # Default to returning all fields | ||
) -> SearchRecordsResponse: | ||
"""Alias of the search() method.""" | ||
pass |
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.
Should this be calling search()
?
fields: Optional[List[str]] = ["*"], # Default to returning all fields | ||
) -> SearchRecordsResponse: | ||
"""Alias of the search() method.""" | ||
pass |
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.
Maybe I'm just misunderstanding how pass
works in this context. 🤔
from pinecone import RerankModel | ||
|
||
|
||
class TestIndexRequestFactory: |
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.
Beautiful coverage, thank you.
Problem
Migrating
search_records
(aliased tosearch
) andupsert_records
from thepinecone-plugin-records
plugin.Solution
Working off the content of the records plugin, I have done the following:
_id
and_score
rest_urllib3.py
andrest_aiohttp.py
to handle record uploading with content-typeapplication/x-ndjson
upload_records
andsearch_records
methods 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.search
an alias ofsearch_records
.pop()
which mutates the input objects; this could be confusing for users if they are using those objects for anything elseRerankModel
I already handled disallowing the records plugin in yesterday's PR #438
Usage
These methods also have asyncio variants available
Type of Change