Skip to content

Commit 3dbb329

Browse files
committed
Remove vertex config vars from python template setup
refactor(loop): simplify Gemini client initialization in sampling loop - Removed environment variable dependencies from the Gemini client initialization in the `sampling_loop` function, streamlining the setup process. - The client is now instantiated solely with the API key, enhancing clarity and reducing complexity in the code.
1 parent 4265d3e commit 3dbb329

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

  • pkg/templates/python/gemini-computer-use

pkg/templates/python/gemini-computer-use/loop.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Based on Google's computer-use-preview reference implementation.
44
"""
55

6-
import os
76
from datetime import datetime
87
from typing import Any, Dict, List
98

@@ -64,12 +63,7 @@ async def sampling_loop(
6463
Dict with 'final_response', 'iterations', and 'error'
6564
"""
6665
# Initialize the Gemini client
67-
client = genai.Client(
68-
api_key=api_key,
69-
vertexai=os.environ.get("USE_VERTEXAI", "0").lower() in ["true", "1"],
70-
project=os.environ.get("VERTEXAI_PROJECT"),
71-
location=os.environ.get("VERTEXAI_LOCATION"),
72-
)
66+
client = genai.Client(api_key=api_key)
7367

7468
computer_tool = ComputerTool(kernel, session_id)
7569

0 commit comments

Comments
 (0)