-
Notifications
You must be signed in to change notification settings - Fork 142
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
new: add sparse vectors support in discovery and recommend in local mode #571
Conversation
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
tests/fixtures/points.py
Outdated
@@ -47,7 +47,7 @@ def generate_random_sparse_vector_list( | |||
|
|||
|
|||
def random_sparse_vectors( | |||
vector_sizes: Union[Dict[str, int], int], | |||
vector_sizes: Union[Dict[str, int]], |
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.
can we remove the Union
completely then?
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.
yes, we can
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.
The test coverage looks excellent!
I did not review in details the scoring implementation but I am confident due to the congruence tests 👍
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.
Lots of work in a single PR, but still easy to go through. Nothing to complain aside from some nits
qdrant_client/local/distances.py
Outdated
class DistanceOrder(str, Enum): | ||
BIGGER_IS_BETTER = "bigger_is_better" | ||
SMALLER_IS_BETTER = "smaller_is_better" | ||
QueryVector = Union[ |
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.
Only a suggestion, I'll leave it to your criteria
QueryVector = Union[ | |
DenseQueryVector = Union[ |
List[models.SparseVector], | ||
types.Filter, | ||
]: | ||
def split_examples( |
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.
I had to read a few times to understand what this was doing, maybe:
def split_examples( | |
def examples_into_vectors( |
?
else: | ||
query_vector = SparseRecoQuery( | ||
positive=sparse_positive_vectors, negative=sparse_negative_vectors | ||
) |
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.
what if there are no sparse_positive_vectors
nor sparse_negative_vectors
either?
Edit: it is already checked in
raise ValueError("No positive or negative examples given") |
tests are failing now due to #580 |
Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
a4f5892
to
50d7b6e
Compare
…ode (qdrant#571) * new: add sparse vectors support in discovery and recommend in local mode * chore: remove redundant file * chore: remove another redundant file * fix: fix type hint for python3.8 * fix: remove redundant types from check * refactoring: remove redundant union * refactoring: remove redundant import * fix: fix type hint * fix: fix type hint * refactoring: improve exception description Co-authored-by: Luis Cossío <luis.cossio@outlook.com> * refactoring: improve exception description Co-authored-by: Luis Cossío <luis.cossio@outlook.com> * refactoring: address review comments --------- Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
…ode (#571) * new: add sparse vectors support in discovery and recommend in local mode * chore: remove redundant file * chore: remove another redundant file * fix: fix type hint for python3.8 * fix: remove redundant types from check * refactoring: remove redundant union * refactoring: remove redundant import * fix: fix type hint * fix: fix type hint * refactoring: improve exception description Co-authored-by: Luis Cossío <luis.cossio@outlook.com> * refactoring: improve exception description Co-authored-by: Luis Cossío <luis.cossio@outlook.com> * refactoring: address review comments --------- Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
more than a half of the PR are tests 🙈