Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AutoGenを触ってみた

ksnt
October 25, 2023
140

 AutoGenを触ってみた

ksnt

October 25, 2023
Tweet

Transcript

  1. 最近の生成AI (超ザックリ) • ChatGPT (GPT-4) • Open Interpreter • Advanced

    Data Analytics (Code Interpreter) • AutoGen ← New! • https://arxiv.org/abs/2308.08155
  2. AutoGenって何? “AutoGen is a framework that enables development of LLM

    applications using multiple agents that can converse with each other to solve tasks. ” “AutoGenはタスクをこなすためにお互いに会話することができ る複数のエージェントを使ったLLMアプリケーションの開発を 可能にするフレームワークです”
  3. 主な特徴(1) • “AutoGen enables building next-gen LLM applications based on

    multi-agent conversations with minimal effort. It simplifies the orchestration, automation and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcome their weaknesses.” • “AutoGenはマルチエージェントによる会話ベースの次世代ア プリケーションを最小限の努力で構築することができます。複 雑なLLMワークフローのオーケストレーション、オートメー ション、そしてオプティマイゼーションをシンプルにします。 LLMモデルのパフォーマンスを最大化しそれらの弱点を克服し ます。”
  4. 主な特徴(2) • “It supports diverse conversation patterns for complex workflows.

    With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy, the number of agents, and agent conversation topology.” • “複雑なワークフローを実現するための多様な会話パターンを サポートします。カスタマイズ可能で会話が得意なエージェン トとともに開発者は幅広い範囲の会話パターンを構築するため のAutoGenを使うことができます。なお、会話パターンとは会 話の自律性、エージェントの数、そしてエージェントの会話の トポロジーといったものです。”
  5. 主な特徴(3) • “It provides a collection of working systems with

    different complexities. These systems span a wide range of applications from various domains and complexities. They demonstrate how AutoGen can easily support different conversation patterns.” • “さまざまな複雑をもった一連のワーキングシステムを提供し ます。これらのシステムは多様な領域や複雑さを含む広範囲の アプリケーションにわたって影響を及ぼします。そして AutoGenがどれくらい容易にさまざまな会話パターンをサポー トできるかをお見せすることができます。”
  6. 主な特徴(4) • “AutoGen provides a drop-in replacement of openai.Completion or

    openai.ChatCompletion as an enhanced inference API. It allows easy performance tuning, utilities like API unification & caching, and advanced usage patterns, such as error handling, multi-config inference, context programming etc.” • “AutoGenは拡張された推測APIとしてopenai.Completionある いはopenai.ChatCompletionから簡単に乗り換えられます。お 手軽なパフォーマンスチューニングやAPI単一化やキャッシン グ、そして発展的な利用パターン、たとえばエラーハンドリン グやmulti-config inference、コンテキストプログラミングと いったものができます。”
  7. インストール • インストール • $ python3 –m venv autogen •

    $ .¥autogen¥Scripts¥activate • $ pip install pyautogen • 実行環境 • Python docker packageをインストールしてdockerを使うことを強く 推奨
  8. クイックスタート from autogen import AssistantAgent, UserProxyAgent, config_list_from_json # Load LLM

    inference endpoints from an env variable or a file # See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints # and OAI_CONFIG_LIST_sample.json config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST") assistant = AssistantAgent("assistant", llm_config={"config_list": config_list}) user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "coding"}) user_proxy.initiate_chat(assistant, message="Plot a chart of NVDA and TESLA stock price change YTD.") # This initiates an automated chat between the two agents to solve the task example1.py
  9. OAI_CONFIG_LIST [ { "model": "gpt-4", "api_key": “<your OpenAI API key

    here> " }, { "model": "gpt-3.5-turbo", "api_key": " <your OpenAI API key here> " }, { "model": "gpt-3.5-turbo-16k", "api_key": " <your OpenAI API key here> " } ]