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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Add embedding pcs support
Sameer Kankute64c001255d9e
diff --git a/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py b/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.pyindex aaa6a0bb95f..8a03738ad78 100644--- a/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py+++ b/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py@@ -72,6 +72,9 @@ class VertexEmbedding(VertexBase):project_id=vertex_project,custom_llm_provider=custom_llm_provider,)+ # Extract use_psc_endpoint_format from optional_params+ use_psc_endpoint_format = optional_params.get("use_psc_endpoint_format", False)+auth_header, api_base = self._get_token_and_url(model=model,gemini_api_key=gemini_api_key,@@ -84,6 +87,7 @@ class VertexEmbedding(VertexBase):api_base=api_base,should_use_v1beta1_features=should_use_v1beta1_features,mode="embedding",+ use_psc_endpoint_format=use_psc_endpoint_format,)headers = self.set_headers(auth_header=auth_header, extra_headers=extra_headers)vertex_request: VertexEmbeddingRequest = (@@ -164,6 +168,9 @@ class VertexEmbedding(VertexBase):project_id=vertex_project,custom_llm_provider=custom_llm_provider,)+ # Extract use_psc_endpoint_format from optional_params+ use_psc_endpoint_format = optional_params.get("use_psc_endpoint_format", False)+auth_header, api_base = self._get_token_and_url(model=model,gemini_api_key=gemini_api_key,@@ -176,6 +183,7 @@ class VertexEmbedding(VertexBase):api_base=api_base,should_use_v1beta1_features=should_use_v1beta1_features,mode="embedding",+ use_psc_endpoint_format=use_psc_endpoint_format,)headers = self.set_headers(auth_header=auth_header, extra_headers=extra_headers)vertex_request: VertexEmbeddingRequest = (diff --git a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.pyindex 156ab95184a..4a06e9ea1aa 100644--- a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py+++ b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py@@ -214,7 +214,8 @@ def test_vertex_ai_bge_psc_endpoint_url_construction():api_base="http://10.128.16.2",vertex_project="gen-lang-client-0682925754",vertex_location="us-central1",- client=client+ client=client,+ use_psc_endpoint_format=True # Enable PSC endpoint format for this test)mock_post.assert_called_once()