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
TestVertexAIRerankTransform
Ishaan Jaffer736b6b3e1ec9
diff --git a/tests/test_litellm/llms/vertex_ai/rerank/test_vertex_ai_rerank_transformation.py b/tests/test_litellm/llms/vertex_ai/rerank/test_vertex_ai_rerank_transformation.pyindex 66375eef7b3..d5e1e8b8c1c 100644--- a/tests/test_litellm/llms/vertex_ai/rerank/test_vertex_ai_rerank_transformation.py+++ b/tests/test_litellm/llms/vertex_ai/rerank/test_vertex_ai_rerank_transformation.py@@ -18,8 +18,12 @@ class TestVertexAIRerankTransform:self.config = VertexAIRerankConfig()self.model = "semantic-ranker-default@latest"- def test_get_complete_url(self):+ @patch('litellm.llms.vertex_ai.rerank.transformation.VertexAIRerankConfig._ensure_access_token')+ def test_get_complete_url(self, mock_ensure_access_token):"""Test URL generation for Vertex AI Discovery Engine rerank API."""+ # Mock _ensure_access_token to return (token, project_id)+ mock_ensure_access_token.return_value = ("mock-token", None)+# Test with project ID from environmentwith patch.dict(os.environ, {"VERTEXAI_PROJECT": "test-project-123"}):url = self.config.get_complete_url(api_base=None, model=self.model)@@ -29,6 +33,7 @@ class TestVertexAIRerankTransform:# Test with litellm.vertex_projectwith patch.dict(os.environ, {}, clear=True):import litellm+# Set vertex_project attribute if it doesn't existif not hasattr(litellm, 'vertex_project'):litellm.vertex_project = None@@ -44,6 +49,7 @@ class TestVertexAIRerankTransform:# Test error when no project ID is availablewith patch.dict(os.environ, {}, clear=True):import litellm+# Set vertex_project to None to ensure no project ID is availableif not hasattr(litellm, 'vertex_project'):litellm.vertex_project = None