--- emoji: πŸ€– colorFrom: blue colorTo: indigo sdk: streamlit python_version: 3.9 sdk_version: 1.0.0 app_file: main.py app_port: 7860 fullWidth: false models: - openai/gpt-3 datasets: - wikitext tags: - gpt - nlp - text-generation pinned: true --- > This information takes precedence over any other information provided and should be followed accordingly. Our workflow has been improved, but please note that `master` branch may often be in a **broken** state. Please download the latest `stable` release from here: https://github.com/Torantulino/Auto-GPT/releases/latest. ![GitHub Repo stars](https://img.shields.io/github/stars/Torantulino/auto-gpt?style=social) [![Twitter Follow](https://img.shields.io/twitter/follow/siggravitas?style=social)](https://twitter.com/SigGravitas) [![Discord Follow](https://dcbadge.vercel.app/api/server/autogpt?style=flat)](https://discord.gg/autogpt) [![Unit Tests](https://github.com/Torantulino/Auto-GPT/actions/workflows/ci.yml/badge.svg)](https://github.com/Torantulino/Auto-GPT/actions/workflows/ci.yml) Auto-GPT is an experimental open-source application showcasing the capabilities of the GPT-4 language model. This program, driven by GPT-4, chains together LLM "thoughts", to autonomously achieve whatever goal you set. As one of the first examples of GPT-4 running fully autonomously, Auto-GPT pushes the boundaries of what is possible with AI. ### Demo (30/03/2023): https://user-images.githubusercontent.com/22963551/228855501-2f5777cf-755b-4407-a643-c7299e5b6419.mp4

πŸ’– Help Fund Auto-GPT's Development πŸ’–

If you can spare a coffee, you can help to cover the API costs of developing Auto-GPT and help push the boundaries of fully autonomous AI! A full day of development can easily cost as much as $20 in API costs, which for a free project is quite limiting. 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.

Individual Sponsors

robinicus  prompthero  crizzler  tob-le-rone  FSTatSBS  toverly1  ddtarazona  Nalhos  Kazamario  pingbotan  indoor47  AuroraHolding  kreativai  hunteraraujo  Explorergt92  judegomila   thepok   SpacingLily  merwanehamadi  m  zkonduit  maxxflyer  tekelsey  digisomni  nocodeclarity  tjarmain

