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]

fix vtx linting

Ishaan Jaffc89fad06e0b1
diff --git a/litellm/llms/vertex_ai/vertex_llm_base.py b/litellm/llms/vertex_ai/vertex_llm_base.py
index f50a1d236e5..ae43e1fd167 100644
--- a/litellm/llms/vertex_ai/vertex_llm_base.py
+++ b/litellm/llms/vertex_ai/vertex_llm_base.py
@@ -36,7 +36,7 @@ class VertexBase:
self._credentials: Optional[GoogleCredentialsObject] = None
self._credentials_project_mapping: Dict[
Tuple[Optional[VERTEX_CREDENTIALS_TYPES], Optional[str]],
- GoogleCredentialsObject,
+ Tuple[GoogleCredentialsObject, str],
] = {}
self.project_id: Optional[str] = None
self.async_handler: Optional[AsyncHTTPHandler] = None
@@ -464,6 +464,10 @@ class VertexBase:
credential_project_id,
)
+ # Check if credentials are None before accessing attributes
+ if _credentials is None:
+ raise ValueError("Credentials are None after loading")
+
if _credentials.expired:
verbose_logger.debug(
f"Credentials expired, refreshing for project_id: {project_id}"