Skip to content

Commit

Permalink
Fix initialize_openai issue
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbickett committed Jan 19, 2024
1 parent 9ba17f4 commit 4c61db4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions operate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ def validation(self, model, voice_mode):

def require_api_key(self, key_name, key_description, is_required):
key_exists = bool(os.environ.get(key_name))
if self.verbose:
print("[Config] require_api_key")
print("[Config] key_name", key_name)
print("[Config] key_description", key_description)
print("[Config] key_exists", key_exists)
if is_required and not key_exists:
self.prompt_and_save_api_key(key_name, key_description)

Expand Down
3 changes: 2 additions & 1 deletion operate/models/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
# Load configuration
VERBOSE = Config().verbose
config = Config()
client = config.initialize_openai()


async def get_next_action(model, messages, objective, session_id):
Expand All @@ -60,6 +59,7 @@ def call_gpt_4_vision_preview(messages):
if VERBOSE:
print("[Self Operating Computer][get_next_action][call_gpt_4_v]")
time.sleep(1)
client = config.initialize_openai()
try:
screenshots_dir = "screenshots"
if not os.path.exists(screenshots_dir):
Expand Down Expand Up @@ -190,6 +190,7 @@ def call_gemini_pro_vision(messages, objective):

async def call_gpt_4_vision_preview_labeled(messages, objective):
time.sleep(1)
client = config.initialize_openai()
try:
yolo_model = YOLO("./operate/models/weights/best.pt") # Load your trained model
screenshots_dir = "screenshots"
Expand Down

0 comments on commit 4c61db4

Please sign in to comment.