今週のざっくばらん
BabyAGI
私の長男、洋平が発表したオープンソース・プロジェクト、BabyAGIがAI業界で評判になっているという話を書きましたが、今週は、これについて少し解説します。
Youtubeで BabyAGI で検索をすると、以下のようなチュートリアル・ビデオが複数出てきます。
BabyAGI: Discover the Power of Task-Driven Autonomous Agents!
NEW BabyAGI - The Birth of Fully Autonomous AI (Tutorial)
AI Uprising: Will Baby AGI & Autonomous Agents Take Our Jobs?
NEW Baby AGI - Autonomous AI With GPT4 (Installation Tutorial)
メジャーなメディアにも数多く取り上げられています。
Fortune:BabyAGI is taking Silicon Valley by storm. Should we be scared?
Mashable:Auto-GPT, BabyAGI, and AgentGPT: How to use AI agents
Yahoo Finance:BabyAGI is taking Silicon Valley by storm. Should we be scared?
Fast Company:Auto-GPT and BabyAGI: How ‘autonomous agents’ are bringing generative AI to the masses
BabyAGIは、ひとことで言えば、「AIエージェント」で、人工知能が、ユーザーの代わりに(エージェント=代理人として)、自動的に作業をしてくれる仕組みです。
彼は、ChatGPTが注目を集める1年以上前からGPT3を実際の業務の自動化に使っていたため、彼としては、その一環としてエージェントをPythonで実装し(PythonのコードもGPT3に書かせたそうです)、オープンソース化したところ、大評判になってしまったのです。
BabyAGIは、以下のように動作します(当初の実装で、classic 版と呼ばれています)。
.envファイルから、OpenAIのkey(APIを呼ぶのに必要なキー)とOBJECTIVE(プロジェクトの目的)を読み込む。例として与えられているのは、OBJECTIVEが"Solve World Hunger"(世界の飢餓問題を解決する)ですが、自由に設定できます。
"Develop a task list"をtask_listに最初のタスクとしてしまう。
最初のタスクを task_list から取り出す。
実行済みのタスクを5つ、pineconeのテーブルから取り出す(context_agent)。
GPTに対して、
“You are an AI who performs one task based on the following objective: {objective}. Take into account these previously completed tasks:{context}. Your task: {task} Response:”
というプロンプトを与える(execution_agent)。
結果を、pineconeのテーブルにしまう。
GPTに対して、
“You are an task creation AI that uses the result of an execution agent to create new tasks with the following objective: {objective}, The last completed task has the result: {result}. This result was based on this task description: {task}. These are incomplete tasks: {’, '.join(task_list)}. Based on the result, create new tasks to be completed by the AI system that do not overlap with incomplete tasks. Return the tasks as an array.”
を渡す(task_creation_agent)。
結果を、task_listに追加
GPTに対して、
"You are an task prioritization AI tasked with cleaning the formatting of and reprioritizing the following tasks: {task_names}. Consider the ultimate objective of your team:{OBJECTIVE}. Do not remove any tasks. Return the result as a numbered list, like:
#. First task
#. Second task
Start the task list with number {next_task_id}."
を渡す(prioritization_agent)。
結果を使って、task_listを新たに構築
3に戻る
BabyAGIがユニークなのは、三種類の異なるプロンプトを用意し、それを順番にGPTに渡すことにより、execution_agent、task_creation_agent、prioritization_agentの三つのエージェントに異なる仕事をさせている点で、これにより、与えられた目的に必要なタスクリストを順番に生成してくれます。
もう一つユニークな点は、実行済みのタスクの結果を pinecone という(先週解説した)embeddings 用のデータベースにしまっている点です。ステップ4で「実行済みのタスク」を取り出す際には、OBJECTIVEのEmbeddingをパラメータとして渡し、それに近いEmbeddingを持つタスクを5つ選び出しています。
エージェントという形で、人工知能に自動的に仕事をさせること、および、Embeddings のデータベースを短期記憶のように使っているあたりが、注目を浴びた理由だと思いますが、これほどまでに評判になるとは、驚きでした。結果として、彼のTwitterのフォロワーの数が大きく増え、本業のファンド集めにも役に立っているので、親としては、嬉しい限りです。
プロンプトエンジニアリング教室:小泉進次郎(メルマガ限定)
最近、プロンプトエンジニアリングを学びたいという意見が多いので、実際に私が作っているものをここで紹介することにより、一緒に学んでいければと考えています。今回、作ったのは、(意味のない)小泉進次郎節を語る、小泉進次郎ボットです。
まずは結果から紹介します。
質問: 地球温暖化についての意見を教えてください。
この記事は約
NaN 分で読めます(
NaN 文字 / 画像
NaN
枚)