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
refactor(vertex_ai): remove constant-False is_using_v1beta1_features stub and its dead call sites
mateo6a76ca0c7265
diff --git a/litellm/llms/vertex_ai/count_tokens/handler.py b/litellm/llms/vertex_ai/count_tokens/handler.pyindex 1fc0ff9a031..47a08ff054d 100644--- a/litellm/llms/vertex_ai/count_tokens/handler.py+++ b/litellm/llms/vertex_ai/count_tokens/handler.py@@ -20,7 +20,6 @@ class VertexAITokenCounter(GoogleAIStudioTokenCounter, VertexBase):vertex_credentials: Final = self.get_vertex_ai_credentials(litellm_params=litellm_params)vertex_project = self.get_vertex_ai_project(litellm_params=litellm_params)vertex_location: Final = self.get_vertex_ai_location(litellm_params=litellm_params)- should_use_v1beta1_features: Final = self.is_using_v1beta1_features(litellm_params)_auth_header, vertex_project = await self._ensure_access_token_async(credentials=vertex_credentials,project_id=vertex_project,@@ -37,7 +36,6 @@ class VertexAITokenCounter(GoogleAIStudioTokenCounter, VertexBase):stream=False,custom_llm_provider="vertex_ai",api_base=None,- should_use_v1beta1_features=should_use_v1beta1_features,mode="count_tokens",)headers = {diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.pyindex 36b5f2fb5e8..e8b316b5902 100644--- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py+++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py@@ -2701,8 +2701,6 @@ class VertexLLM(VertexBase):gemini_api_key: str | None = None,extra_headers: dict | None = None,) -> CustomStreamWrapper:- should_use_v1beta1_features: Final = self.is_using_v1beta1_features(optional_params=optional_params)-_auth_header, vertex_project = await self._ensure_access_token_async(credentials=vertex_credentials,project_id=vertex_project,@@ -2722,7 +2720,6 @@ class VertexLLM(VertexBase):stream=stream,custom_llm_provider=custom_llm_provider,api_base=api_base,- should_use_v1beta1_features=should_use_v1beta1_features,use_psc_endpoint_format=use_psc_endpoint_format,)@@ -2797,8 +2794,6 @@ class VertexLLM(VertexBase):gemini_api_key: str | None = None,extra_headers: dict | None = None,) -> ModelResponse | CustomStreamWrapper:- should_use_v1beta1_features: Final = self.is_using_v1beta1_features(optional_params=optional_params)-_auth_header, vertex_project = await self._ensure_access_token_async(credentials=vertex_credentials,project_id=vertex_project,@@ -2818,7 +2813,6 @@ class VertexLLM(VertexBase):stream=stream,custom_llm_provider=custom_llm_provider,api_base=api_base,- should_use_v1beta1_features=should_use_v1beta1_features,use_psc_endpoint_format=use_psc_endpoint_format,)@@ -2981,8 +2975,6 @@ class VertexLLM(VertexBase):extra_headers=extra_headers,)- should_use_v1beta1_features: Final = self.is_using_v1beta1_features(optional_params=optional_params)-_auth_header, vertex_project = self._ensure_access_token(credentials=vertex_credentials,project_id=vertex_project,@@ -3002,7 +2994,6 @@ class VertexLLM(VertexBase):stream=stream,custom_llm_provider=custom_llm_provider,api_base=api_base,- should_use_v1beta1_features=should_use_v1beta1_features,use_psc_endpoint_format=use_psc_endpoint_format,)headers: Final = VertexGeminiConfig().validate_environment(diff --git a/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py b/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.pyindex 81961d6ef8b..15378839b33 100644--- a/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py+++ b/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py@@ -65,8 +65,6 @@ class VertexEmbedding(VertexBase):litellm_params=litellm_params,)- should_use_v1beta1_features: Final = self.is_using_v1beta1_features(optional_params=optional_params)-_auth_header, vertex_project = self._ensure_access_token(credentials=vertex_credentials,project_id=vertex_project,@@ -85,7 +83,6 @@ class VertexEmbedding(VertexBase):stream=False,custom_llm_provider=custom_llm_provider,api_base=api_base,- should_use_v1beta1_features=should_use_v1beta1_features,mode="embedding",use_psc_endpoint_format=use_psc_endpoint_format,)@@ -160,7 +157,6 @@ class VertexEmbedding(VertexBase):"""Async embedding implementation"""- should_use_v1beta1_features: Final = self.is_using_v1beta1_features(optional_params=optional_params)_auth_header, vertex_project = await self._ensure_access_token_async(credentials=vertex_credentials,project_id=vertex_project,@@ -179,7 +175,6 @@ class VertexEmbedding(VertexBase):stream=False,custom_llm_provider=custom_llm_provider,api_base=api_base,- should_use_v1beta1_features=should_use_v1beta1_features,mode="embedding",use_psc_endpoint_format=use_psc_endpoint_format,)diff --git a/litellm/llms/vertex_ai/vertex_llm_base.py b/litellm/llms/vertex_ai/vertex_llm_base.pyindex 1942bc850f1..8b7f8c63625 100644--- a/litellm/llms/vertex_ai/vertex_llm_base.py+++ b/litellm/llms/vertex_ai/vertex_llm_base.py@@ -618,15 +618,6 @@ class VertexBase:project_id=project_id,)- def is_using_v1beta1_features(self, optional_params: dict) -> bool:- """- use this helper to decide if request should be sent to v1 or v1beta1-- Returns true if any beta feature is enabled- Returns false in all other cases- """- return False-def _check_custom_proxy(self,api_base: str | None,diff --git a/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.pyindex c206fcec420..7d2dfbb962e 100644--- a/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py+++ b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py@@ -1150,10 +1150,6 @@ def test_get_token_url():vertex_ai_location = "us-central1"vertex_credentials = ""- should_use_v1beta1_features = vertex_llm.is_using_v1beta1_features(- optional_params={"cached_content": "hi"}- )-_, url = vertex_llm._get_token_and_url(auth_header=None,vertex_project=vertex_ai_project,@@ -1161,7 +1157,7 @@ def test_get_token_url():vertex_credentials=vertex_credentials,gemini_api_key="",custom_llm_provider="vertex_ai_beta",- should_use_v1beta1_features=should_use_v1beta1_features,+ should_use_v1beta1_features=False,api_base=None,model="",stream=False,@@ -1169,10 +1165,6 @@ def test_get_token_url():print("url=", url)- should_use_v1beta1_features = vertex_llm.is_using_v1beta1_features(- optional_params={"temperature": 0.1}- )-_, url = vertex_llm._get_token_and_url(auth_header=None,vertex_project=vertex_ai_project,@@ -1180,7 +1172,7 @@ def test_get_token_url():vertex_credentials=vertex_credentials,gemini_api_key="",custom_llm_provider="vertex_ai_beta",- should_use_v1beta1_features=should_use_v1beta1_features,+ should_use_v1beta1_features=False,api_base=None,model="",stream=False,