-
Notifications
You must be signed in to change notification settings - Fork 2k
[ENH] Add python & js client support to query on subset of IDs #4250
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -264,6 +264,7 @@ async def _query( | |
| self, | ||
| collection_id: UUID, | ||
| query_embeddings: Embeddings, | ||
| ids: Optional[IDs] = None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. docstring(?) |
||
| n_results: int = 10, | ||
| where: Optional[Where] = None, | ||
| where_document: Optional[WhereDocument] = None, | ||
|
|
@@ -728,6 +729,7 @@ async def _query( | |
| self, | ||
| collection_id: UUID, | ||
| query_embeddings: Embeddings, | ||
| ids: Optional[IDs] = None, | ||
| n_results: int = 10, | ||
| where: Optional[Where] = None, | ||
| where_document: Optional[WhereDocument] = None, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -482,6 +482,7 @@ def _query( | |
| self, | ||
| collection_id: UUID, | ||
| query_embeddings: Embeddings, | ||
| ids: Optional[IDs] = None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add to telemetry
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added, thanks |
||
| n_results: int = 10, | ||
| where: Optional[Where] = None, | ||
| where_document: Optional[WhereDocument] = None, | ||
|
|
@@ -490,10 +491,12 @@ def _query( | |
| database: str = DEFAULT_DATABASE, | ||
| ) -> QueryResult: | ||
| query_amount = len(query_embeddings) | ||
| filtered_ids_amount = len(ids) if ids else 0 | ||
| self.product_telemetry_client.capture( | ||
| CollectionQueryEvent( | ||
| collection_uuid=str(collection_id), | ||
| query_amount=query_amount, | ||
| filtered_ids_amount=filtered_ids_amount, | ||
| n_results=n_results, | ||
| with_metadata_filter=query_amount if where is not None else 0, | ||
| with_document_filter=query_amount if where_document is not None else 0, | ||
|
|
@@ -506,6 +509,7 @@ def _query( | |
|
|
||
| rust_response = self.bindings.query( | ||
| str(collection_id), | ||
| ids, | ||
| query_embeddings, | ||
| n_results, | ||
| json.dumps(where) if where else None, | ||
|
|
||
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.
add to docstring(?)
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.
added, thanks