-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 DotProduct Method and README Example for Embedding Similarity Search #492
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Implement a DotProduct() method for the Embedding struct to calculate the dot product between two embeddings. - Add a custom error type for vector length mismatch. - Update README.md with a complete example demonstrating how to perform an embedding similarity search for user queries. - Add unit tests to validate the new DotProduct() method and error handling.
Codecov Report
@@ Coverage Diff @@
## master #492 +/- ##
==========================================
+ Coverage 97.30% 97.46% +0.15%
==========================================
Files 18 18
Lines 780 829 +49
==========================================
+ Hits 759 808 +49
Misses 15 15
Partials 6 6
|
Thank you so much, this was coming for a long time :D |
sashabaranov
approved these changes
Oct 2, 2023
mudler
referenced
this pull request
in mudler/LocalAI
Oct 14, 2023
…#1159) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/sashabaranov/go-openai](https://togithub.com/sashabaranov/go-openai) | require | minor | `v1.15.4` -> `v1.16.0` | --- ### Release Notes <details> <summary>sashabaranov/go-openai (github.com/sashabaranov/go-openai)</summary> ### [`v1.16.0`](https://togithub.com/sashabaranov/go-openai/releases/tag/v1.16.0) [Compare Source](https://togithub.com/sashabaranov/go-openai/compare/v1.15.4...v1.16.0) #### What's Changed - Add DotProduct Method and README Example for Embedding Similarity Search by [@​ealvar3z](https://togithub.com/ealvar3z) in [https://github.com/sashabaranov/go-openai/pull/492](https://togithub.com/sashabaranov/go-openai/pull/492) - fix: use any for n_epochs by [@​henomis](https://togithub.com/henomis) in [https://github.com/sashabaranov/go-openai/pull/499](https://togithub.com/sashabaranov/go-openai/pull/499) - Feat Add headers to openai responses by [@​henomis](https://togithub.com/henomis) in [https://github.com/sashabaranov/go-openai/pull/506](https://togithub.com/sashabaranov/go-openai/pull/506) - Support get http header and x-ratelimit-\* headers by [@​liushuangls](https://togithub.com/liushuangls) in [https://github.com/sashabaranov/go-openai/pull/507](https://togithub.com/sashabaranov/go-openai/pull/507) **Full Changelog**: sashabaranov/go-openai@v1.15.4...v1.16.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/go-skynet/LocalAI). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44LjEiLCJ1cGRhdGVkSW5WZXIiOiIzNy44LjEiLCJ0YXJnZXRCcmFuY2giOiJtYXN0ZXIifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the change
Describe your solution
Tests
Additional context
Issue: #XXXX