-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
Use extend method for embeddings concatenation in mlflow_gateway #14358
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
dosubot
bot
added
the
size:XS
This PR changes 0-9 lines, ignoring generated files.
label
Dec 6, 2023
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
dosubot
bot
added
Ɑ: embeddings
Related to text embedding models module
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
labels
Dec 6, 2023
@hwchase17 I just want to use the extend method instead of the append method. Could you take a quick look at it? :) |
hwchase17
approved these changes
Jan 4, 2024
dosubot
bot
added
the
lgtm
PR looks good. Use to confirm that a PR is ready for merging.
label
Jan 4, 2024
cc @harupy |
baskaryan
approved these changes
Feb 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
community
Related to langchain-community
Ɑ: embeddings
Related to text embedding models module
lgtm
PR looks good. Use to confirm that a PR is ready for merging.
size:XS
This PR changes 0-9 lines, ignoring generated files.
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.
Description
There is a bug in the concatenation of embeddings obtained from MLflow that does not conform to the type hint requested by the function.
It is logical to expect a List[List[float]] for a List[str]. However, the append method encapsulates the response in a global List.
To avoid this, the extend method should be used, which will add the embeddings of all strings at the same list level.
Testing
I have tried using OpenAI-ADA to obtain the embeddings, and the result of executing this snippet is as follows:
When in reality, the expected result should be:
The above result complies with the expected type hint: List[List[float]] . As I mentioned, we can achieve that by using the extend method instead of the append method.