mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
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:
parent
68f23d851d
commit
6fa5099fc3
1 changed files with 6 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue