From 3ff803788c5b1158e266ea608f1cedbaf638c388 Mon Sep 17 00:00:00 2001 From: Onur ULUSOY Date: Sat, 21 Dec 2024 11:25:58 +0300 Subject: [PATCH] feat: Add no_tools parameter to get_agent_executor and update screenshot_ function to use it --- gpt_computer_assistant/agent/agent.py | 4 +++- gpt_computer_assistant/display_tools.py | 13 ++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/gpt_computer_assistant/agent/agent.py b/gpt_computer_assistant/agent/agent.py index 63e5cf987..c9a99f1fc 100644 --- a/gpt_computer_assistant/agent/agent.py +++ b/gpt_computer_assistant/agent/agent.py @@ -51,7 +51,7 @@ def get_prompt(name): return prompt -def get_agent_executor(the_anthropic_model=False): +def get_agent_executor(the_anthropic_model=False, no_tools=False): tools = get_tools() tools += custom_tools() @@ -81,6 +81,8 @@ def get_agent_executor(the_anthropic_model=False): + if no_tools: + tools = [] if ( diff --git a/gpt_computer_assistant/display_tools.py b/gpt_computer_assistant/display_tools.py index 8edafbccb..c37e8b5e4 100644 --- a/gpt_computer_assistant/display_tools.py +++ b/gpt_computer_assistant/display_tools.py @@ -207,20 +207,15 @@ def screenshot_(checking:str): - human_second_message = None - - if screenshot_path: - - - human_second_message = { + human_second_message = { "type": "image_url", "image_url": {"url": f"data:image/png;base64,{the_base64}"}, } - if human_second_message: - the_message.append(human_second_message) + + the_message.append(human_second_message) @@ -234,7 +229,7 @@ def screenshot_(checking:str): - msg = get_agent_executor().invoke( + msg = get_agent_executor(no_tools=True).invoke( {"messages": [the_message]} )