見出し画像

最近、よく見かけるAuto-GPTを使ってみた

ここ数日、Auto-GPTに関して目にする機会がありましたので、試してみたくてワクワクしていました。平日だとまとまった時間が取れないので、休日は良いですね。

Auto-GPTは、GPT-4やGPT-3.5-turboを利用したオープンソースのアプリケーションです。AIに役割と目的を与えて、目的を達成するまで自動的にコードを生成実行します。内部的には、gpt-4やgpt-3.5-turboを使って、forループを回しているのではないかと考えられます。


さて、今回は、下記ページを参考にさせて頂きました。


事前準備編

事前準備として、pineconeのapiキーを取得しましょう。

Vector Database for Vector Search | Pinecone



https://www.pinecone.io/


私は、アカウント作成時は、googleアカウントで作成しました。次に、API Keysのところで、EnvironmentとValueのAPIキーをメモしておきましょう。



次に、下記でOpenAIでAPIキーを取得しましょう。

Account API Keys - OpenAI API


これで、pineconeのAPIキーとOpenAIのAPIキーが取得できたので次に進みます。


本編

今回は、Google Colabではなく、自身のPC環境で実行しました。

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


次に、.envtemplateがありますので、名前を.envに変更します。

その後、.envに、以下の項目についてAPIキーの情報を記載致します。
PINECONE_API_KEY、PINECONE_ENV、OPENAI_API_KEYに事前準備で取得したキーや情報を入力しましょう。

PINECONE_API_KEY=Your-API-Key
PINECONE_ENV=pineconeのリージョン
OPENAI_API_KEY=Your-API-Key
ELEVENLABS_API_KEY=your-elevenlabs-api-key
SMART_LLM_MODEL="gpt-4"
FAST_LLM_MODEL="gpt-3.5-turbo"
GOOGLE_API_KEY=
CUSTOM_SEARCH_ENGINE_ID=
USE_AZURE=False
OPENAI_API_BASE=your-base-url-for-azure
OPENAI_API_VERSION=api-version-for-azure
OPENAI_DEPLOYMENT_ID=deployment-id-for-azure


そして、下記を実行します。

python scripts/main.py


実行しますと、いくつか入力する項目が出てきますので、今回は以下で入力しております。簡単に説明すると、AIの名前を付けて、AIの役割を決めて、ウェブサイトを要約して日本語に訳して下さい。Goalは、AIに実行してもらいたいことをいくつか書いています。ウェブサイトを要約して、日本語に訳して、ファイルに保存して下さいと書いています。

AI Name: Good AI 
Good AI is : an AI desinged to autonomously summarize websites and translate it into Japanese
Goal 1: Summarize this website. https://openai.com/research/gpt-4
Goal 2:Translate the summary into Japanese
Goal 3:Save the summary to file
Goal 4: は入力せず、Enterを押下しています。

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: GoodAI
GoodAI 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.'
GoodAI is: an AI desinged to autonomously summarize websites and translate it into Japanese 
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: Summarize this website. https://openai.com/research/gpt-4
Goal 2: Translate the summary into Japanese
Goal 3: Save the summary to file
Goal 4: 

しばらくすると、下記のメッセージが出てきます。

Using memory of type: PineconeMemory
GOODAI THOUGHTS: I will start by summarizing the website https://openai.com/research/gpt-4. I can browse the website to extract the relevant information and then use my LLM capabilities to summarize the main points of the content. After summarizing, I will translate the summary to Japanese and save it to a file.
REASONING: I will start by browsing the website to extract the relevant information because that is the best way to gather information from a website. Next, I can leverage my LLM capabilities to summarize the content, and then use my language translation capabilities to translate the summary to Japanese.
PLAN: 
-  Browse the website to extract relevant information
-  Summarize the content using LLM
-  Translate the summary to Japanese
-  Save the summary to a file
CRITICISM: I need to ensure that my summary is accurate and captures the key points of the content. I also need to make sure that my translation is accurate and conveys the intended meaning of the summary.
NEXT ACTION:  COMMAND = browse_website ARGUMENTS = {'url': 'https://openai.com/research/gpt-4', 'question': ''}
Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for GoodAI...
Input:y


重要なのは、最後のInputのところです。ここでは、Auto-GPTが考えた、この場合だとGOODAI THOUGHTS、REASONING、PLANに対して、次のアクションが示されています。この次のアクションを認めて、次に進むかを決めます。

この後、何度もNEXT ACTIONが出てきますので、ある一定回数は容認するのなら、y -3みたいに3回までは容認すると入力します。

最終的な今回の成果物は、auto-gpt-workspaceフォルダに、gpt4_summary_jp.txtとして保存されまさした。

GPT-4のサマリーは、英語の多岐にわたる多数のテストを行い、57科目における14000の選択問題について使用されました。26言語中24言語でGPT-4は、GPT-3.5やその他のLLMsよりも英語の性能を上回っています。

最終成果物


思ったより要約されすぎたのが気になりました。Auto-GPTに対する役割の定義の仕方やGoalの設定の仕方を変えれば面白いものが出来上がってくるのだろうと実感せずにはいられません。

また、.envファイルにELEVENLABS_API_KEYとかを使えば、音声で結果を回答してくれるのだと思いますので、より面白いものが作られるのではないかと思います。

この記事が気に入ったらサポートをしてみませんか?