From 8cbe438ad5c24e4c8fde34fc4c7d4f52abf0f5ab Mon Sep 17 00:00:00 2001 From: "roby.parapat" Date: Sun, 16 Apr 2023 06:33:43 +0700 Subject: [PATCH 01/28] move comment to correct position --- autogpt/commands/execute_code.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autogpt/commands/execute_code.py b/autogpt/commands/execute_code.py index 86d6c177b79..f174b7bca15 100644 --- a/autogpt/commands/execute_code.py +++ b/autogpt/commands/execute_code.py @@ -41,6 +41,9 @@ def execute_python_file(file: str): try: client = docker.from_env() + # You can replace 'python:3.8' with the desired Python image/version + # You can find available Python images on Docker Hub: + # https://hub.docker.com/_/python image_name = "python:3.10" try: client.images.get(image_name) @@ -58,9 +61,6 @@ def execute_python_file(file: str): elif status: print(status) - # You can replace 'python:3.8' with the desired Python image/version - # You can find available Python images on Docker Hub: - # https://hub.docker.com/_/python container = client.containers.run( image_name, f"python {file}", From 7b7d7c1d74b299966e607cf7dc6cf2cea64993ba Mon Sep 17 00:00:00 2001 From: Bates Jernigan Date: Sun, 16 Apr 2023 16:33:52 -0400 Subject: [PATCH 02/28] add space on warning message --- autogpt/memory/local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogpt/memory/local.py b/autogpt/memory/local.py index 6c7ee1b36a2..9b911eeff9f 100644 --- a/autogpt/memory/local.py +++ b/autogpt/memory/local.py @@ -54,7 +54,7 @@ def __init__(self, cfg) -> None: self.data = CacheContent() else: print( - f"Warning: The file '{self.filename}' does not exist." + f"Warning: The file '{self.filename}' does not exist. " "Local memory would not be saved to a file." ) self.data = CacheContent() From 4269326ddfd81227e78b0745093f52e4ac1ba078 Mon Sep 17 00:00:00 2001 From: 0xf333 <0x333@tuta.io> Date: Sun, 16 Apr 2023 17:03:18 -0400 Subject: [PATCH 03/28] Fix: Update run_continuous.sh to pass all command-line arguments Description: - Modified `run_continuous.sh` to include the `--continuous` flag directly in the command: - Removed the unused `argument` variable. - Added the `--continuous` flag to the `./run.sh` command. - Ensured all command-line arguments are passed through to `run.sh` and the `autogpt` module. This change improves the usability of the `run_continuous.sh` script by allowing users to provide additional command-line arguments along with the `--continuous` flag. It ensures that all arguments are properly passed to the `run.sh` script and eventually to the `autogpt` module, preventing confusion and providing more flexible usage. Suggestion from: https://github.com/Significant-Gravitas/Auto-GPT/pull/1941#discussion_r1167977442 --- run_continuous.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run_continuous.sh b/run_continuous.sh index 14c9cfd2ab4..43034f8e747 100755 --- a/run_continuous.sh +++ b/run_continuous.sh @@ -1,3 +1,3 @@ #!/bin/bash -argument="--continuous" -./run.sh "$argument" + +./run.sh --continuous "$@" From 5ff7fc340b908281c6eb976358947e87f289c0f7 Mon Sep 17 00:00:00 2001 From: endolith Date: Sun, 16 Apr 2023 08:47:11 -0400 Subject: [PATCH 04/28] Remove extraneous noqa E722 comment E722 is "Do not use bare except, specify exception instead" but except json.JSONDecodeError is not a bare except --- autogpt/json_fixes/auto_fix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogpt/json_fixes/auto_fix.py b/autogpt/json_fixes/auto_fix.py index 9fcf909a49a..0d3bd73ce1a 100644 --- a/autogpt/json_fixes/auto_fix.py +++ b/autogpt/json_fixes/auto_fix.py @@ -45,7 +45,7 @@ def fix_json(json_string: str, schema: str) -> str: try: json.loads(result_string) # just check the validity return result_string - except json.JSONDecodeError: # noqa: E722 + except json.JSONDecodeError: # Get the call stack: # import traceback # call_stack = traceback.format_exc() From 4eb8e7823d63ff4f8d67b8927da842ea7ab3ab21 Mon Sep 17 00:00:00 2001 From: 0xf333 <0x333@tuta.io> Date: Sun, 16 Apr 2023 18:07:41 -0400 Subject: [PATCH 05/28] Fix: Remove quotes around $@ in run_continuous.sh Description: Per maintainer's request, removed quotes around `$@` in `run_continuous.sh`. This change allows the script to forward arguments as is. Please note that this modification might cause issues if any of the command-line arguments contain spaces or special characters. However, this update aligns with the preferred format for the repository. Suggestion from: https://github.com/Significant-Gravitas/Auto-GPT/pull/1941#discussion_r1168035557 --- run_continuous.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_continuous.sh b/run_continuous.sh index 43034f8e747..1f4436c8850 100755 --- a/run_continuous.sh +++ b/run_continuous.sh @@ -1,3 +1,3 @@ #!/bin/bash -./run.sh --continuous "$@" +./run.sh --continuous $@ From 1d4dc0c534cc7ef585f760f9eaf7293134bba282 Mon Sep 17 00:00:00 2001 From: "xuqi.wxq" Date: Mon, 17 Apr 2023 10:17:26 +0800 Subject: [PATCH 06/28] Fix milvus test Error: 'NameError: name 'MockConfig' is not defined' --- tests/milvus_memory_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/milvus_memory_test.py b/tests/milvus_memory_test.py index e0e2f7fc805..84fd6e6d500 100644 --- a/tests/milvus_memory_test.py +++ b/tests/milvus_memory_test.py @@ -26,7 +26,7 @@ class TestMilvusMemory(unittest.TestCase): def setUp(self) -> None: """Set up the test environment""" - self.cfg = MockConfig() + self.cfg = mock_config() self.memory = MilvusMemory(self.cfg) def test_add(self) -> None: From 0fa807394711010a17fe37a3afbce81978e233e2 Mon Sep 17 00:00:00 2001 From: Ben Song Date: Mon, 17 Apr 2023 11:53:05 +0800 Subject: [PATCH 07/28] add docker requirements - jsonschema --- requirements-docker.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements-docker.txt b/requirements-docker.txt index 3a8a344cad2..a6018f8f9f4 100644 --- a/requirements-docker.txt +++ b/requirements-docker.txt @@ -24,4 +24,5 @@ pre-commit black isort gitpython==3.1.31 -tweepy \ No newline at end of file +tweepy +jsonschema \ No newline at end of file From 64383776a24864f32f69e4f56214089940623664 Mon Sep 17 00:00:00 2001 From: "Gabriel R. Barbosa" <12158575+gabrielrbarbosa@users.noreply.github.com> Date: Mon, 17 Apr 2023 03:04:35 -0300 Subject: [PATCH 08/28] Update brian.py - Prevent TypeError exception TypeError: BrianSpeech._speech() takes 2 positional arguments but 3 were given. Use the same arguments as used in _speech method from gtts.py --- autogpt/speech/brian.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogpt/speech/brian.py b/autogpt/speech/brian.py index e581bbcc8d5..b9298f55aa7 100644 --- a/autogpt/speech/brian.py +++ b/autogpt/speech/brian.py @@ -13,7 +13,7 @@ def _setup(self) -> None: """Setup the voices, API key, etc.""" pass - def _speech(self, text: str) -> bool: + def _speech(self, text: str, _: int = 0) -> bool: """Speak text using Brian with the streamelements API Args: From 60b779a9059dbd274b336a27f9a6b6db0bde53fd Mon Sep 17 00:00:00 2001 From: Alastair D'Silva Date: Mon, 17 Apr 2023 17:09:13 +1000 Subject: [PATCH 09/28] Remove requirements-docker.txt This file needs to be maintained parallel to requirements.txt, but isn't, causes problems when new dependencies are introduced. Instead, derive the Docker dependencies from the stock ones. Signed-off-by: Alastair D'Silva --- Dockerfile | 5 +++-- requirements-docker.txt | 28 ---------------------------- requirements.txt | 2 ++ 3 files changed, 5 insertions(+), 30 deletions(-) delete mode 100644 requirements-docker.txt diff --git a/Dockerfile b/Dockerfile index 9886d74266f..5219e7d1149 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,8 +17,9 @@ RUN chown appuser:appuser /home/appuser USER appuser # Copy the requirements.txt file and install the requirements -COPY --chown=appuser:appuser requirements-docker.txt . -RUN pip install --no-cache-dir --user -r requirements-docker.txt +COPY --chown=appuser:appuser requirements.txt . +RUN sed -i '/Items below this point will not be included in the Docker Image/,$d' requirements.txt && \ + pip install --no-cache-dir --user -r requirements.txt # Copy the application files COPY --chown=appuser:appuser autogpt/ ./autogpt diff --git a/requirements-docker.txt b/requirements-docker.txt deleted file mode 100644 index a6018f8f9f4..00000000000 --- a/requirements-docker.txt +++ /dev/null @@ -1,28 +0,0 @@ -beautifulsoup4 -colorama==0.4.6 -openai==0.27.2 -playsound==1.2.2 -python-dotenv==1.0.0 -pyyaml==6.0 -readability-lxml==0.8.1 -requests -tiktoken==0.3.3 -gTTS==2.3.1 -docker -duckduckgo-search -google-api-python-client #(https://developers.google.com/custom-search/v1/overview) -pinecone-client==2.2.1 -redis -orjson -Pillow -selenium -webdriver-manager -coverage -flake8 -numpy -pre-commit -black -isort -gitpython==3.1.31 -tweepy -jsonschema \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 843b66bfe45..3f1eee5b7da 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,6 +30,8 @@ sourcery isort gitpython==3.1.31 +# Items below this point will not be included in the Docker Image + # Testing dependencies pytest asynctest From 2b87245e2231e5d13022df1c9f5cc07584e254d6 Mon Sep 17 00:00:00 2001 From: XFFXFF <1247714429@qq.com> Date: Mon, 17 Apr 2023 16:21:52 +0800 Subject: [PATCH 10/28] fix a missing import --- autogpt/memory/local.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autogpt/memory/local.py b/autogpt/memory/local.py index 9b911eeff9f..803b6dc6ebb 100644 --- a/autogpt/memory/local.py +++ b/autogpt/memory/local.py @@ -2,13 +2,13 @@ import dataclasses import os -from typing import Any +from typing import Any, List import numpy as np import orjson -from autogpt.memory.base import MemoryProviderSingleton from autogpt.llm_utils import create_embedding_with_ada +from autogpt.memory.base import MemoryProviderSingleton EMBED_DIM = 1536 SAVE_OPTIONS = orjson.OPT_SERIALIZE_NUMPY | orjson.OPT_SERIALIZE_DATACLASS From bd25822b35ab924290f28b104e519b49b8930591 Mon Sep 17 00:00:00 2001 From: Mad Misaghi Date: Mon, 17 Apr 2023 12:24:27 +0330 Subject: [PATCH 11/28] Update .env.template addedMilvus --- .env.template | 1 + 1 file changed, 1 insertion(+) diff --git a/.env.template b/.env.template index eeff2907cb2..9593276f2f7 100644 --- a/.env.template +++ b/.env.template @@ -54,6 +54,7 @@ SMART_TOKEN_LIMIT=8000 # local - Default # pinecone - Pinecone (if configured) # redis - Redis (if configured) +# milvus - Milvus (if configured) MEMORY_BACKEND=local ### PINECONE From 74a8b5d83256c5b9116a375a4520d2727e52bece Mon Sep 17 00:00:00 2001 From: suzuken Date: Mon, 17 Apr 2023 18:15:49 +0900 Subject: [PATCH 12/28] config.py: update OpenAI link --- autogpt/config/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogpt/config/config.py b/autogpt/config/config.py index fe6f4f32585..a950453e8a0 100644 --- a/autogpt/config/config.py +++ b/autogpt/config/config.py @@ -237,5 +237,5 @@ def check_openai_api_key() -> None: Fore.RED + "Please set your OpenAI API key in .env or as an environment variable." ) - print("You can get your key from https://beta.openai.com/account/api-keys") + print("You can get your key from https://platform.openai.com/account/api-keys") exit(1) From 125f0ba61ad57188e6f4f109f2463f31530044dd Mon Sep 17 00:00:00 2001 From: Bob van Luijt Date: Mon, 17 Apr 2023 12:46:27 +0200 Subject: [PATCH 13/28] Update README.md with Weaviate installation and reference --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 71957748f06..b919f51d313 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ Development of this free, open-source project is made possible by all the =3.15.4"`. +#### Install the Weaviate client + +Install the Weaviate client before usage. + +``` +$ pip install weaviate-client +``` + #### Setting up environment variables In your `.env` file set the following: From 10cd0f3362ad6c86eefe7fc2a1f276ca49af98fe Mon Sep 17 00:00:00 2001 From: Eesa Hamza Date: Mon, 17 Apr 2023 07:32:40 +0300 Subject: [PATCH 14/28] Add the OpenAI API Keys Configuration to the top of the readme --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 71957748f06..dbb44f52a10 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,18 @@ Development of this free, open-source project is made possible by all the Billing](./docs/imgs/openai-api-key-billing-paid-account.png) + +#### **PLEASE ENSURE YOU HAVE DONE THIS STEP BEFORE PROCEEDING, OTHERWISE NOTHING WILL WORK!** + ## 💾 Installation To install Auto-GPT, follow these steps: @@ -207,18 +219,6 @@ python -m autogpt --speak - Adam : pNInz6obpgDQGcFmaJgB - Sam : yoZ06aMxZJJ28mfd3POQ - -## OpenAI API Keys Configuration - -Obtain your OpenAI API key from: https://platform.openai.com/account/api-keys. - -To use OpenAI API key for Auto-GPT, you NEED to have billing set up (AKA paid account). - -You can set up paid account at https://platform.openai.com/account/billing/overview. - -![For OpenAI API key to work, set up paid account at OpenAI API > Billing](./docs/imgs/openai-api-key-billing-paid-account.png) - - ## 🔍 Google API Keys Configuration This section is optional, use the official google api if you are having issues with error 429 when running a google search. From d47466ddf949d72787d3a04db3959b5a579a702d Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Wed, 12 Apr 2023 15:48:46 -0300 Subject: [PATCH 15/28] Add Nix flakes support through direnv * Nix (https://nixos.org) is a reproducible build system. * Enables Nix users to use/develop Auto-GPT, without installing PIP or any other future Auto-GPT dependency. --- .envrc | 4 ++++ .gitignore | 1 + 2 files changed, 5 insertions(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 00000000000..a7ad726377a --- /dev/null +++ b/.envrc @@ -0,0 +1,4 @@ +# Upon entering directory, direnv requests user permission once to automatically load project dependencies onwards. +# Eliminating the need of running "nix develop github:superherointj/nix-auto-gpt" for Nix users to develop/use Auto-GPT. + +[[ -z $IN_NIX_SHELL ]] && use flake github:superherointj/nix-auto-gpt diff --git a/.gitignore b/.gitignore index 2220ef6e3a9..26d7e5a3f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -127,6 +127,7 @@ celerybeat.pid *.sage.py # Environments +.direnv/ .env .venv env/ From d4860fe9f09dba4bc8d9311b9a575098e3809ddc Mon Sep 17 00:00:00 2001 From: lfricken <6675120+lfricken@users.noreply.github.com> Date: Mon, 17 Apr 2023 10:27:53 -0500 Subject: [PATCH 16/28] Don't incapacitate yourself! (#1240) * subprocesses * fix lint * fix more lint * fix merge * fix merge again --- autogpt/app.py | 15 ++++++++++++++- autogpt/commands/execute_code.py | 30 ++++++++++++++++++++++++++++++ autogpt/prompt.py | 11 +++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/autogpt/app.py b/autogpt/app.py index 19c075f0b09..6f51fd98fba 100644 --- a/autogpt/app.py +++ b/autogpt/app.py @@ -10,7 +10,11 @@ from autogpt.commands.image_gen import generate_image from autogpt.commands.audio_text import read_audio_from_file from autogpt.commands.web_requests import scrape_links, scrape_text -from autogpt.commands.execute_code import execute_python_file, execute_shell +from autogpt.commands.execute_code import ( + execute_python_file, + execute_shell, + execute_shell_popen, +) from autogpt.commands.file_operations import ( append_to_file, delete_file, @@ -191,6 +195,15 @@ def execute_command(command_name: str, arguments): " shell commands, EXECUTE_LOCAL_COMMANDS must be set to 'True' " "in your config. Do not attempt to bypass the restriction." ) + elif command_name == "execute_shell_popen": + if CFG.execute_local_commands: + return execute_shell_popen(arguments["command_line"]) + else: + return ( + "You are not allowed to run local shell commands. To execute" + " shell commands, EXECUTE_LOCAL_COMMANDS must be set to 'True' " + "in your config. Do not attempt to bypass the restriction." + ) elif command_name == "read_audio_from_file": return read_audio_from_file(arguments["file"]) elif command_name == "generate_image": diff --git a/autogpt/commands/execute_code.py b/autogpt/commands/execute_code.py index 2cc797cbbaf..e2a8d994aaf 100644 --- a/autogpt/commands/execute_code.py +++ b/autogpt/commands/execute_code.py @@ -114,6 +114,36 @@ def execute_shell(command_line: str) -> str: return output +def execute_shell_popen(command_line): + """Execute a shell command with Popen and returns an english description + of the event and the process id + + Args: + command_line (str): The command line to execute + + Returns: + str: Description of the fact that the process started and its id + """ + current_dir = os.getcwd() + + if WORKING_DIRECTORY not in current_dir: # Change dir into workspace if necessary + work_dir = os.path.join(os.getcwd(), WORKING_DIRECTORY) + os.chdir(work_dir) + + print(f"Executing command '{command_line}' in working directory '{os.getcwd()}'") + + do_not_show_output = subprocess.DEVNULL + process = subprocess.Popen( + command_line, shell=True, stdout=do_not_show_output, stderr=do_not_show_output + ) + + # Change back to whatever the prior working dir was + + os.chdir(current_dir) + + return f"Subprocess started with PID:'{str(process.pid)}'" + + def we_are_running_in_a_docker_container() -> bool: """Check if we are running in a Docker container diff --git a/autogpt/prompt.py b/autogpt/prompt.py index a2b20b1fefb..33098af035a 100644 --- a/autogpt/prompt.py +++ b/autogpt/prompt.py @@ -38,6 +38,9 @@ def get_prompt() -> str: prompt_generator.add_constraint( 'Exclusively use the commands listed in double quotes e.g. "command name"' ) + prompt_generator.add_constraint( + "Use subprocesses for commands that will not terminate within a few minutes" + ) # Define the command list commands = [ @@ -81,6 +84,7 @@ def get_prompt() -> str: {"code": "", "focus": ""}, ), ("Execute Python File", "execute_python_file", {"file": ""}), + ("Task Complete (Shutdown)", "task_complete", {"reason": ""}), ("Generate Image", "generate_image", {"prompt": ""}), ("Send Tweet", "send_tweet", {"text": ""}), ] @@ -104,6 +108,13 @@ def get_prompt() -> str: {"command_line": ""}, ), ) + commands.append( + ( + "Execute Shell Command Popen, non-interactive commands only", + "execute_shell_popen", + {"command_line": ""} + ), + ) # Only add the download file command if the AI is allowed to execute it if cfg.allow_downloads: From 35106ef662fda42b299de5e525ef31ae4bac39e7 Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Mon, 17 Apr 2023 17:33:50 +0200 Subject: [PATCH 17/28] feat(pr-labels): auto-label conflicting PRs --- .github/workflows/pr-label.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/pr-label.yml diff --git a/.github/workflows/pr-label.yml b/.github/workflows/pr-label.yml new file mode 100644 index 00000000000..9f5127e497c --- /dev/null +++ b/.github/workflows/pr-label.yml @@ -0,0 +1,22 @@ +name: "Pull Request auto-label" +on: + # So that PRs touching the same files as the push are updated + push: + # So that the `dirtyLabel` is removed if conflicts are resolve + # We recommend `pull_request_target` so that github secrets are available. + # In `pull_request` we wouldn't be able to change labels of fork PRs + pull_request_target: + types: [opened, synchronize] + +jobs: + conflicts: + runs-on: ubuntu-latest + steps: + - name: Update PRs with conflict labels + uses: eps1lon/actions-label-merge-conflict@releases/2.x + with: + dirtyLabel: "conflicts" + #removeOnDirtyLabel: "PR: ready to ship" + repoToken: "${{ secrets.GITHUB_TOKEN }}" + commentOnDirty: "This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request." + commentOnClean: "Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly." From baf31e69e53e51ae0d93976f17c74c4f2a6ed895 Mon Sep 17 00:00:00 2001 From: rickythefox Date: Mon, 17 Apr 2023 17:45:23 +0200 Subject: [PATCH 18/28] Use python:3-alpine image for code execution (#1192) --- autogpt/commands/execute_code.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autogpt/commands/execute_code.py b/autogpt/commands/execute_code.py index e2a8d994aaf..70b33a975cd 100644 --- a/autogpt/commands/execute_code.py +++ b/autogpt/commands/execute_code.py @@ -40,10 +40,10 @@ def execute_python_file(file: str): try: client = docker.from_env() - # You can replace 'python:3.8' with the desired Python image/version + # You can replace this with the desired Python image/version # You can find available Python images on Docker Hub: # https://hub.docker.com/_/python - image_name = "python:3.10" + image_name = "python:3-alpine" try: client.images.get(image_name) print(f"Image '{image_name}' found locally") From e7c3ff9b9edd07c18ecf3cff572694105de722b3 Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Mon, 17 Apr 2023 17:47:58 +0200 Subject: [PATCH 19/28] fix(pr-label): set job permissions explicitly --- .github/workflows/pr-label.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr-label.yml b/.github/workflows/pr-label.yml index 9f5127e497c..63696e42d0f 100644 --- a/.github/workflows/pr-label.yml +++ b/.github/workflows/pr-label.yml @@ -11,6 +11,9 @@ on: jobs: conflicts: runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - name: Update PRs with conflict labels uses: eps1lon/actions-label-merge-conflict@releases/2.x From a2a6f84f139b683fd135df89ff370ad5f6a7b974 Mon Sep 17 00:00:00 2001 From: REal0day Date: Sun, 16 Apr 2023 15:14:54 -0500 Subject: [PATCH 20/28] internal resource request bug --- autogpt/commands/web_requests.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/autogpt/commands/web_requests.py b/autogpt/commands/web_requests.py index 50d8d383cb1..70ada90741d 100644 --- a/autogpt/commands/web_requests.py +++ b/autogpt/commands/web_requests.py @@ -58,9 +58,28 @@ def check_local_file_access(url: str) -> bool: """ local_prefixes = [ "file:///", + "file://localhost/", "file://localhost", "http://localhost", + "http://localhost/", "https://localhost", + "https://localhost/", + "http://2130706433", + "http://2130706433/", + "https://2130706433", + "https://2130706433/", + "http://127.0.0.1/", + "http://127.0.0.1", + "https://127.0.0.1/", + "https://127.0.0.1", + "https://0.0.0.0/", + "https://0.0.0.0", + "http://0.0.0.0/", + "http://0.0.0.0", + "http://0000", + "http://0000/", + "https://0000", + "https://0000/" ] return any(url.startswith(prefix) for prefix in local_prefixes) From 23e703132653cc33a11dceee557c4f880059347e Mon Sep 17 00:00:00 2001 From: jimmycliff obonyo Date: Sun, 16 Apr 2023 00:37:50 +0300 Subject: [PATCH 21/28] install chrome/firefox for headless browing when running in docker container --- Dockerfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Dockerfile b/Dockerfile index 9886d74266f..039ccf26a93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,16 @@ FROM python:3.11-slim RUN apt-get -y update RUN apt-get -y install git chromium-driver +# Install Xvfb and other dependencies for headless browser testing +RUN apt-get update \ + && apt-get install -y wget gnupg2 libgtk-3-0 libdbus-glib-1-2 dbus-x11 xvfb ca-certificates + +# Install Firefox / Chromium +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ + && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \ + && apt-get update \ + && apt-get install -y chromium firefox-esr + # Set environment variables ENV PIP_NO_CACHE_DIR=yes \ PYTHONUNBUFFERED=1 \ From 6b64158356a02d9bfd410913b157ccd31ce5ea03 Mon Sep 17 00:00:00 2001 From: Tom Kaitchuck Date: Sun, 16 Apr 2023 01:53:24 -0700 Subject: [PATCH 22/28] Unbound summary size Signed-off-by: Tom Kaitchuck --- .env.template | 2 -- autogpt/config/config.py | 5 ----- autogpt/processing/text.py | 2 -- 3 files changed, 9 deletions(-) diff --git a/.env.template b/.env.template index eeff2907cb2..209a29b963b 100644 --- a/.env.template +++ b/.env.template @@ -5,8 +5,6 @@ EXECUTE_LOCAL_COMMANDS=False # BROWSE_CHUNK_MAX_LENGTH - When browsing website, define the length of chunk stored in memory BROWSE_CHUNK_MAX_LENGTH=8192 -# BROWSE_SUMMARY_MAX_TOKEN - Define the maximum length of the summary generated by GPT agent when browsing website -BROWSE_SUMMARY_MAX_TOKEN=300 # USER_AGENT - Define the user-agent used by the requests library to browse website (string) # USER_AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" # AI_SETTINGS_FILE - Specifies which AI Settings file to use (defaults to ai_settings.yaml) diff --git a/autogpt/config/config.py b/autogpt/config/config.py index fe6f4f32585..a8b48b4929d 100644 --- a/autogpt/config/config.py +++ b/autogpt/config/config.py @@ -33,7 +33,6 @@ def __init__(self) -> None: self.fast_token_limit = int(os.getenv("FAST_TOKEN_LIMIT", 4000)) self.smart_token_limit = int(os.getenv("SMART_TOKEN_LIMIT", 8000)) self.browse_chunk_max_length = int(os.getenv("BROWSE_CHUNK_MAX_LENGTH", 8192)) - self.browse_summary_max_token = int(os.getenv("BROWSE_SUMMARY_MAX_TOKEN", 300)) self.openai_api_key = os.getenv("OPENAI_API_KEY") self.temperature = float(os.getenv("TEMPERATURE", "1")) @@ -188,10 +187,6 @@ def set_browse_chunk_max_length(self, value: int) -> None: """Set the browse_website command chunk max length value.""" self.browse_chunk_max_length = value - def set_browse_summary_max_token(self, value: int) -> None: - """Set the browse_website command summary max token value.""" - self.browse_summary_max_token = value - def set_openai_api_key(self, value: str) -> None: """Set the OpenAI API key value.""" self.openai_api_key = value diff --git a/autogpt/processing/text.py b/autogpt/processing/text.py index d30036d8789..657b0b0eb43 100644 --- a/autogpt/processing/text.py +++ b/autogpt/processing/text.py @@ -78,7 +78,6 @@ def summarize_text( summary = create_chat_completion( model=CFG.fast_llm_model, messages=messages, - max_tokens=CFG.browse_summary_max_token, ) summaries.append(summary) print(f"Added chunk {i + 1} summary to memory") @@ -95,7 +94,6 @@ def summarize_text( return create_chat_completion( model=CFG.fast_llm_model, messages=messages, - max_tokens=CFG.browse_summary_max_token, ) From def96ffe2f5b42ed41fc7fc1844965a0344cf9fc Mon Sep 17 00:00:00 2001 From: Steve Byerly Date: Mon, 17 Apr 2023 02:06:46 +0000 Subject: [PATCH 23/28] fix split file --- autogpt/commands/file_operations.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/autogpt/commands/file_operations.py b/autogpt/commands/file_operations.py index d273c1a34dd..00ae466dbcf 100644 --- a/autogpt/commands/file_operations.py +++ b/autogpt/commands/file_operations.py @@ -49,14 +49,12 @@ def log_operation(operation: str, filename: str) -> None: append_to_file(LOG_FILE, log_entry, shouldLog = False) - def split_file( content: str, max_length: int = 4000, overlap: int = 0 ) -> Generator[str, None, None]: """ Split text into chunks of a specified maximum length with a specified overlap between chunks. - :param content: The input text to be split into chunks :param max_length: The maximum length of each chunk, default is 4000 (about 1k token) @@ -70,9 +68,14 @@ def split_file( while start < content_length: end = start + max_length if end + overlap < content_length: - chunk = content[start : end + overlap] + chunk = content[start : end + overlap - 1] else: chunk = content[start:content_length] + + # Account for the case where the last chunk is shorter than the overlap, so it has already been consumed + if len(chunk) <= overlap: + break + yield chunk start += max_length - overlap From bd670b4db379776f034c5d956379fa8f1a698425 Mon Sep 17 00:00:00 2001 From: Steve Byerly Date: Mon, 17 Apr 2023 02:24:14 +0000 Subject: [PATCH 24/28] whitespace --- autogpt/commands/file_operations.py | 1 + 1 file changed, 1 insertion(+) diff --git a/autogpt/commands/file_operations.py b/autogpt/commands/file_operations.py index 00ae466dbcf..073b13b0ee9 100644 --- a/autogpt/commands/file_operations.py +++ b/autogpt/commands/file_operations.py @@ -49,6 +49,7 @@ def log_operation(operation: str, filename: str) -> None: append_to_file(LOG_FILE, log_entry, shouldLog = False) + def split_file( content: str, max_length: int = 4000, overlap: int = 0 ) -> Generator[str, None, None]: From 6ac9ce614acda4a0103962ef89b0d23c0a3d26aa Mon Sep 17 00:00:00 2001 From: Steve Byerly Date: Mon, 17 Apr 2023 02:29:51 +0000 Subject: [PATCH 25/28] whitespace --- autogpt/commands/file_operations.py | 1 + 1 file changed, 1 insertion(+) diff --git a/autogpt/commands/file_operations.py b/autogpt/commands/file_operations.py index 073b13b0ee9..3420bd842bb 100644 --- a/autogpt/commands/file_operations.py +++ b/autogpt/commands/file_operations.py @@ -56,6 +56,7 @@ def split_file( """ Split text into chunks of a specified maximum length with a specified overlap between chunks. + :param content: The input text to be split into chunks :param max_length: The maximum length of each chunk, default is 4000 (about 1k token) From 8637b8b61ba18f74e88bee822222b166f17e7773 Mon Sep 17 00:00:00 2001 From: Steve Byerly Date: Mon, 17 Apr 2023 02:30:24 +0000 Subject: [PATCH 26/28] whitespace --- autogpt/commands/file_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogpt/commands/file_operations.py b/autogpt/commands/file_operations.py index 3420bd842bb..9dcf819480c 100644 --- a/autogpt/commands/file_operations.py +++ b/autogpt/commands/file_operations.py @@ -56,7 +56,7 @@ def split_file( """ Split text into chunks of a specified maximum length with a specified overlap between chunks. - + :param content: The input text to be split into chunks :param max_length: The maximum length of each chunk, default is 4000 (about 1k token) From f2baa0872beb13cf5dfb13f0ab05a64640510d3f Mon Sep 17 00:00:00 2001 From: jingxing Date: Mon, 17 Apr 2023 14:24:10 +0800 Subject: [PATCH 27/28] config.py format --- autogpt/config/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogpt/config/config.py b/autogpt/config/config.py index a8b48b4929d..e3ccc6a1906 100644 --- a/autogpt/config/config.py +++ b/autogpt/config/config.py @@ -66,7 +66,7 @@ def __init__(self) -> None: self.pinecone_api_key = os.getenv("PINECONE_API_KEY") self.pinecone_region = os.getenv("PINECONE_ENV") - self.weaviate_host = os.getenv("WEAVIATE_HOST") + self.weaviate_host = os.getenv("WEAVIATE_HOST") self.weaviate_port = os.getenv("WEAVIATE_PORT") self.weaviate_protocol = os.getenv("WEAVIATE_PROTOCOL", "http") self.weaviate_username = os.getenv("WEAVIATE_USERNAME", None) From ef7b417105da16a8a2fc89eea0309a42fdd8d7b2 Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Mon, 17 Apr 2023 18:11:34 +0200 Subject: [PATCH 28/28] fix(pr-label): mitigate excessive concurrent runs --- .github/workflows/pr-label.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr-label.yml b/.github/workflows/pr-label.yml index 63696e42d0f..a91141315a4 100644 --- a/.github/workflows/pr-label.yml +++ b/.github/workflows/pr-label.yml @@ -7,6 +7,9 @@ on: # In `pull_request` we wouldn't be able to change labels of fork PRs pull_request_target: types: [opened, synchronize] +concurrency: + group: ${{ github.event_name == 'pull_request_target' && format('pr-label-{0}', github.event.pull_request.number) || '' }} + cancel-in-progress: ${{ github.event_name == 'pull_request_target' || '' }} jobs: conflicts: