diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..05986577 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,2 @@ +[run] +relative_files = true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/1.bug.yml b/.github/ISSUE_TEMPLATE/1.bug.yml index 6645142e..9c82c63f 100644 --- a/.github/ISSUE_TEMPLATE/1.bug.yml +++ b/.github/ISSUE_TEMPLATE/1.bug.yml @@ -57,6 +57,20 @@ body: - Other (Please specify in your problem) validations: required: true + - type: dropdown + attributes: + label: Which version of Auto-GPT are you using? + description: | + Please select which version of Auto-GPT you were using when this issue occurred. + If you downloaded the code from the [releases page](https://github.com/Significant-Gravitas/Auto-GPT/releases/) make sure you were using the latest code. + **If you weren't please try with the [latest code](https://github.com/Significant-Gravitas/Auto-GPT/releases/)**. + If installed with git you can run `git branch` to see which version of Auto-GPT you are running. + options: + - Latest Release + - Stable (branch) + - Master (branch) + validations: + required: true - type: dropdown attributes: label: GPT-3 or GPT-4? diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b37e7f00..e6cb82c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,14 @@ jobs: if: success() || failure() test: + permissions: + # Gives the action the necessary permissions for publishing new + # comments in pull requests. + pull-requests: write + # Gives the action the necessary permissions for pushing data to the + # python-coverage-comment-action branch, and for editing existing + # comments (to avoid publishing multiple comments in the same PR) + contents: write runs-on: ubuntu-latest strategy: matrix: @@ -63,10 +71,25 @@ jobs: - name: Run unittest tests with coverage run: | - pytest --cov=autogpt --without-integration --without-slow-integration + pytest --cov=autogpt --without-integration --without-slow-integration --cov-report term-missing --cov-branch --cov-report xml --cov-report term - name: Generate coverage report run: | coverage report coverage xml if: success() || failure() + + - name: Coverage comment + id: coverage_comment + uses: py-cov-action/python-coverage-comment-action@v3 + with: + GITHUB_TOKEN: ${{ github.token }} + + - name: Store Pull Request comment to be posted + uses: actions/upload-artifact@v3 + if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' + with: + # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly + name: python-coverage-comment-action + # If you use a different name, update COMMENT_FILENAME accordingly + path: python-coverage-comment-action.txt diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..5dc9b7bd --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,36 @@ +# .github/workflows/coverage.yml +name: Post coverage comment + +on: + workflow_run: + workflows: ["Python CI"] + types: + - completed + +jobs: + test: + name: Run tests & display coverage + runs-on: ubuntu-latest + if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' + permissions: + # Gives the action the necessary permissions for publishing new + # comments in pull requests. + pull-requests: write + # Gives the action the necessary permissions for editing existing + # comments (to avoid publishing multiple comments in the same PR) + contents: write + # Gives the action the necessary permissions for looking up the + # workflow that launched this workflow, and download the related + # artifact that contains the comment to be published + actions: read + steps: + # DO NOT run actions/checkout here, for security reasons + # For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ + - name: Post comment + uses: py-cov-action/python-coverage-comment-action@v3 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }} + # Update those if you changed the default values: + # COMMENT_ARTIFACT_NAME: python-coverage-comment-action + # COMMENT_FILENAME: python-coverage-comment-action.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3722b25e..a2ea6114 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v0.9.2 + rev: v4.4.0 hooks: - id: check-added-large-files args: ['--maxkb=500'] diff --git a/README.md b/README.md index 743584e5..341bd567 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,8 @@ Demo made by Blake Werlinger
-If you can spare a coffee, you can help to cover the costs of developing Auto-GPT and help push the boundaries of fully autonomous AI! -Your support is greatly appreciated -Development of this free, open-source project is made possible by all the contributors and sponsors. If you'd like to sponsor this project and have your avatar or company logo appear below click here. +If you can spare a coffee, you can help to cover the costs of developing Auto-GPT and help to push the boundaries of fully autonomous AI! +Your support is greatly appreciated. Development of this free, open-source project is made possible by all the contributors and sponsors. If you'd like to sponsor this project and have your avatar or company logo appear below click here.
@@ -52,7 +51,7 @@ 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!** +#### **PLEASE ENSURE YOU HAVE DONE THIS STEP BEFORE PROCEEDING. OTHERWISE, NOTHING WILL WORK!** ## 💾 Installation To install Auto-GPT, follow these steps: -1. Make sure you have all the **requirements** listed above, if not, install/get them +1. Make sure you have all the **requirements** listed above. If not, install/get them. _To execute the following commands, open a CMD, Bash, or Powershell window by navigating to a folder on your computer and typing `CMD` in the folder path at the top, then press enter._ -2. Clone the repository: For this step, you need Git installed. Alternatively, - you can download the [latest stable release](https://github.com/Significant-Gravitas/Auto-GPT/releases/latest) (`Source code (zip)`, bottom of the page). +2. Clone the repository: For this step, you need Git installed. +Note: If you don't have Git, you can just download the [latest stable release](https://github.com/Significant-Gravitas/Auto-GPT/releases/latest) instead (`Source code (zip)`, at the bottom of the page). ```bash git clone -b stable https://github.com/Significant-Gravitas/Auto-GPT.git ``` -3. Navigate to the directory where the repository was downloaded +3. Navigate to the directory where you downloaded the repository. ```bash cd Auto-GPT ``` -4. Install the required dependencies +4. Install the required dependencies. ```bash pip install -r requirements.txt ``` -5. Configure Auto-GPT - 1. Locate the file named `.env.template` in the main `/Auto-GPT` folder. - 2. Create a copy of this file, called `.env` by removing the `template` extension. The easiest way is to do this in a command prompt/terminal window `cp .env.template .env`. - 3. Open the `.env` file in a text editor. _Note: Files starting with a dot might be hidden by your Operating System._ +5. Configure Auto-GPT: + 1. Find the file named `.env.template` in the main /Auto-GPT folder. This file may be hidden by default in some operating systems due to the dot prefix. To reveal hidden files, follow the instructions for your specific operating system (e.g., in Windows, click on the "View" tab in File Explorer and check the "Hidden items" box; in macOS, press Cmd + Shift + .). + 2. Create a copy of this file and call it `.env` by removing the `template` extension. The easiest way is to do this in a command prompt/terminal window `cp .env.template .env`. + 3. Open the `.env` file in a text editor. 4. Find the line that says `OPENAI_API_KEY=`. 5. After the `"="`, enter your unique OpenAI API Key (without any quotes or spaces). - 6. Enter any other API keys or Tokens for services you would like to utilize. + 6. Enter any other API keys or Tokens for services you would like to use. 7. Save and close the `.env` file. - By completing these steps, you have properly configured the API Keys for your project. + After you complete these steps, you'll have properly configured the API keys for your project. - - See [OpenAI API Keys Configuration](#openai-api-keys-configuration) to obtain your OpenAI API key. - - Obtain your ElevenLabs API key from: https://elevenlabs.io. You can view your xi-api-key using the "Profile" tab on the website. + Notes: + - See [OpenAI API Keys Configuration](#openai-api-keys-configuration) to get your OpenAI API key. + - Get your ElevenLabs API key from: https://elevenlabs.io. You can view your xi-api-key using the "Profile" tab on the website. - If you want to use GPT on an Azure instance, set `USE_AZURE` to `True` and then follow these steps: - Rename `azure.yaml.template` to `azure.yaml` and provide the relevant `azure_api_base`, `azure_api_version` and all the deployment IDs for the relevant models in the `azure_model_map` section: - `fast_llm_model_deployment_id` - your gpt-3.5-turbo or gpt-4 deployment ID @@ -141,21 +144,23 @@ _To execute the following commands, open a CMD, Bash, or Powershell window by na ## 🔧 Usage -1. Run `autogpt` Python module in your terminal. +1. Run the `autogpt` Python module in your terminal. +* On Linux/MacOS: ```bash - # On Linux of Mac: ./run.sh - - # On Windows: + ``` +* On Windows: + ```bash .\run.bat ``` Running with `--help` after `.\run.bat` lists all the possible command line arguments you can pass. -2. After each action, choose from options to authorize command(s), +2. After each response from Auto-GPT, choose from the options to authorize command(s), exit the program, or provide feedback to the AI. - 1. Authorize a single command, enter `y` - 2. Authorize a series of _N_ continuous commands, enter `y -N` - 3. Exit the program, enter `n` + 1. Authorize a single command by entering `y` + 2. Authorize a series of _N_ continuous commands by entering `y -N`. For example, entering `y -10` would run 10 automatic iterations. + 3. Enter any free text to give feedback to Auto-GPT. + 4. Exit the program by entering `n` ### Logs @@ -174,7 +179,7 @@ You can also build this into a docker image and run it: ```bash docker build -t autogpt . -docker run -it --env-file=./.env -v $PWD/auto_gpt_workspace:/app/auto_gpt_workspace autogpt +docker run -it --env-file=./.env -v $PWD/auto_gpt_workspace:/home/appuser/auto_gpt_workspace autogpt ``` Or if you have `docker-compose`: @@ -184,7 +189,7 @@ docker-compose run --build --rm auto-gpt You can pass extra arguments, for instance, running with `--gpt3only` and `--continuous` mode: ```bash -docker run -it --env-file=./.env -v $PWD/auto_gpt_workspace:/app/auto_gpt_workspace autogpt --gpt3only --continuous +docker run -it --env-file=./.env -v $PWD/auto_gpt_workspace:/home/appuser/auto_gpt_workspace autogpt --gpt3only --continuous ``` ```bash docker-compose run --build --rm auto-gpt --gpt3only --continuous @@ -211,13 +216,13 @@ Here are some common arguments you can use when running Auto-GPT: ## 🗣️ Speech Mode -Use this to use TTS _(Text-to-Speech)_ for Auto-GPT +Enter this command to use TTS _(Text-to-Speech)_ for Auto-GPT ```bash python -m autogpt --speak ``` -### List of IDs with names from eleven labs, you can use the name or ID: +### List of IDs with names from eleven labs. You can use the name or ID: - Rachel : 21m00Tcm4TlvDq8ikWAM - Domi : AZnzlk1XvdvUeBnXmlld @@ -231,19 +236,36 @@ python -m autogpt --speak ## 🔍 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. +Note: +This section is optional. use the official google api if you are having issues with error 429 when running a google search. To use the `google_official_search` command, you need to set up your Google API keys in your environment variables. +Create your project: 1. Go to the [Google Cloud Console](https://console.cloud.google.com/). 2. If you don't already have an account, create one and log in. -3. Create a new project by clicking on the "Select a Project" dropdown at the top of the page and clicking "New Project". Give it a name and click "Create". -4. Go to the [APIs & Services Dashboard](https://console.cloud.google.com/apis/dashboard) and click "Enable APIs and Services". Search for "Custom Search API" and click on it, then click "Enable". -5. Go to the [Credentials](https://console.cloud.google.com/apis/credentials) page and click "Create Credentials". Choose "API Key". -6. Copy the API key and set it as an environment variable named `GOOGLE_API_KEY` on your machine. See setting up environment variables below. -7. [Enable](https://console.developers.google.com/apis/api/customsearch.googleapis.com) the Custom Search API on your project. (Might need to wait few minutes to propagate) -8. Go to the [Custom Search Engine](https://cse.google.com/cse/all) page and click "Add". -9. Set up your search engine by following the prompts. You can choose to search the entire web or specific sites. -10. Once you've created your search engine, click on "Control Panel" and then "Basics". Copy the "Search engine ID" and set it as an environment variable named `CUSTOM_SEARCH_ENGINE_ID` on your machine. See setting up environment variables below. +3. Create a new project by clicking on the "Select a Project" dropdown at the top of the page and clicking "New Project". +4. Give it a name and click "Create". + +Set up a custom search API and add to your .env file: +5. Go to the [APIs & Services Dashboard](https://console.cloud.google.com/apis/dashboard). +6. Click "Enable APIs and Services". +7. Search for "Custom Search API" and click on it. +8. Click "Enable". +9. Go to the [Credentials](https://console.cloud.google.com/apis/credentials) page. +10. Click "Create Credentials". +11. Choose "API Key". +12. Copy the API key. +13. Set it as an environment variable named `GOOGLE_API_KEY` on your machine (see how to set up environment variables below). +14. [Enable](https://console.developers.google.com/apis/api/customsearch.googleapis.com) the Custom Search API on your project. (Might need to wait few minutes to propagate) + +Set up a custom serach engine and add to your .env file: +15. Go to the [Custom Search Engine](https://cse.google.com/cse/all) page. +16. Click "Add". +17. Set up your search engine by following the prompts. You can choose to search the entire web or specific sites. +18. Once you've created your search engine, click on "Control Panel". +19. Click "Basics". +20. Copy the "Search engine ID". +21. Set it as an environment variable named `CUSTOM_SEARCH_ENGINE_ID` on your machine (see how to set up environment variables below). _Remember that your free daily custom search quota allows only up to 100 searches. To increase this limit, you need to assign a billing account to the project to profit from up to 10K daily searches._ @@ -265,19 +287,38 @@ export CUSTOM_SEARCH_ENGINE_ID="YOUR_CUSTOM_SEARCH_ENGINE_ID" ## Plugins -See https://github.com/Significant-Gravitas/Auto-GPT-Plugin-Template for the template of the plugins. +Use the [Auto-GPT Plugin Template](https://github.com/Significant-Gravitas/Auto-GPT-Plugin-Template) as a starting point for creating your own plugins. -⚠️💀 WARNING 💀⚠️: Review the code of any plugin you use, this allows for any Python to be executed and do malicious things. Like stealing your API keys. +⚠️💀 **WARNING** 💀⚠️: Review the code of any plugin you use thoroughly, as plugins can execute any Python code, potentially leading to malicious activities, such as stealing your API keys. -Drop the repo's zipfile in the plugins folder. +### Plugin Installation Steps - +1. **Clone or download the plugin repository:** + Clone the plugin repository, or download the repository as a zip file. + +  -If you add the plugins class name to the `ALLOWLISTED_PLUGINS` in the `.env` you will not be prompted otherwise you'll be warned before loading the plugin: +2. **Install the plugin's dependencies (if any):** + Navigate to the plugin's folder in your terminal, and run the following command to install any required dependencies: -``` -ALLOWLISTED_PLUGINS=example-plugin1,example-plugin2,example-plugin3 -``` + ```bash + pip install -r requirements.txt + ``` + +3. **Package the plugin as a Zip file:** + If you cloned the repository, compress the plugin folder as a Zip file. + +4. **Copy the plugin's Zip file:** + Place the plugin's Zip file in the `plugins` folder of the Auto-GPT repository. + +5. **Allowlist the plugin (optional):** + Add the plugin's class name to the `ALLOWLISTED_PLUGINS` in the `.env` file to avoid being prompted with a warning when loading the plugin: + + ``` + ALLOWLISTED_PLUGINS=example-plugin1,example-plugin2,example-plugin3 + ``` + + If the plugin is not allowlisted, you will be warned before it's loaded. ## Setting Your Cache Type @@ -296,13 +337,13 @@ To switch to either, change the `MEMORY_BACKEND` env variable to the value that ### Redis Setup > _**CAUTION**_ \ This is not intended to be publicly accessible and lacks security measures. Therefore, avoid exposing Redis to the internet without a password or at all -1. Install docker (or Docker Desktop on Windows) -2. Launch Redis container +1. Install docker (or Docker Desktop on Windows). +2. Launch Redis container. ```bash docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest ``` > See https://hub.docker.com/r/redis/redis-stack-server for setting a password and additional configuration. -3. Set the following settings in `.env` +3. Set the following settings in `.env`. > Replace **PASSWORD** in angled brackets (<>) ```bash MEMORY_BACKEND=redis @@ -320,7 +361,7 @@ MEMORY_INDEX=