Skip to content

Latest commit

 

History

History
594 lines (419 loc) · 48.3 KB

README.md

File metadata and controls

594 lines (419 loc) · 48.3 KB

Auto-GPT: An Autonomous GPT-4 Experiment

Unit Tests Discord Follow GitHub Repo stars Twitter Follow

💡 Get help - Q&A or Discord 💬


🔴 🔴 🔴 Urgent: USE stable not master 🔴 🔴 🔴

Download the latest stable release from here: https://github.com/Significant-Gravitas/Auto-GPT/releases/latest. The master branch may often be in a broken state.


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 April 16th 2023

AutoGPTDemo_Subs_WithoutFinalScreen.mp4

Demo made by Blake Werlinger

💖 Help Fund Auto-GPT's Development 💖

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.

Zilliz Roost.AI NucleiAI Algohash TypingMind



robinicus  arthur-x88  knifour  prompthero  digisomni  sultanmeghji  allenstecat  jd3655  tullytim  shawnharmsen  DailyBotHQ  thepok  jacobyoby  MediConCenHK  concreit  tob-le-rone  Heitechsoft  jsolejr  angiaou  kenndanielso  FSTatSBS  bentoml  cfarquhar  MBassi91  Daniel1357  iddelacruz  josephjacks  arjunb023  johnculkin  indoor47  rapidstartup  RawBanana  comet-ml  MetaPath01  maxxflyer  Nalhos  KiaArmani  SparkplanAI  jenius-eagle  toverly1  st617  judegomila  tekelsey  morcos  turintech  Mr-Bishop42  yx3110  rocks6  Odin519Tomas  Cameron-Fulton  ddtarazona  saten-private  cxs  fruition  Kazamario  MayurVirkar  ikarosai  RThaweewat  founderblocks-sils  RealChrisSean  marv-technology  merwanehamadi  fabrietech  tommi-joentakanen  CrypteorCapital  tommygeee  Josecodesalot  thisisjeffchen  ternary5  CrazySwami  omphos  Explorergt92  DataMetis  belharethsami  rickscode  Brodie0  ChrisDMT  humungasaurus  lucas-chu  avy-ai  ASmithOWL  chatgpt-prompts  ZERO-A-ONE  jazgarewal  mathewhawkins  crizzler  Pythagora-io  neverinstall  Dradstone  sunchongren  pingbotan  dexterityx  CatsMeow492  joaomdmoura  zkonduit  Mobivs  doverhq  projectonegames  nnkostov  TheStoneMX  ColinConwell  hunteraraujo  ciscodebs  rejunity  SpacingLily  lazzacapital  SwftCoins  ZoneSixGames  eelbaz  m  caitlynmeeks  AcountoOU  vkozacek  goldenrecursion  scryptedinc  lmaugustin  webbcolton  VoiceBeer  Web3Capital  garythebat  txtr99  ntwrite  AryaXAI  kreativai  abhinav-pandey29  anvarazizov  AuroraHolding  0xmatchmaker  nicoguyon  MatthewAgs  kMag410  josephcmiller2  AIdevelopersAI  GalaxyVideoAgency  jun784  Partender  tjarmain  horazius  nocodeclarity  refinery1  jondwillis  CarmenCocoa  LeeRobidas  wenfengwang  

🚀 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

Optional

⚠️ OpenAI API Keys Configuration ⚠️

Get 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.

Important: It's highly recommended that you track your usage on the Usage page You can also set limits on how much you spend on the Usage limits page.

