Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions agents/google/src/hyperforge_google/driver.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand Down
Loading