Merge pull request #41665 from BerriAI/litellm_remove_dead_vertex_v1beta1_stub

refactor(vertex_ai): remove constant-False is_using_v1beta1_features stub and its dead call sites
This commit is contained in:
Mateo Wang 2026-09-17 17:56:22 -07:00 • committed by GitHub
commit 706f69af50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 2 additions and 35 deletions

View file

@ -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 = {

View file

@ -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(

View file

@ -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,
)

View file

@ -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,

View file

@ -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,