For OpenAI API key to work, set up paid account at OpenAI API > Billing

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.

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.

  1. 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 instead (Source code (zip), at the bottom of the page).

    git clone -b stable https://github.com/Significant-Gravitas/Auto-GPT.git
  2. Navigate to the directory where you downloaded the repository.

    cd Auto-GPT
  3. Install the required dependencies.

    pip install -r requirements.txt
  4. 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 use.
    7. Save and close the .env file.

    After you complete these steps, you'll have properly configured the API keys for your project.

    Notes:

    • See 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
        • 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
        azure_model_map:
          fast_llm_model_deployment_id: "<my-fast-llm-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 the autogpt Python module in your terminal.
  • On Linux/MacOS:
    ./run.sh
  • On Windows:
    .\run.bat
    Running with --help after .\run.bat lists all the possible command line arguments you can pass.
  1. 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 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

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:/home/appuser/auto_gpt_workspace autogpt

Or if you have docker-compose:

docker-compose run --build --rm auto-gpt

You can pass extra arguments, for instance, running with --gpt3only and --continuous mode:

docker run -it --env-file=./.env -v $PWD/auto_gpt_workspace:/home/appuser/auto_gpt_workspace autogpt --gpt3only --continuous
docker-compose run --build --rm auto-gpt --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
    python -m autogpt --help
  • Run Auto-GPT with a different AI Settings file
    python -m autogpt --ai-settings <filename>
  • Specify a memory backend
    python -m autogpt --use-memory  <memory-backend>

NOTE: There are shorthands for some of these flags, for example -m for --use-memory. Use python -m autogpt --help for more information

🗣️ Speech Mode

Enter this command to use TTS (Text-to-Speech) for Auto-GPT

python -m autogpt --speak

List of IDs with names from eleven labs. You can use the name or ID:

  • Rachel : 21m00Tcm4TlvDq8ikWAM
  • Domi : AZnzlk1XvdvUeBnXmlld
  • Bella : EXAVITQu4vr4xnSDxMaL
  • Antoni : ErXwobaYiN019PkySvjV
  • Elli : MF3mGyEYCl7XYWbV9V6O
  • Josh : TxGEqnHWrfWFTfGW9XjX
  • Arnold : VR6AewLTigWG4xSOukaG
  • Adam : pNInz6obpgDQGcFmaJgB
  • Sam : yoZ06aMxZJJ28mfd3POQ

🔍 Google API Keys Configuration

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.
  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".
  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. 6. Click "Enable APIs and Services". 7. Search for "Custom Search API" and click on it. 8. Click "Enable". 9. Go to the 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 the Custom Search API on your project. (Might need to wait few minutes to propagate)

Set up a custom search engine and add to your .env file: 15. Go to the Custom Search Engine 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.

Setting up environment variables

For Windows Users:

setx GOOGLE_API_KEY "YOUR_GOOGLE_API_KEY"
setx CUSTOM_SEARCH_ENGINE_ID "YOUR_CUSTOM_SEARCH_ENGINE_ID"

For macOS and Linux users:

export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
export CUSTOM_SEARCH_ENGINE_ID="YOUR_CUSTOM_SEARCH_ENGINE_ID"

Plugins

Use the Auto-GPT Plugin Template as a starting point for creating your own plugins.

⚠️💀 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.

Plugin Installation Steps

  1. Clone or download the plugin repository: Clone the plugin repository, or download the repository as a zip file.

    Download Zip

  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:

    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

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
  • milvus will use the milvus cache that you configured
  • weaviate will use the weaviate cache that you configured

Memory Backend Setup

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.

    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.

    Replace PASSWORD in angled brackets (<>)

    MEMORY_BACKEND=redis
    REDIS_HOST=localhost
    REDIS_PORT=6379
    REDIS_PASSWORD=<PASSWORD>

    You can optionally set WIPE_REDIS_ON_START=False to persist memory stored in Redis.

You can specify the memory index for redis using the following:

MEMORY_INDEX=<WHATEVER>

🌲 Pinecone API Key Setup

Pinecone lets you store vast amounts of vector-based memory, allowing the agent to load only relevant memories at any given time.

  1. Go to pinecone 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.

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:

setx PINECONE_API_KEY "<YOUR_PINECONE_API_KEY>"
setx PINECONE_ENV "<YOUR_PINECONE_REGION>" # e.g: "us-east4-gcp"
setx MEMORY_BACKEND "pinecone"

