fix(vertex_ai): add gemini-embedding model name fallback in routing

Add fallback check in vertex_ai embedding routing: if get_model_info
fails to find uses_embed_content flag, models with 'gemini-embedding'
prefix are still routed to GoogleBatchEmbeddings handler instead of
falling through to the legacy :predict handler.

Fixes BerriAI/litellm#23508
This commit is contained in:
Ethan T. 2026-03-13 13:44:06 +08:00
parent 68f23d851d
commit 6fa5099fc3

View file

@ -5204,6 +5204,12 @@ def embedding( # noqa: PLR0915
except Exception:
uses_embed_content = False
# Fallback: models with "gemini-embedding" prefix use the
# embedContent API, not the legacy :predict endpoint. This
# ensures correct routing even when model info lookup fails.
if not uses_embed_content and model.startswith("gemini-embedding"):
uses_embed_content = True
if uses_embed_content:
response = google_batch_embeddings.batch_embeddings( # type: ignore
model=model,