AutoGPT使ってみました
AutoGPTというのが面白そうだったので動かしてみました。
これは「目的(Goal)」を入力するとその目的に必要なタスクをGPTが考えてそのタスクを実行するために必要なプロンプトもGPTが考えて実行するという「全自動GPT」だそうです
OSはWindows11です。
①まず、pythonを入れます。
②gitを入れます
https://git-scm.com/download/win
③GPTのAPIキーを入手します。
このあたりを参考に入手してください
後はこのサイトに書いてあることを見ながらやりました
コマンドプロンプトを開きます。
④ソースコードを取り出します。
git clone https://github.com/Torantulino/Auto-GPT.git
フォルダを移動します。
cd Auto-GPT
⑤必要な依存関係をインストールします。
py -m pip install -r requirements.txt
⑥GPTのAPIキーを設定します。
Auto-GPTのフォルダの中に「.env.template」というファイルがあるので
これをコピーして「.env」と名前を変えてテキストエディタで開きます。
################################################################################
### AUTO-GPT - GENERAL SETTINGS
################################################################################
# EXECUTE_LOCAL_COMMANDS - Allow local command execution (Example: False)
EXECUTE_LOCAL_COMMANDS=False
# BROWSE_CHUNK_MAX_LENGTH - When browsing website, define the length of chunk stored in memory
BROWSE_CHUNK_MAX_LENGTH=8192
# BROWSE_SUMMARY_MAX_TOKEN - Define the maximum length of the summary generated by GPT agent when browsing website
BROWSE_SUMMARY_MAX_TOKEN=300
# USER_AGENT - Define the user-agent used by the requests library to browse website (string)
# USER_AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"
# AI_SETTINGS_FILE - Specifies which AI Settings file to use (defaults to ai_settings.yaml)
AI_SETTINGS_FILE=ai_settings.yaml
################################################################################
### LLM PROVIDER
################################################################################
### OPENAI
# OPENAI_API_KEY - OpenAI API Key (Example: my-openai-api-key)
# TEMPERATURE - Sets temperature in OpenAI (Default: 1)
# USE_AZURE - Use Azure OpenAI or not (Default: False)
OPENAI_API_KEY=your-openai-api-key
「your-openai-api-key」と書いてある所をGPT APIキーに書き換えて保存します。
ここまでで準備は終わりです。
⑦実行
コマンドプロンプトで以下を実行します
py scripts/main.py
動かない時はこちらで試してみてください
py -m autogpt --gpt3only
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を聞いてくるので名前を付けます。これは何でも良さそうです。「garyoAI」にしました。
garyoAI here! I am at your service.
Describe your AI's role: For example, 'an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.'
garyoAI is:
roleを聞いてきます。とりあえず例のまま入れてみます。「an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.」
garyoAI is: an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.
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(目的)を聞いてきます。日本語でも入力可能なようです。
とりあえず「アマゾンでiPhoneの値段を探してきてください」と設定してみます。
Goal 1: アマゾンでiPhoneの値段を探してきてください
Goal 2:
Using memory of type: LocalCache
GARYOAI THOUGHTS: I should start by searching Amazon for the price of the iPhone
REASONING: To start making profits by selling iPhones, I need to know what the current price of an iPhone on Amazon is.
PLAN:
- Use the Google Search command to look up the current price of iPhones on Amazon
- Save the relevant information to files
- Perform price comparisons to find niche within iPhone market
CRITICISM: I need to keep in mind the potential for fluctuations in price, and ensure that I am keeping a constant lookout for price changes
Attempting to fix JSON by finding outermost brackets
Apparently json was fixed.
NEXT ACTION: COMMAND = google ARGUMENTS = {'input': 'Amazon iphone price'}
Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for garyoAI...
Input:
goal2も聞いてきますがとりあえずEnter押したら動き始めます。
後は「y」を押していくと
Auto-GPT\auto_gpt_workspace\iphone_prices.txt の中にこんなのが出来ていました。
- iPhone 13 Pro Max: Starting from $1,099
- iPhone 13 Pro: Starting from $999
- iPhone 13: Starting from $799
- iPhone 13 Mini: Starting from $699
- iPhone SE: Starting from $399
- iPhone 11: Starting from $549
- iPhone XR: Starting from $499