Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

add VertexAITextEmbeddingConfig

Ishaan Jaff541033ec7e22
diff --git a/litellm/llms/vertex_ai_and_google_ai_studio/vertex_embeddings/embedding_handler.py b/litellm/llms/vertex_ai_and_google_ai_studio/vertex_embeddings/embedding_handler.py
index 72b21562e54..4cd5513c4fd 100644
--- a/litellm/llms/vertex_ai_and_google_ai_studio/vertex_embeddings/embedding_handler.py
+++ b/litellm/llms/vertex_ai_and_google_ai_studio/vertex_embeddings/embedding_handler.py
@@ -78,15 +78,18 @@ class VertexAITextEmbeddingConfig(BaseModel):
}
def get_supported_openai_params(self):
- return ["dimensions", "input_type"]
+ return ["dimensions"]
- def map_openai_params(self, non_default_params: dict, optional_params: dict):
+ def map_openai_params(
+ self, non_default_params: dict, optional_params: dict, kwargs: dict
+ ):
for param, value in non_default_params.items():
if param == "dimensions":
optional_params["output_dimensionality"] = value
- if param == "input_type":
- optional_params["task_type"] = value
- return optional_params
+
+ if "input_type" in kwargs:
+ optional_params["task_type"] = kwargs.pop("input_type")
+ return optional_params, kwargs
def get_mapped_special_auth_params(self) -> dict:
"""
diff --git a/litellm/utils.py b/litellm/utils.py
index c5739fcc45e..ec4ac79c0f6 100644
--- a/litellm/utils.py
+++ b/litellm/utils.py
@@ -2621,8 +2621,11 @@ def get_optional_params_embeddings(
request_type="embeddings",
)
_check_valid_arg(supported_params=supported_params)
- optional_params = litellm.VertexAITextEmbeddingConfig().map_openai_params(
- non_default_params=non_default_params, optional_params={}
+ (
+ optional_params,
+ kwargs,
+ ) = litellm.VertexAITextEmbeddingConfig().map_openai_params(
+ non_default_params=non_default_params, optional_params={}, kwargs=kwargs
)
final_params = {**optional_params, **kwargs}
return final_params