fix(py/plugins/google-genai): list only callable Vertex embedders#5695
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the Vertex AI plugin to use a curated, hardcoded list of verified callable embedders (VERTEX_KNOWN_EMBEDDERS) instead of dynamically discovering them from the Vertex AI catalog, which over-lists non-callable models. The feedback highlights that in the updated unit test, the mock client setup is unused because _list_known_embedders no longer queries the catalog. To make the test meaningful, it is recommended to also verify that the non-callable embedding model is successfully filtered out of the discovered text models list.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
73ba9f1 to
93716bb
Compare
What
The Vertex AI plugin discovered embedders by scanning the model catalog for names containing "embedding". Vertex returns its full publisher catalog, including models that are published but not callable in a given project or
region, so this surfaced embedders that fail at call time. For example,
vertexai/gemini-embedding-2was registered and shown in the Dev UI but returned 404 / FAILED_PRECONDITION when invoked.This change stops discovering Vertex embedders from the catalog and advertises a curated list of known-callable models instead, matching the JS plugin.
Why
Vertex AI's
models.list()returns the global publisher catalog and reportssupported_actions = Nonefor every entry. Unlike the Gemini API path, the plugin cannot categorize Vertex models by capability, so it fell back to matching the substring "embedding" in the model name. That heuristic cannot tell a model that is listed and callable apart from one that is listed but not callable, so over-listed models leaked into the registry.The JS plugin already avoids this by not discovery-listing Vertex embedders. It exposes a hand-curated set and keeps resolution permissive. This brings the Python plugin to parity.
How
VERTEX_KNOWN_EMBEDDERSinmodels/embedder.py:text-embedding-005,text-multilingual-embedding-002,gemini-embedding-001._list_genai_modelsno longer collects embedders on the Vertex path.Name-matched embedding models are skipped so they also do not leak into the
Gemini bucket.
VertexAI.init,VertexAI._list_known_embedders, andVertexAI.list_actionsiterate
VERTEX_KNOWN_EMBEDDERSinstead of discovery output.resolve()is unchanged and stays permissive, so callers can still referenceany embedder by explicit name, including newly released models that are not in
the curated list.
test_vertexai_list_known_embeddersto assert the advertised setequals the curated list and that a non-callable catalog entry
(
gemini-embedding-2) is never surfaced.Excluded: multimodalembedding@001
multimodalembedding@001is deliberately left out. The currentEmbedderroutes every request through the SDK'sembed_content, which on Vertex only emits the text-embedder request shape ({'content': ...}) and drops non-text parts. That model rejects that shape, so it cannot be called through this path for either text or media. Proper multimodal support via the:predictendpoint with{text, image, video}instances is tracked in #5649 , which will re-add the model once that path exists.Testing
text-embedding-005,text-multilingual-embedding-002, andgemini-embedding-001verified working against Vertex in the Dev UI.Screenshots