Install and set up AutoGPT with Poetry#

This section explains how to install and configure AutoGPT using Poetry.

Installing AutoGPT using Poetry#

  1. If you haven’t installed Poetry yet, please refer to the Poetry official website for installation. As of May 2, 2023, the following applies:

    Linux, macOS, Windows (WSL):#
    curl -sSL https://install.python-poetry.org | python3 -
    
    Windows (Powershell):#
    (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
    
  2. Clone the AutoGPT repository:

    git clone -b v0.3.0 https://github.com/Significant-Gravitas/Auto-GPT.git
    

Tip

You can obtain a relatively stable package by tagging with release.

  1. Move to the AutoGPT directory:

    cd autogpt
    
  2. Add the following contents to pyproject.toml.

    pyproject.toml#
    [tool.poetry]
    name = "your_project_name"
    version = "0.1.0"
    description = ""
    authors = ["Your Name <you@example.com>"]
    
    [tool.poetry.dependencies]
    python = "^3.9"
    beautifulsoup4 = ">=4.12.2"
    colorama = "0.4.6"
    distro = "1.8.0"
    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 = "*"
    google-api-python-client = {git = "https://github.com/googleapis/google-api-python-client.git", branch = "main"}
    pinecone-client = "2.2.1"
    redis = "*"
    orjson = "3.8.10"
    Pillow = "*"
    selenium = "4.1.4"
    webdriver-manager = "*"
    jsonschema = "*"
    tweepy = "*"
    click = "*"
    charset-normalizer = ">=3.1.0"
    spacy = ">=3.0.0,<4.0.0"
    en-core-web-sm = {url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0-py3-none-any.whl"}
    
    [tool.poetry.dev-dependencies]
    coverage = "*"
    flake8 = "*"
    numpy = "*"
    pre-commit = "*"
    black = "*"
    isort = "*"
    gitpython = "3.1.31"
    auto-gpt-plugin-template = "*"
    mkdocs = "*"
    pymdown-extensions = "*"
    openapi-python-client = "0.13.4"
    pytest = "*"
    asynctest = "*"
    pytest-asyncio = "*"
    pytest-benchmark = "*"
    pytest-cov = "*"
    pytest-integration = "*"
    pytest-mock = "*"
    vcrpy = "*"
    pytest-recording = "*"
    

Tip

The above content will change with version updates. Please input the latest contents of requirement.txt for ChatGPT and output it for poetry.

Tip

poetry install でエラーが発生する場合は、ChatGPTにエラー内容を貼り付けて対処方法を聞いてください。 私の場合は CalledProcessError が発生しましたが、ChatGPTにエラーを質問すると、google-api-python-clientのGitリポジトリのデフォルトブランチがmasterではなく、mainであることを解説するとともに正しい記述方法を教えてくれました。

  1. Install necessary packages:

    poetry install
    

Obtaining OpenAI API key#

  1. OpenAIへアクセス

  2. Click the “Sign in” button in the upper right corner to log in to your account. If you don’t have an account, click “Create an account” to create a new one.

  3. After logging in, access the dashboard.

  4. Click on “View API Keys” from “Personal” at the upper right corner.

  5. On the “API Keys” page, click on the “Create new secret key” button.

  6. A new API key will be generated and displayed. Copy this API key and use it in your Python project.

Using OpenAI API Key in Your Project#

  1. Enter the command cp .env.template .env to copy the file and enter the API key without quotation marks or spaces in the “OPENAI_API_KEY=” string in the .env file.

Setting up Custom Search API#

Google API key#

  1. Obtain an API key by registering with Google API services from the GCP console

  2. Set the API key in the GOOGLE_API_KEY= part of the env file.

CUSTOM SEARCH ENGINE の ID#

  1. Create Search Engine

  2. Set API key in .env file CUSTOM_SEARCH_ENGINE_ID=.

Test#

run AutoGPT#
poetry shell
./run.sh

input tell me a single joke for test

Test Script#
I Want To AutoGPT to: tell me a single joke

refference url