🐷

自律的にリサーチをするauto-GPTの詳細をまとめました

2023/04/25に公開

Auto-GPTの特徴

  • 検索、情報収集のためのインターネットアクセス
    (人気のあるウェブサイトやプラットフォームへのアクセス等)
  • 長期および短期のメモリ管理(例えば、過去に実施した検索を記憶します。)
  • 調べた内容をドキュメントに保存してくれる

環境要件

  • Python3.8以降

Welcome to Python.org

  • OPENAI API key
  • PINECONE API key

Auto-GPTのインストール

インストール手順 ※Pythonをインストールした上で実施してください。

下記コードをcmdまたはターミナルで実行します。

git clone https://github.com/Torantulino/Auto-GPT.git
cd 'Auto-GPT'
pip3 install -r requirements.txt

API Keyの設定

エディター(今回はVS code)を開きます。

先ほど指定した”Auto-GPT”フォルダーを開き、”.env.template”を編集しAPI Keyを設定していきます。

この際、”.env.template”を”.env”に名前変更しましょう。

  • Pineconeの設定

下記サイトにログインし、メニューの”API Keys”からAPI Keyを作成・取得します。

Vector Database for Vector Search | Pinecone

作成したAPI KeyとRegionを”.env”に入力しましょう。

PINECONE_API_KEY= #取得したKeyを入力
PINECONE_ENV= #Keyに紐づくRegionを入力
  • OpenAIのAPI Keyを設定

下記サイトにログイン後、右上のアイコンマークからAPI Keyを見にいきましょう。(View API Key)

OpenAI API

Keyを作成し、”.env”に入力します。

OPENAI_API_KEY= #取得したKeyを入力

以下は任意の設定となります。

  • 音声機能をつける場合(Auto-GPTが喋るようにする)

下記サイトにログインし、右上のアイコン>ProfileからAPI Keyを取得します。

ElevenLabs || Prime Voice AI

取得したKeyを”.env”に入力します。

ELEVENLABS_API_KEY= #取得したKeyを入力
  • Googleにアクセスさせる場合

下記サイトにアクセスします。

画像の赤枠部分をクリックし、新しいプロジェクトを作成します。
プロジェクト名は任意、場所は”組織なし”で作成しましょう。

作成後、左のメニューバーから”APIとサービス”>”ライブラリ”と進みます。
(もしくは検索バーで”APIライブラリ”と検索し、ライブラリへ)

検索バーに”custom”と入力すると、予測に”custom search api”と出るのでこれで検索、選択し有効化します。

有効化後、認証情報から認証情報を作成し、APIキーを作成します。

作成したAPI Keyを”.cnv”に入力します。

GOOGLE_API_KEY= #取得したKeyを入力

CUSTOM_SEARCH_ENGINE_ID は下記サイトにアクセス

Programmable Search Engine by Google

Auto-GPTの実行


“env.”の編集が終わったら保存し、ターミナルで以下を入力し動かしてみましょう。

python -m autogpt

追記:python3.10でないと以下のエラーが出ました。

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

https://github.com/Significant-Gravitas/Auto-GPT/issues/3070

実行

Auto-GPTでは、AIの名前(任意)・役割・ゴール(5つまで)を設定します。

Welcome to Auto-GPT!  Enter the name of your AI and its role below. Entering nothing will load defaults.
Name your AI:  For example, 'Entrepreneur-GPT'
AI Name:#任意の名前を設定

(例)
AI Name:TEST

次に役割を設定します。

#設定した名前 is: #AIの役割を設定します。

(例)
TEST is: You are an AI that provides high school students with easy-to-understand explanations about the latest exchange and stock markets.

最後にゴールの設定です。

Enter up to 5 goals for your AI:  For example: Increase net worth, Grow Twitter Account, Develop and manage multiple businesses autonomously'
Enter nothing to load defaults, enter nothing when finished.
Goal 1:#ゴールを設定します。

(例)
Goal 1: Summarize the most recent dollar/yen market in a 500-word report, discussing trends and the reasons for fluctuations.

ゴールを設定しENTERを押すと後は自動で動き出します。

結果

Auto-GPTが導き出した結果は、最初に指定したAut-GPTフォルダのauto_gpt_workspace内にtxt.ファイルが保存されます。

参考までに、(例)で記載した内容を動かした場合は以下の内容が出力されました。

<aside>
💡 J.P. Morgan Research is bullish on the yen in 2023, and USD/JPY is expected to hit 135 in March 2023, before trading at 133 in June 2023, 130 in September 2023 and 128 in December 2023. The article also attributes the expected decline in the dollar/yen pair to a decline in long-end U.S. yields, a peaking out in terminal rate expectations into 2023, and the risk of a moderate U.S. recession. The Bank of Japan's recent relaxation of its yield curve control policy is also expected to be a bullish tailwind for the yen.

</aside>

その他

  • AuthenticationError

下記のエラーが出た場合。まずはブラウザのキャッシュをクリア

それでも解消しない場合は、正しいAPI Keyを使っているか。
異なるAPI Keyを2つ使っていないか確認しましょう。

Incorrect API key provided: API_KEY*********************************ZXY. You can find your API key at https://beta.openai.com

Incorrect API key provided | OpenAI Help Center

Discussion