For macOS and Linux users:

export PINECONE_API_KEY="<YOUR_PINECONE_API_KEY>"
export PINECONE_ENV="<YOUR_PINECONE_REGION>" # e.g: "us-east4-gcp"
export MEMORY_BACKEND="pinecone"

Milvus Setup

Milvus is an open-source, highly scalable vector database to store huge amounts of vector-based memory and provide fast relevant search.

  • setup milvus database, keep your pymilvus version and milvus version same to avoid compatible issues.
  • 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.

Weaviate Setup

Weaviate is an open-source vector database. It allows to store data objects and vector embeddings from ML-models and scales seamlessly to billion of data objects. An instance of Weaviate can be created locally (using Docker), on Kubernetes or using Weaviate Cloud Services. Although still experimental, Embedded Weaviate is supported which allows the Auto-GPT process itself to start a Weaviate instance. To enable it, set USE_WEAVIATE_EMBEDDED to True and make sure you pip install "weaviate-client>=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:

MEMORY_BACKEND=weaviate
WEAVIATE_HOST="127.0.0.1" # the IP or domain of the running Weaviate instance
WEAVIATE_PORT="8080" 
WEAVIATE_PROTOCOL="http"
WEAVIATE_USERNAME="your username"
WEAVIATE_PASSWORD="your password"
WEAVIATE_API_KEY="your weaviate API key if you have one"
WEAVIATE_EMBEDDED_PATH="/home/me/.local/share/weaviate" # this is optional and indicates where the data should be persisted when running an embedded instance
USE_WEAVIATE_EMBEDDED=False # set to True to run Embedded Weaviate
MEMORY_INDEX="Autogpt" # name of the index to create for the application

View Memory Usage

View memory usage by using the --debug flag :)

🧠 Memory pre-seeding

Memory pre-seeding allows you to ingest files into memory and pre-seed it before running Auto-GPT.

# python 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 data_ingestion.py --dir DataFolder --init --overlap 100 --max_length 2000

In the example above, the script initializes the memory, ingests all files within the Auto-Gpt/autogpt/auto_gpt_workspace/DataFolder directory into memory with an overlap between chunks of 100 and a maximum length of each chunk of 2000.

Note that you can also use the --file argument to ingest a single file into memory and that data_ingestion.py will only ingest files within the /auto_gpt_workspace directory.

The DIR path is relative to the auto_gpt_workspace directory, so python data_ingestion.py --dir . --init will ingest everything in 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.

Memory pre-seeding is a technique for improving AI accuracy by ingesting relevant data into its memory. Chunks of data are split and added to memory, allowing the AI to access them quickly and generate more accurate responses. It's useful for large datasets or when specific information needs to be accessed quickly. Examples include ingesting API or GitHub documentation before running Auto-GPT.

⚠️ If you use Redis as your memory, make sure to run Auto-GPT with the WIPE_REDIS_ON_START=False in your .env file.

⚠️For other memory backends, we currently forcefully wipe the memory when starting Auto-GPT. To ingest data with those memory backends, 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.

💀 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:

    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!

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 is required.

Once you have a token, set these variables in your .env:

IMAGE_PROVIDER=huggingface
HUGGINGFACE_API_TOKEN="YOUR_HUGGINGFACE_API_TOKEN"

Selenium

sudo Xvfb :10 -ac -screen 0 1024x768x24 & DISPLAY=:10 <YOUR_CLIENT>

⚠️ 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 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. 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 all tests, run the following command:

pytest 

To run just without integration tests:

pytest --without-integration

To run just without slow integration tests:

pytest --without-slow-integration

To run tests and see coverage, run the following command:

pytest --cov=autogpt --without-integration --without-slow-integration

Run linter

This project uses flake8 for linting. We currently use the following rules: E303,W293,W291,W292,E305,E231,E302. See the flake8 rules for more information.

To run the linter, run the following command:

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