Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Modify API key retrieval method

ddupont5e94349bb0a4
diff --git a/libs/python/agent/agent/loops/gemini.py b/libs/python/agent/agent/loops/gemini.py
index 518c0ee994..567dfc8ccb 100644
--- a/libs/python/agent/agent/loops/gemini.py
+++ b/libs/python/agent/agent/loops/gemini.py
@@ -630,7 +630,7 @@ class GeminiComputerUseConfig(AsyncAgentConfig):
# Authentication follows two modes based on environment variables:
# 1. Google AI Studio: Set GOOGLE_API_KEY
# 2. Vertex AI: Set GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION, GOOGLE_GENAI_USE_VERTEXAI=True
- api_key = os.getenv("GOOGLE_API_KEY")
+ api_key = kwargs.get("api_key", os.getenv("GOOGLE_API_KEY"))
if api_key:
client = genai.Client(api_key=api_key)
@@ -847,7 +847,7 @@ class GeminiComputerUseConfig(AsyncAgentConfig):
import os
# Authentication: GOOGLE_API_KEY for AI Studio, or Vertex AI env vars
- api_key = os.getenv("GOOGLE_API_KEY")
+ api_key = kwargs.get("api_key", os.getenv("GOOGLE_API_KEY"))
if api_key:
client = genai.Client(api_key=api_key)
else: