Try   HackMD

LLM建構AI Agent的實踐 - Ian

歡迎來到 MOPCON 2024 共筆

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

共筆入口:https://hackmd.io/@mopcon/2024
手機版請點選上方 按鈕展開議程列表。

從這開始
本次範例源始碼 : https://github.com/iangithub/devllmapp/tree/main/OtherSample/Mopcon2024/AgentSample

本次使用的 Semantic Kernel 框架鐵人賽參考資源 : https://ithelp.ithome.com.tw/users/20126569/ironman/7890

本次範例之一的 RAG POC Agent

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

QR Code(好心人可以換更清楚的圖 😅)

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

重點摘要

前情說明

  • 大家應該都知道的 LLM 模型的限制
    • 無法連網
    • 無法記憶
    • 知識有限級時性更新受限
    • 幻覺
  • 對應產生功能
    • GPTPlugins
    • MyGPT。
    • Actions(基於 OpenAI,可連接外部系統)
  • 這些功能目的:擴展 LLM 能力
    • LLM(大腦)
    • Plugin(Tool)
  • 讓 AI 幫你做更多事。
    • 傳統應用 - 規則
    • LLM 應用 - 自主調用(給任務讓 LLM 自行完成目標)
  • Steps involved when LLMs use external
    • 工作檢索合選擇
    • 選擇工具
    • 實際調用工具
    • 將工具產生結果,加入至上下文中
  • 根據可用工具 Plugins 做出決策,並自動化動作。
  • Plugins
    • 外觀:用自然語言描述
    • 內在:提示工程(prompt)、code
  • How to do
    • 計畫與推理
      • AI Agent 理解使用者與易拆解任務計劃並執行這些任務
      • 完成多步驟任務
    • Plugins 使用

Agent Kernel

  • 模型
    • 太笨的 LLM 不用
  • 工具
    • Web Search、RAG
  • 記憶
    • 上下文(短期記憶)
    • RAG(長期記憶)

AI Agent Framework Semantic Kernel

  • 輕量開源 SDK。
  • 目前因工具迭代速度太快,講者建議可以直接閱讀 Source Code,會比看 document 學快。
  • 可以連接雲端或本機端模型。

AI Agent Designs

  • Base Principle
    • 可以用英文發問,LLM 在理解上會較佳。
  • Single Agent
    • Agent: 1
    • Plugin: n
    • 範例:詢問時間
  • Multi-Agent: Sequence
    • Agent: n
    • 依序完成一個 Workflow,並讓個別不同專業的 Agent 處理自己擅長的事情
    • 各自 Agent 可以有自己的 LLM+Plugins
    • 範例:訂閱國內外文章 RSS(newsAgent) → 翻譯(translateAgent)
  • Multi-Agent: Reflection
    • Agent: n
    • Plugin: n
    • 具有反思機制
    • 在 Prompt 中重要的事情講三次真的有效!!XD
    • 範例:讓兩個 Agent 撰寫與 review 文案。
  • Multi-Agent: Delegate
    • Agent: n
    • Plugin: n
    • 為每一個專用的 Agent 配置個性化設定
      • 角色
      • 任務
      • Plugins
    • 如何確認每個任務都對應到正確的 Agent?印出來
    • 範例:根據需求,讓不同 Agents 去查詢負責的法規(搭配使用 RAG)。

Conclusion

  • AI Agent 是現在進行式
    • OpenAI Swarm
  • Micro-Service → Micro-AI-Service

30 天鐵人賽