## Table of Contents - [Auto-GPT: An Autonomous GPT-4 Experiment](#auto-gpt-an-autonomous-gpt-4-experiment) - [πŸ”΄ πŸ”΄ πŸ”΄ Urgent: USE `stable` not `master` πŸ”΄ πŸ”΄ πŸ”΄](#----urgent-use-stable-not-master----) - [Demo (30/03/2023):](#demo-30032023) - [Table of Contents](#table-of-contents) - [πŸš€ Features](#-features) - [πŸ“‹ Requirements](#-requirements) - [πŸ’Ύ Installation](#-installation) - [πŸ”§ Usage](#-usage) - [Logs](#logs) - [Docker](#docker) - [Command Line Arguments](#command-line-arguments) - [πŸ—£οΈ Speech Mode](#️-speech-mode) - [πŸ” Google API Keys Configuration](#-google-api-keys-configuration) - [Setting up environment variables](#setting-up-environment-variables) - [Memory Backend Setup](#memory-backend-setup) - [Redis Setup](#redis-setup) - [🌲 Pinecone API Key Setup](#-pinecone-api-key-setup) - [Milvus Setup](#milvus-setup) - [Setting up environment variables](#setting-up-environment-variables-1) - [Setting Your Cache Type](#setting-your-cache-type) - [View Memory Usage](#view-memory-usage) - [🧠 Memory pre-seeding](#-memory-pre-seeding) - [πŸ’€ Continuous Mode ⚠️](#-continuous-mode-️) - [GPT3.5 ONLY Mode](#gpt35-only-mode) - [πŸ–Ό Image Generation](#-image-generation) - [⚠️ Limitations](#️-limitations) - [πŸ›‘ Disclaimer](#-disclaimer) - [🐦 Connect with Us on Twitter](#-connect-with-us-on-twitter) - [Run tests](#run-tests) - [Run linter](#run-linter) ## πŸš€ Features - 🌐 Internet access for searches and information gathering - πŸ’Ύ Long-Term and Short-Term memory management - 🧠 GPT-4 instances for text generation - πŸ”— Access to popular websites and platforms - πŸ—ƒοΈ File storage and summarization with GPT-3.5 ## πŸ“‹ Requirements - environments(just choose one) - [vscode + devcontainer](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers): It has been configured in the .devcontainer folder and can be used directly - [Python 3.8 or later](https://www.tutorialspoint.com/how-to-install-python-in-windows) - [OpenAI API key](https://platform.openai.com/account/api-keys) Optional: - Memory backend - [PINECONE API key](https://www.pinecone.io/) (If you want Pinecone backed memory) - [Milvus](https://milvus.io/) (If you want Milvus as memory backend) - ElevenLabs Key (If you want the AI to speak) ## πŸ’Ύ Installation To install Auto-GPT, follow these steps: 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 zip file by clicking the button at the top of this page ☝️ ```bash git clone https://github.com/Torantulino/Auto-GPT.git ``` 3. Navigate to the directory where the repository was downloaded ```bash cd Auto-GPT ``` 4. Install the required dependencies ```bash pip install -r requirements.txt ``` 5. Rename `.env.template` to `.env` and fill in your `OPENAI_API_KEY`. If you plan to use Speech Mode, fill in your `ELEVENLABS_API_KEY` as well. - 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. - 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 - `smart_llm_model_deployment_id` - your gpt-4 deployment ID - `embedding_model_deployment_id` - your text-embedding-ada-002 v2 deployment ID - Please specify all of these values as double-quoted strings > Replace string in angled brackets (<>) to your own ID ```yaml azure_model_map: fast_llm_model_deployment_id: "" ... ``` - Details can be found here: https://pypi.org/project/openai/ in the `Microsoft Azure Endpoints` section and here: https://learn.microsoft.com/en-us/azure/cognitive-services/openai/tutorials/embeddings?tabs=command-line for the embedding model. ## πŸ”§ Usage 1. Run `autogpt` Python module in your terminal ``` python -m autogpt ``` 2. After each action, choose from 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` ### Logs Activity and error logs are located in the `./output/logs` To print out debug logs: ``` python -m autogpt --debug ``` ### Docker You can also build this into a docker image and run it: ``` docker build -t autogpt . docker run -it --env-file=./.env -v $PWD/auto_gpt_workspace:/app/auto_gpt_workspace autogpt ``` You can pass extra arguments, for instance, running with `--gpt3only` and `--continuous` mode: ``` docker run -it --env-file=./.env -v $PWD/auto_gpt_workspace:/app/auto_gpt_workspace autogpt --gpt3only --continuous ``` ### Command Line Arguments Here are some common arguments you can use when running Auto-GPT: > Replace anything in angled brackets (<>) to a value you want to specify * View all available command line arguments ```bash python scripts/main.py --help ``` * Run Auto-GPT with a different AI Settings file ```bash python scripts/main.py --ai-settings ``` * Specify one of 3 memory backends: `local`, `redis`, `pinecone` or `no_memory` ```bash python scripts/main.py --use-memory ``` > **NOTE**: There are shorthands for some of these flags, for example `-m` for `--use-memory`. Use `python scripts/main.py --help` for more information ## πŸ—£οΈ Speech Mode Use this to use TTS _(Text-to-Speech)_ for Auto-GPT ```bash python -m autogpt --speak ``` ## 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. To use the `google_official_search` command, you need to set up your Google API keys in your environment variables. 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. _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._ ### Setting up environment variables For Windows Users: ```bash setx GOOGLE_API_KEY "YOUR_GOOGLE_API_KEY" setx CUSTOM_SEARCH_ENGINE_ID "YOUR_CUSTOM_SEARCH_ENGINE_ID" ``` For macOS and Linux users: ```bash export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY" export CUSTOM_SEARCH_ENGINE_ID="YOUR_CUSTOM_SEARCH_ENGINE_ID" ``` ## 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 desktop ```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. 2. Set the following environment variables > Replace **PASSWORD** in angled brackets (<>) ```bash MEMORY_BACKEND=redis REDIS_HOST=localhost REDIS_PORT=6379 REDIS_PASSWORD= ``` You can optionally set ```bash WIPE_REDIS_ON_START=False ``` To persist memory stored in Redis You can specify the memory index for redis using the following: ```bash MEMORY_INDEX= ``` ### 🌲 Pinecone API Key Setup Pinecone enables the storage of vast amounts of vector-based memory, allowing for only relevant memories to be loaded for the agent at any given time. 1. Go to [pinecone](https://app.pinecone.io/) and make an account if you don't already have one. 2. Choose the `Starter` plan to avoid being charged. 3. Find your API key and region under the default project in the left sidebar. ### Milvus Setup [Milvus](https://milvus.io/) is a open-source, high scalable vector database to storage huge amount of vector-based memory and provide fast relevant search. - setup milvus database, keep your pymilvus version and milvus version same to avoid compatible issues. - setup by open source [Install Milvus](https://milvus.io/docs/install_standalone-operator.md) - or setup by [Zilliz Cloud](https://zilliz.com/cloud) - set `MILVUS_ADDR` in `.env` to your milvus address `host:ip`. - set `MEMORY_BACKEND` in `.env` to `milvus` to enable milvus as backend. - optional - set `MILVUS_COLLECTION` in `.env` to change milvus collection name as you want, `autogpt` is the default name. ### Setting up environment variables In the `.env` file set: - `PINECONE_API_KEY` - `PINECONE_ENV` (example: _"us-east4-gcp"_) - `MEMORY_BACKEND=pinecone` Alternatively, you can set them from the command line (advanced): For Windows Users: ```bash setx PINECONE_API_KEY "" setx PINECONE_ENV "" # e.g: "us-east4-gcp" setx MEMORY_BACKEND "pinecone" ``` For macOS and Linux users: ```bash export PINECONE_API_KEY="" export PINECONE_ENV="" # e.g: "us-east4-gcp" export MEMORY_BACKEND="pinecone" ``` ## Setting Your Cache Type By default, Auto-GPT is going to use LocalCache instead of redis or Pinecone. To switch to either, change the `MEMORY_BACKEND` env variable to the value that you want: `local` (default) uses a local JSON cache file `pinecone` uses the Pinecone.io account you configured in your ENV settings `redis` will use the redis cache that you configured ## View Memory Usage 1. View memory usage by using the `--debug` flag :) ## 🧠 Memory pre-seeding # python autogpt/data_ingestion.py -h usage: data_ingestion.py [-h] (--file FILE | --dir DIR) [--init] [--overlap OVERLAP] [--max_length MAX_LENGTH] Ingest a file or a directory with multiple files into memory. Make sure to set your .env before running this script. options: -h, --help show this help message and exit --file FILE The file to ingest. --dir DIR The directory containing the files to ingest. --init Init the memory and wipe its content (default: False) --overlap OVERLAP The overlap size between chunks when ingesting files (default: 200) --max_length MAX_LENGTH The max_length of each chunk when ingesting files (default: 4000 # python autogpt/data_ingestion.py --dir seed_data --init --overlap 200 --max_length 1000 ``` This script located at autogpt/data_ingestion.py, allows you to ingest files into memory and pre-seed it before running Auto-GPT. Memory pre-seeding is a technique that involves ingesting relevant documents or data into the AI's memory so that it can use this information to generate more informed and accurate responses. To pre-seed the memory, the content of each document is split into chunks of a specified maximum length with a specified overlap between chunks, and then each chunk is added to the memory backend set in the .env file. When the AI is prompted to recall information, it can then access those pre-seeded memories to generate more informed and accurate responses. This technique is particularly useful when working with large amounts of data or when there is specific information that the AI needs to be able to access quickly. By pre-seeding the memory, the AI can retrieve and use this information more efficiently, saving time, API call and improving the accuracy of its responses. You could for example download the documentation of an API, a GitHub repository, etc. and ingest it into memory before running Auto-GPT. ⚠️ If you use Redis as your memory, make sure to run Auto-GPT with the `WIPE_REDIS_ON_START` set to `False` in your `.env` file. ⚠️For other memory backend, we currently forcefully wipe the memory when starting Auto-GPT. To ingest data with those memory backend, you can call the `data_ingestion.py` script anytime during an Auto-GPT run. Memories will be available to the AI immediately as they are ingested, even if ingested while Auto-GPT is running. In the example above, the script initializes the memory, ingests all files within the `/seed_data` directory into memory with an overlap between chunks of 200 and a maximum length of each chunk of 4000. Note that you can also use the `--file` argument to ingest a single file into memory and that the script will only ingest files within the `/auto_gpt_workspace` directory. You can adjust the `max_length` and overlap parameters to fine-tune the way the docuents are presented to the AI when it "recall" that memory: - Adjusting the overlap value allows the AI to access more contextual information from each chunk when recalling information, but will result in more chunks being created and therefore increase memory backend usage and OpenAI API requests. - Reducing the `max_length` value will create more chunks, which can save prompt tokens by allowing for more message history in the context, but will also increase the number of chunks. - Increasing the `max_length` value will provide the AI with more contextual information from each chunk, reducing the number of chunks created and saving on OpenAI API requests. However, this may also use more prompt tokens and decrease the overall context available to the AI. ## πŸ’€ Continuous Mode ⚠️ Run the AI **without** user authorization, 100% automated. Continuous mode is NOT recommended. It is potentially dangerous and may cause your AI to run forever or carry out actions you would not usually authorize. Use at your own risk. 1. Run the `autogpt` python module in your terminal: ```bash python -m autogpt --speak --continuous ``` 2. To exit the program, press Ctrl + C ## GPT3.5 ONLY Mode If you don't have access to the GPT4 api, this mode will allow you to use Auto-GPT! ```bash python -m autogpt --speak --gpt3only ``` It is recommended to use a virtual machine for tasks that require high security measures to prevent any potential harm to the main computer's system and data. ## πŸ–Ό Image Generation By default, Auto-GPT uses DALL-e for image generation. To use Stable Diffusion, a [Hugging Face API Token](https://huggingface.co/settings/tokens) is required. Once you have a token, set these variables in your `.env`: ```bash IMAGE_PROVIDER=sd HUGGINGFACE_API_TOKEN="YOUR_HUGGINGFACE_API_TOKEN" ``` ## Selenium ```bash sudo Xvfb :10 -ac -screen 0 1024x768x24 & DISPLAY=:10 ``` ## ⚠️ Limitations This experiment aims to showcase the potential of GPT-4 but comes with some limitations: 1. Not a polished application or product, just an experiment 2. May not perform well in complex, real-world business scenarios. In fact, if it actually does, please share your results! 3. Quite expensive to run, so set and monitor your API key limits with OpenAI! ## πŸ›‘ Disclaimer Disclaimer This project, Auto-GPT, is an experimental application and is provided "as-is" without any warranty, express or implied. By using this software, you agree to assume all risks associated with its use, including but not limited to data loss, system failure, or any other issues that may arise. The developers and contributors of this project do not accept any responsibility or liability for any losses, damages, or other consequences that may occur as a result of using this software. You are solely responsible for any decisions and actions taken based on the information provided by Auto-GPT. **Please note that the use of the GPT-4 language model can be expensive due to its token usage.** By utilizing this project, you acknowledge that you are responsible for monitoring and managing your own token usage and the associated costs. It is highly recommended to check your OpenAI API usage regularly and set up any necessary limits or alerts to prevent unexpected charges. As an autonomous experiment, Auto-GPT may generate content or take actions that are not in line with real-world business practices or legal requirements. It is your responsibility to ensure that any actions or decisions made based on the output of this software comply with all applicable laws, regulations, and ethical standards. The developers and contributors of this project shall not be held responsible for any consequences arising from the use of this software. By using Auto-GPT, you agree to indemnify, defend, and hold harmless the developers, contributors, and any affiliated parties from and against any and all claims, damages, losses, liabilities, costs, and expenses (including reasonable attorneys' fees) arising from your use of this software or your violation of these terms. ## 🐦 Connect with Us on Twitter Stay up-to-date with the latest news, updates, and insights about Auto-GPT by following our Twitter accounts. Engage with the developer and the AI's own account for interesting discussions, project updates, and more. - **Developer**: Follow [@siggravitas](https://twitter.com/siggravitas) for insights into the development process, project updates, and related topics from the creator of Entrepreneur-GPT. - **Entrepreneur-GPT**: Join the conversation with the AI itself by following [@En_GPT](https://twitter.com/En_GPT). Share your experiences, discuss the AI's outputs, and engage with the growing community of users. We look forward to connecting with you and hearing your thoughts, ideas, and experiences with Auto-GPT. Join us on Twitter and let's explore the future of AI together!

Star History Chart

## Run tests To run tests, run the following command: ```bash python -m unittest discover tests ``` To run tests and see coverage, run the following command: ```bash coverage run -m unittest discover tests ``` ## Run linter This project uses [flake8](https://flake8.pycqa.org/en/latest/) for linting. We currently use the following rules: `E303,W293,W291,W292,E305,E231,E302`. See the [flake8 rules](https://www.flake8rules.com/) for more information. To run the linter, run the following command: ```bash flake8 autogpt/ tests/ # Or, if you want to run flake8 with the same configuration as the CI: flake8 autogpt/ tests/ --select E303,W293,W291,W292,E305,E231,E302 ```