Skip to content
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

universal-search: Query Group API and local mode #690

Merged
merged 23 commits into from
Aug 9, 2024

Conversation

agourlay
Copy link
Member

@agourlay agourlay commented Jul 12, 2024

This PR adds the client API and local mode for the new group query API.

I took the opportunity to increase the gRPC coverage but it seems to create issues with newest Python versions.

Copy link

netlify bot commented Jul 12, 2024

Deploy Preview for poetic-froyo-8baba7 ready!

Name Link
🔨 Latest commit f84b0c1
🔍 Latest deploy log https://app.netlify.com/sites/poetic-froyo-8baba7/deploys/66b62f8a8bcfc80008a7012c
😎 Deploy Preview https://deploy-preview-690--poetic-froyo-8baba7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -2523,8 +2529,8 @@ def convert_vector_input(cls, model: rest.VectorInput) -> grpc.VectorInput:
@classmethod
def convert_recommend_input(cls, model: rest.RecommendInput) -> grpc.RecommendInput:
return grpc.RecommendInput(
positive=[cls.convert_vector_input(vector) for vector in model.positive],
negative=[cls.convert_vector_input(vector) for vector in model.negative],
positive=[cls.convert_vector_input(vector) for vector in model.positive] if model.positive is not None else None,
Copy link
Member Author

Choose a reason for hiding this comment

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

fix existing bug

@agourlay agourlay force-pushed the universal-search-query-group-API branch from f15898f to 9715a26 Compare July 16, 2024 07:07
@agourlay agourlay marked this pull request as ready for review July 17, 2024 13:48
@agourlay agourlay requested a review from joein July 17, 2024 13:48
@agourlay agourlay force-pushed the universal-search-query-group-API branch 4 times, most recently from 4c05a1f to de1c9ed Compare July 18, 2024 11:18
@agourlay agourlay requested a review from coszio July 18, 2024 13:39
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is still valuable to test grpc too. To edit this easier though, we could set the pytestmark global variable instead of repeating it for each test

pytestmark = pytest.mark.parametrize("prefer_grpc", [False, True])

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree, just wanted to take it out of this PR because it triggers issues unrelated to this PR 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

As the date time bug has been merged I re-pushed a bit of gRPC testing.
7f4f843

It found right away a bug in the with_lookup implementation :)

qdrant_client/client_base.py Show resolved Hide resolved
qdrant_client/qdrant_client.py Show resolved Hide resolved
qdrant_client/qdrant_client.py Outdated Show resolved Hide resolved
qdrant_client/qdrant_remote.py Show resolved Hide resolved
qdrant_client/qdrant_remote.py Show resolved Hide resolved
qdrant_client/conversions/conversion.py Outdated Show resolved Hide resolved
qdrant_client/local/local_collection.py Show resolved Hide resolved
qdrant_client/local/qdrant_local.py Show resolved Hide resolved
prefetch=[set_prefetch_limit_recursively(p, limit) for p in prefetch.prefetch],
)
else:
return types.Prefetch(limit=limit, prefetch=list())
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
return types.Prefetch(limit=limit, prefetch=list())
return rest_models.Prefetch(limit=limit, prefetch=list())

Copy link
Member Author

Choose a reason for hiding this comment

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

this does not work, it can't find such module 🤔

def set_prefetch_limit_recursively(prefetch: types.Prefetch, limit: int) -> types.Prefetch:
if prefetch is not None:
if isinstance(prefetch.prefetch, list):
return types.Prefetch(
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
return types.Prefetch(
return rest_models.Prefetch(

qdrant_client/http/models/models.py Outdated Show resolved Hide resolved
with_lookup_collection = self._get_collection(with_lookup)
else:
with_lookup_collection = self._get_collection(with_lookup.collection)

Copy link
Contributor

Choose a reason for hiding this comment

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

we need to resolve ids into vectors at this point, considering that we add lookup_from parameter first

Copy link
Member Author

Choose a reason for hiding this comment

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

added and tested in 2e52841 :)

@agourlay agourlay force-pushed the universal-search-query-group-API branch from d5e5e00 to 0f782d5 Compare July 22, 2024 10:11
@agourlay agourlay requested review from joein and coszio July 22, 2024 11:29
@agourlay
Copy link
Member Author

Dear reviewers, I believe I have addressed all your comments 🫡

@agourlay
Copy link
Member Author

Let's keep this PR open to not make cherry picking too difficult in case of patch release.

We could stack other PRs on top of it for the next release.

Copy link
Contributor

@coszio coszio left a comment

Choose a reason for hiding this comment

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

Happy to approve after the description edit :)

qdrant_client/qdrant_client.py Outdated Show resolved Hide resolved
agourlay and others added 13 commits August 8, 2024 22:46
* pre-implement dbsf

* add dbsf congruence tests

* mypy lints

* add conversions

* tests: add test for dbsf conversion

---------

Co-authored-by: George Panchuk <[email protected]>
* pre-implement random sampling

* generate models

* add conversions and tests

* fix mypy lints

* tests: add test for sample random conversion

* use camelcase Sample.Random

* review fixes

* fix mypy

---------

Co-authored-by: George Panchuk <[email protected]>
@joein joein force-pushed the universal-search-query-group-API branch from 9f31c70 to dc585b3 Compare August 8, 2024 21:32
@agourlay
Copy link
Member Author

agourlay commented Aug 9, 2024

@joein Thanks for handling the merges 👏

* add parametrized fixture for using grpc too

* compare grpc and http without running each setup twice

* fix: fix exception types in invalid types test

* fix: remove random seed which led to a erroneous sequence

---------

Co-authored-by: Luis Cossío <[email protected]>
@joein joein merged commit 44bbded into dev Aug 9, 2024
13 of 14 checks passed
joein added a commit that referenced this pull request Aug 12, 2024
* universal-search: Query Group API and local mode

* requires different logic for gRPC error assertion

* you come to me at runtime for a compile time issue

* suddenly throwing a different error

* test more group key types

* extend limit of prefetches during group_by

* rescoring is the issue

* one problem at a time please

* code review

* regen clients

* code review

* add lookup_from to query_points_groups

* test with_lookup

* test and fix gRPC

* drop dedicated conversion

* Update qdrant_client/qdrant_client.py

Co-authored-by: Luis Cossío <[email protected]>

* regen async

* Distribution-based score fusion in local mode (#703)

* pre-implement dbsf

* add dbsf congruence tests

* mypy lints

* add conversions

* tests: add test for dbsf conversion

---------

Co-authored-by: George Panchuk <[email protected]>

* Random sample in local mode (#705)

* pre-implement random sampling

* generate models

* add conversions and tests

* fix mypy lints

* tests: add test for sample random conversion

* use camelcase Sample.Random

* review fixes

* fix mypy

---------

Co-authored-by: George Panchuk <[email protected]>

* fix: add type ignore for mypy

* fix: fix type hints for 3.8

* fix: do not run mypy on async client generator in CI, simplify condition

* Grpc comparison in tests (#726)

* add parametrized fixture for using grpc too

* compare grpc and http without running each setup twice

* fix: fix exception types in invalid types test

* fix: remove random seed which led to a erroneous sequence

---------

Co-authored-by: Luis Cossío <[email protected]>

---------

Co-authored-by: Luis Cossío <[email protected]>
Co-authored-by: George Panchuk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants