-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: Add cosine similarity query #3464
feat: Add cosine similarity query #3464
Conversation
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.
LGTM, easy to read considering the planner packed stuff we went through. Approving assuming todo's etc are addressed before merge.
todo: Please make sure you add an introspection test(s) to make sure the new input type shows up in the correct shape in the correct place without breaking the GQL spec.
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.
Overall looks good (ignoring the hacky part).
I have mostly doc suggestions and few test requests.
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 for quick adjustments
11f4374
to
69feaa2
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3464 +/- ##
===========================================
- Coverage 78.51% 78.44% -0.07%
===========================================
Files 396 397 +1
Lines 37334 37571 +237
===========================================
+ Hits 29310 29470 +160
- Misses 6342 6405 +63
- Partials 1682 1696 +14
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 11 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Bug bash + PR Review: I am leaving/ moving this back to the bug bash Todo because it can probably benefit from being tested by one more person, my testing might have missed some other edge cases:
Should be very easy to fix and add a debug explain test for it, explained it all in the issue.
|
Bug bash result: After deleting the document querying works as normal. |
Relevant issue(s)
Resolves #3349
Description
This PR adds the possibility to calculate the cosine similarity between a vector field and a given vector.
To achieve this we added the
_similarity
system field which take a target field (part of the parent object) and vector as parameter.Note that the added code to mapper and planner is more of a "bolt on" addition given the current state of that part of the code base. A refactor is expected in the future.
Future work will allow giving a
content
parameter instead of thevector
if the target field has embedding generation configured. This will enable out-of-the-box RAG queries.Tasks
How has this been tested?
Added cosine similarity to integration testing
Specify the platform(s) on which this was tested: