インフラエンジニアの隙間時間 Infrastructure Engineer's Spare Time
概要
Microsoftが今月(2024/11)発表したマルチAIエージェントを実際に検証
【論文】「Magentic-One: A Generalist Multi-Agent System for Solving Complex Tasks」
https://arxiv.org/pdf/2411.04468
【GitHub】
https://github.com/microsoft/autogen/tree/main/python/packages/autogen-magentic-one
AIエージェントの内容
自分の得意分野を持つ5つのエージェントが協力して結論を導出
①Orchestrator :司令塔
②Coder :タスクを解くためにコードを書く
③Computer Terminal :上記②Coderが書いたコードを実行
④WebSufer :インターネット検索担当
⑤FileSurfer :ファイル閲覧担当
※引用:https://arxiv.org/pdf/2411.04468
結果(結論)
「自由の女神が向いているのは、贈り主のフランスの方角か?」の問いに見事に正解
結論までの所要時間は少し長い印象
結果(詳細)
最初の質問(入力値)
自由の女神は、贈り主のフランスの方角を向いているか、日本語で教えてください。
司令塔が最初のプランを考えている
[2024-11-19T21:52:28.483757], Orchestrator (thought):
Initial plan:
We are working to address the following user request:
自由の女神は、贈り主のフランスの方角を向いているか、日本語で教教えてください。
司令塔が「検討すべき」リストを作成
Here is an initial fact sheet to consider:
1. GIVEN OR VERIFIED FACTS
- The Statue of Liberty was a gift from France.
2. FACTS TO LOOK UP
- The exact orientation or direction the Statue of Liberty is facing.
- The geographical location of France in relation to the Statue of Liberty's position.
- Historical documentation or authoritative sources about the intended direction of the Statue of Liberty when it was erected.
3. FACTS TO DERIVE
- A comparison between the actual direction the Statue of Liberty is facing and the direction towards France from its location.
4. EDUCATED GUESSES
- Based on general knowledge, the Statue of Liberty faces southeast towards the Atlantic Ocean.
司令塔がWebSurferに仕事を振っている
[2024-11-19T21:52:30.846267], Orchestrator (-> WebSurfer):
Please look up and provide the exact direction in which the Statue of Liberty is facing.
WebSurferが実際にインターネット検索
[2024-11-19T21:52:53.553978], WebSurfer:
I typed 'Statue of Liberty facing direction' into '2000 文字中 0 文字'.
Here is a screenshot of [Statue of Liberty facing direction - 検索](https://www.bing.com/search?q=Statue+of+Liberty+facing+direction&form=QBLH&sp=-1&lq=0&pq=&sc=0-0&qs=n&sk=&cvid=D01D487F86C344E49A9D8805E00C7A3B&ghsh=0&ghacc=0&ghpl=). The viewport shows 22% of the webpage, and is positioned at the top of the page.
司令塔が自由の女神から見たフランスの位置を調べるようWebSurferに指示
[2024-11-19T21:53:34.183501], Orchestrator (-> WebSurfer):
Look up the geographical direction of France relative to the location of the Statue of Liberty in New York City.
司令塔がCoderに向きの計算を指示
[2024-11-19T21:55:45.288450], Orchestrator (-> Coder):
Based on the data that the Statue of Liberty faces southeast, confirm whether this direction points towards France from New York City's geographical location.
Coderが結果を発表
The Statue of Liberty faces southeast, towards Ellis Island. To determine whether this points toward France from New York City's geographical location, we need to understand the general compass directions involved:
1. **Southeast Direction**: This means a direction exactly between south and east on the compass.
2. **Location of France**: France is to the northeast of New York City, across the Atlantic Ocean.
Given that France is to the northeast of New York City and the Statue of Liberty faces southeast, it does not directly face France. Instead, it faces a direction that is more towards the ocean and slightly southward rather than towards Europe.
**Conclusion**: The Statue of Liberty does not face the direction of France; it faces southeast, and France is located to the northeast of New York City. Therefore, the statue is not facing towards its gift-giving country, France.
司令塔が結論を妥当と判断し、最終回答
[2024-11-19T21:58:54.145837], Orchestrator (final answer):
いいえ、自由の女神は贈り主のフランスの方角を向いていません。自由の女神は南東を向いており、これはニューヨーク市から見てフランスの方角(北東)とは異なります。ですので、自由の女神はフランスの方向を向いていないことになります。
構築方法
※OS:Ubuntu 22.04.2 LTS
【前置き】
①Dockerをインストール+起動が必要
※https://docs.docker.com/engine/install/ubuntu/
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
②ffmpegもインストール(これを入れないと実行時にエラーになります)
sudo apt update
sudo apt install ffmpeg
【本題】
構築
git clone https://github.com/microsoft/autogen.git
cd autogen/python
uv sync --all-extras
source .venv/bin/activate
cd packages/autogen-magentic-one
pip install -e .
playwright install --with-deps chromium
ここで環境変数を下記のように設定(Azure用)して読込み(sourceコマンド)
export CHAT_COMPLETION_PROVIDER='azure'
export CHAT_COMPLETION_KWARGS_JSON='{
"api_version": "ここはAPIバージョン。あまり神経質にならなくて良いと思います。例:2024-06-01",
"azure_endpoint": "ここはAOAIのエンドポイント",
"model_capabilities": {
"function_calling": true,
"json_output": true,
"vision": true
},
"api_key": "ここはAOAIのAPIキー",
"azure_deployment": "ここはモデルのデプロイ名(モデル名ではありません)"
}'
実行
python examples/example.py --logs_dir ./logs
