From 0cb9050c9ee9542bedab736ee1d8306328549011 Mon Sep 17 00:00:00 2001 From: Benyamin Date: Mon, 11 Mar 2024 16:59:25 +0330 Subject: [PATCH 1/4] add new instruction --- prompts/examples/github_issue.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 prompts/examples/github_issue.yaml diff --git a/prompts/examples/github_issue.yaml b/prompts/examples/github_issue.yaml new file mode 100644 index 0000000..ce2d98f --- /dev/null +++ b/prompts/examples/github_issue.yaml @@ -0,0 +1,18 @@ +instructions: +- BEGIN_FUNCTION open_github_issue +- Go to Google.com +- Find all textareas. +- Find the first visible textarea. +- Click on the first visible textarea. +- Type in "netbox github" and press enter. +- Wait 2 seconds. +- Find all anchor elements that link to GitHub. +- Click on the first one. +- Wait 2 seconds. +- Click on the anchor element with id 'issues-tab'. +- Wait 2 seconds. +- Click on the closed issues to filter them. +- Wait 2 seconds. +- END_FUNCTION +- RUN_FUNCTION open_github_issue +- Wait for 10 seconds. \ No newline at end of file From 641cbdb45c7e178b24062b55a7ddcec6e4af5529 Mon Sep 17 00:00:00 2001 From: Benyamin Date: Mon, 11 Mar 2024 17:03:39 +0330 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=A8=20consider=20gpt=20model=20for?= =?UTF-8?q?=20response=20as=20well?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples.py b/examples.py index a64b45a..cdd9dad 100644 --- a/examples.py +++ b/examples.py @@ -1,7 +1,6 @@ import click from browserpilot.agents.gpt_selenium_agent import GPTSeleniumAgent -# from browserpilot.agents.goal_agent import GoalAgent # Set up multiple command CLI. @@ -24,6 +23,7 @@ def selenium(instructions, chromedriver_path, model, memory_folder, debug, outpu chromedriver_path, instruction_output_file=output, model_for_instructions=model, + model_for_responses=model, memory_folder=memory_folder, debug=debug, retry=True, From 799a69fd3d95f3ff4da789128306e6e5b5d9317a Mon Sep 17 00:00:00 2001 From: Benyamin Date: Wed, 13 Mar 2024 10:39:23 +0330 Subject: [PATCH 3/4] =?UTF-8?q?=E2=9C=A8=20gpt-4-turbo=20compatibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agents/compilers/instruction_compiler.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/browserpilot/agents/compilers/instruction_compiler.py b/browserpilot/agents/compilers/instruction_compiler.py index a7c8dfb..f9f31c0 100644 --- a/browserpilot/agents/compilers/instruction_compiler.py +++ b/browserpilot/agents/compilers/instruction_compiler.py @@ -6,6 +6,7 @@ import logging import traceback import os +import re from typing import Dict, List, Union @@ -297,7 +298,6 @@ def get_completion( frequency_penalty=0, presence_penalty=0, temperature=temperature, - stop=stop, ) text = response.choices[0].message.content else: @@ -326,6 +326,9 @@ def get_completion( except Exception: traceback.print_exc() + # Extract python code + text = self._extract_python_code(text) + # Add to cache. self.api_cache[prompt] = text @@ -406,6 +409,15 @@ def save_compiled_instructions(self, filename): elif filename.endswith(".yaml"): yaml.dump(to_dump, f) + def _extract_python_code(self, input_string: str) -> str: + pattern = r'```python\n(.*?)```' + match = re.search(pattern, input_string, re.DOTALL) + + if match: + return match.group(1) + else: + return input_string + if __name__ == "__main__": import pprint From 2c3f28932516d0efa79f3dc3e61a5696515e9875 Mon Sep 17 00:00:00 2001 From: Benyamin Date: Wed, 13 Mar 2024 16:46:13 +0330 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=94=A8=20Update=20GitHub=20link=20in?= =?UTF-8?q?=20prompt=20example?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prompts/examples/github_issue.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prompts/examples/github_issue.yaml b/prompts/examples/github_issue.yaml index ce2d98f..f379092 100644 --- a/prompts/examples/github_issue.yaml +++ b/prompts/examples/github_issue.yaml @@ -6,7 +6,7 @@ instructions: - Click on the first visible textarea. - Type in "netbox github" and press enter. - Wait 2 seconds. -- Find all anchor elements that link to GitHub. +- Find all anchor elements that link to GitHub.com. - Click on the first one. - Wait 2 seconds. - Click on the anchor element with id 'issues-tab'.