-
Notifications
You must be signed in to change notification settings - Fork 63
Add support for multimodal embeddings in vectorizers #452
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
Open
vishal-bala
wants to merge
51
commits into
main
Choose a base branch
from
feat/RAAE-1240/multimodal-embeddings
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,821
−1,794
Conversation
This file contains hidden or 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
…tween `HybridQuery` and `AggregateHybridQuery`
Since some multimodal models can be used with `sentence-transformers` just by passing in Image objects instead of strings, we don't want to block that option.
…E-1240/multimodal-embeddings # Conflicts: # docs/api/query.rst # docs/user_guide/11_advanced_queries.ipynb # redisvl/index/index.py # redisvl/query/hybrid.py # tests/integration/test_hybrid.py # tests/unit/test_hybrid_types.py # uv.lock
Collaborator
justin-cechmanek
left a comment
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.
All the changes look good. Not sure how to best handle the breaking changes around the vectorizer class names and text/content parameter name.
Collaborator
|
We can maintain backward compatibility and a deprecation warning by having wrapper classes that extend the newly changed vectorizers. |
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.
This PR generalizes the
BaseVectorizerto be agnostic to any modality (since it previously exclusively supported text inputs). Building from the new base, this PR then extends the implementation for some vectorizers to support multimodal embeddings (renaming them away from being specifically for text).BaseVectorizerThe move away from having the
BaseVectorizerexplicitly expect text inputs means a change in the signature of theembedmethods away fromvectorizer.embed(text="lorem ipsum...")tovectorizer.embed(content="lorem ipsum..."). This is a breaking change for existing usages of the vectorizers that use the keyword argument, and the usages will need to be updated to align with the new schema.Caching for multimodal embeddings is supported for all vectorizers introduced in this PR.
Multimodal Implementations
The following vectorizers have been renamed to no longer be explicitly text vectorizers, and moved to no longer be defined in the
vectorize.textmodule. Imports and usages for these vectorizers will need to be updated to avoid errors. TheCustomTextVectorizerhas also been renamed and moved to beredisvl.utils.vectorize.custom.CustomVectorizer.VoyageAI
Old:
redisvl.utils.vectorize.text.voyageai.VoyageAITextVectorizerNew:
redisvl.utils.vectorize.voyageai.VoyageAIVectorizerVertex AI
Old:
redisvl.utils.vectorize.text.vertexai.VertexAITextVectorizerNew:
redisvl.utils.vectorize.vertexai.VertexAIVectorizerAmazon Bedrock
Old:
redisvl.utils.vectorize.text.bedrock.BedrockTextVectorizerNew:
redisvl.utils.vectorize.bedrock.BedrockVectorizerHugging Face
While the sentence-transformers package does not explicitly allow for multimodal usage (the package is designed for text-based use-cases), some officially supported multimodal models can be used without issue via the
SentenceTransformerclass. This PR removes strict enforcement of text inputs for theHFTextVectorizerto enable these use-cases.Open Topics
Since this PR introduces a few breaking changes, do we want to maintain backwards compatibility (with deprecation warnings) for syntax that is changing? This includes:
vectorizer.embed(text=...)->vectorizer.embed(content=...)VoyageAITextVectorizer->VoyageAIVectorizerVertexAITextVectorizer->VertexAIVectorizerBedrockTextVectorizer->BedrockVectorizerCustomTextVectorizer->CustomVectorizer