From c53c4e10aad816e1caaa51a5e4f19a894322577c Mon Sep 17 00:00:00 2001 From: Jason Baker Date: Thu, 2 Jan 2025 05:24:48 -0600 Subject: [PATCH] GCP VertexAI: handle case when google.auth.default() uses a service account (#579) Co-authored-by: Jason Baker --- pydantic_ai_slim/pydantic_ai/models/vertexai.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydantic_ai_slim/pydantic_ai/models/vertexai.py b/pydantic_ai_slim/pydantic_ai/models/vertexai.py index 6bac0aa1..794a82de 100644 --- a/pydantic_ai_slim/pydantic_ai/models/vertexai.py +++ b/pydantic_ai_slim/pydantic_ai/models/vertexai.py @@ -178,7 +178,7 @@ def _creds_from_file(service_account_file: str | Path) -> ServiceAccountCredenti # pyright: reportUnknownVariableType=false # pyright: reportUnknownArgumentType=false async def _async_google_auth() -> tuple[BaseCredentials, str | None]: - return await run_in_executor(google.auth.default) + return await run_in_executor(google.auth.default, scopes=['https://www.googleapis.com/auth/cloud-platform']) # default expiry is 3600 seconds