Skip to content

Commit 08609fb

Browse files
committed
Move key creation to top of file to fix openai
1 parent 468e2bd commit 08609fb

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

operate/main.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
DEBUG = False
3131

3232
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
33+
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
34+
35+
client = OpenAI()
36+
client.api_key = OPENAI_API_KEY
37+
client.base_url = os.getenv("OPENAI_API_BASE_URL", client.base_url)
38+
3339

3440
monitor_size = {
3541
"width": 1920,
@@ -210,12 +216,6 @@ def main(model, accurate_mode, terminal_prompt, voice_mode=False):
210216
"""
211217
Main function for the Self-Operating Computer
212218
"""
213-
if model == "gpt-4-vision-preview":
214-
client = OpenAI()
215-
client.api_key = OPENAI_API_KEY
216-
client.base_url = os.getenv("OPENAI_API_BASE_URL", client.base_url)
217-
elif model == "gemini-pro-vision":
218-
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
219219
mic = None
220220
# Initialize WhisperMic if voice_mode is True if voice_mode is True
221221

@@ -551,7 +551,6 @@ def get_next_action_from_gemini_pro_vision(messages, objective, accurate_mode):
551551
"""
552552
Get the next action for Self-Operating Computer using Gemini Pro Vision
553553
"""
554-
print("[get_next_action_from_gemini_pro_vision] ")
555554
print("[get_next_action_from_gemini_pro_vision] messages", messages)
556555
# sleep for a second
557556
time.sleep(1)

0 commit comments

Comments
 (0)