Repository navigation
fix(embedding): support stable Gemini Embedding 2 - #6383
Merged
Merged
Conversation
qin-ctx
approved these changes
Oct 21, 2026
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.
Description
Migrate OpenViking's Gemini embedder from the retired
gemini-embedding-2-previewdefault to stablegemini-embedding-2.This is a request-contract change, not only a model-name update. Google documents that stable Gemini Embedding 2 does not accept
EmbedContentConfig.task_type. It uses task instructions in the input text instead. The embedder now converts the existing OpenViking task options to Google's documented instruction formats for the stable model, while explicit legacy model configurations keep their field-based request behavior.Official contracts:
Human Involvement
Related Issue
Fixes #6382
Type of Change
Changes Made
gemini-embedding-2the direct embedder default and register its 8192-token, 3072-dimension contract.task_typeandtitlerequest fields.Testing
Validation results:
The two deselected configuration assertions also fail on untouched
upstream/main: their case-sensitive regex expectsInvalid, while the existing validator emitsinvalid. Mypy reports the same nine pre-existing findings on this branch and untouchedupstream/main. A live Gemini API run was not possible becauseGOOGLE_API_KEYwas not available; request-shape coverage uses the official SDK types and mocked client boundary.Checklist
Screenshots (if applicable)
Not applicable.
Additional Notes
The preview model remains recognized for explicit legacy configuration so existing deployments do not change request shape silently. Google's service retirement schedule still determines whether that remote model remains callable.