feat(google): add support for google embeddings and reranker#863
Open
ParadiseN1 wants to merge 2 commits intovectorize-io:mainfrom
Open
feat(google): add support for google embeddings and reranker#863ParadiseN1 wants to merge 2 commits intovectorize-io:mainfrom
ParadiseN1 wants to merge 2 commits intovectorize-io:mainfrom
Conversation
…ia vertex search api
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
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.
Summary
Adds full Google Cloud infrastructure support for Hindsight by adding google's embeddings and reranking models.
With this changes it is now possible to run Hindsight fully on Google Cloud's infrastructure (which is important for my production usecase):
GeminiEmbeddingsprovider usinggoogle.genaiSDK with both Gemini API (key auth) and Vertex AI (service account/ADC) support. Includes L2 normalization for truncated dimensions — Gemini only returns normalized vectors at full 3072 dims.GoogleCrossEncoderprovider using the Discovery Engine REST Ranking API withhttpx+google-auth.Changes
hindsight-api-slim/hindsight_api/engine/embeddings.py—GeminiEmbeddingswith Gemini API key and Vertex AI auth, configurableoutput_dimensionality, L2 normalization via numpyhindsight-api-slim/hindsight_api/engine/cross_encoder.py—GoogleCrossEncoderusing REST API with OAuth2 bearer tokensEMBEDDINGS_GEMINI_*,EMBEDDINGS_VERTEXAI_*,RERANKER_GOOGLE_*) with fallback to LLM Vertex AI keysgooglecase to bothcreate_embeddings_from_env()andcreate_cross_encoder_from_env()configuration.mdwith Google embeddings and reranker configUsage
Tested