-
Notifications
You must be signed in to change notification settings - Fork 201
feat: support multiple text embedding providers #76
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: support multiple text embedding providers #76
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.
Thanks for the new addition! A couple of comments.
packages/backend/pyproject.toml
Outdated
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.
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.
In _projection_for_texts, we have a caching mechanism that computes a hash from the parameters and use the hash as a cache filename. It seems like we are not taking into account all text projector parameters (e.g., the text projector type, dimensions). Could you update the code to include the text projector type (as string) and args into the hasher, and increment the "version" number?
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.
Of course. Thanks for pointing it out. Addressed this in 823a82b.
Summary
Adds support for multiple text embedding providers through LiteLLM integration, enabling users to leverage API-based models (OpenAI, Cohere, Azure, Ollama, etc.) alongside the existing local SentenceTransformers approach.
compute_text_projection()API remains 100% backward compatible; new parameters are optional.Changes
--text-projectorto route betweenlitellmandsentence_transformers, and exposed--api-key,--api-base,--dimensions, and--syncflags for LiteLLM-specific configurationTextProjectorCallbacktype and provider-specific implementations (_project_text_with_sentence_transformers,_project_text_with_litellm) so that we can keep benefitting from the existing caching approach regardless of the model used to compute the projectionsTesting
Verified in packages/backend/examples/notebook.ipynb with:
nomic-embed-text)text-embedding-3-small)