From fda78615fa6a1203f4ea70abbac5aba0eb404354 Mon Sep 17 00:00:00 2001 From: Carmen Iniesta Date: Tue, 14 Jul 2026 09:49:33 +0200 Subject: [PATCH] fix for google credentials --- agents/google/src/hyperforge_google/driver.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/agents/google/src/hyperforge_google/driver.py b/agents/google/src/hyperforge_google/driver.py index 8bb1307..fdfb48a 100644 --- a/agents/google/src/hyperforge_google/driver.py +++ b/agents/google/src/hyperforge_google/driver.py @@ -1,4 +1,7 @@ +import json + from google.genai import Client +from google.oauth2 import service_account from hyperforge.configure import driver from hyperforge.driver import Driver from typing_extensions import Self @@ -17,11 +20,15 @@ class GoogleDriver(Driver): @classmethod async def init(cls, driver: GoogleDriverConfig) -> Self: + creds = None if driver.config.vertexai: - from google.auth import load_credentials_from_file - - creds, _ = load_credentials_from_file(driver.config.credentials) + if driver.config.credentials: + info = json.loads(driver.config.credentials) + creds = service_account.Credentials.from_service_account_info( + info, + scopes=["https://www.googleapis.com/auth/cloud-platform"], + ) client = Client( vertexai=driver.config.vertexai, credentials=creds,