链载Ai

标题: AutoGen:构建多智能体人工智能系统 [打印本页]

作者: 链载Ai    时间: 1 小时前
标题: AutoGen:构建多智能体人工智能系统

ingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;letter-spacing: normal;text-wrap: wrap;text-align: center;line-height: 1.1em;border-width: 1px;border-style: solid;border-color: rgb(0, 0, 0);">简介

ingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;font-size: 14px;letter-spacing: normal;text-align: left;text-wrap: wrap;line-height: 26px;">AutoGen 是一个功能强大的框架,可简化人工智能应用程序的开发。凭借其独特的特性和功能,AutoGen 可以轻松创建多代理人工智能系统。本指南将介绍 AutoGen 的优势,并逐步说明如何安装和使用 AutoGen Studio 来构建多智能体工作流。

ingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;letter-spacing: normal;text-align: left;text-wrap: wrap;background-color: rgb(0, 0, 0);color: rgb(255, 255, 255);width: fit-content;">1. AutoGen 的优势

    ingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;font-size: 14px;letter-spacing: normal;text-align: left;text-wrap: wrap;background-color: rgb(255, 255, 255);" class="list-paddingleft-1">
  1. 多代理协作 AutoGen 可促进人工智能代理之间的协作,创建团队或 "工作人员 "来处理复杂的任务。交换信息和协调行动的能力增强了解决问题的能力。
  2. 模块化设计 AutoGen 的模块化方法允许开发人员混合和匹配智能体、工具、任务和团队等组件。这种设计为构建人工智能系统提供了灵活性和定制选项。
  3. 与 LLM 集成 AutoGen 利用语言和学习模型 (LLM) 的强大功能来完成生成计划、代码编写、响应评估和错误恢复步骤等任务。这种集成增强了人工智能工作流程。
  4. 快速原型开发 AutoGen Studio 是构建多智能体工作流的界面,可实现快速原型开发。它可作为终端用户界面的展示平台,并演示人工智能系统的功能。
  5. 代码生成和执行 AutoGen 通过利用 Docker 容器进行隔离执行,简化了代码生成和执行。这一功能提高了效率和可扩展性。

ingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;letter-spacing: normal;text-align: left;text-wrap: wrap;background-color: rgb(0, 0, 0);color: rgb(255, 255, 255);width: fit-content;">2. 本地安装AutoGen Studio

  1. 安装Python 3.11: AutoGen Studio 2.0 需要 Python 3.11 及以上版本。确保已安装此版本。创建项目文件夹:为 AutoGen 项目创建一个新文件夹。
  2. 创建项目文件夹:为 AutoGen 项目创建一个新文件夹。
  3. 创建虚拟环境:使用python3 -m venv venv设置新的虚拟环境,并使用source venv/bin/activate激活它(在 Windows 系统中,使用venv\Scripts\activate 来激活)。
  4. 安装 AutoGen Studio:运行pip install autogenstudio安装 AutoGen Studio 及其依赖项。
  5. 配置 API 密钥:将 OpenAI 或 Azure OpenAI API 密钥设置为环境变量(例如:set OPENAI_API_KEY=<your_api_key>)。
  6. 启动 AutoGen Studio:运行 autogenstudio ui --port 8081 在 8081 端口启动应用程序。打开网页浏览器,进入 http://localhost:8081/ 访问 AutoGen Studio 界面。

在终端中执行此操作后,终端应显示如下内容。

Initializedapplicationdatafolder:/Users/krishankantsinghal/.autogenstudio
INFO:Startedserverprocess[72082]
INFO:Waitingforapplicationstartup.
*****Appstarted*****
INFO:Applicationstartupcomplete.
INFO:Uvicornrunningonhttp://127.0.0.1:8081(PressCTRL+Ctoquit)

ingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;letter-spacing: normal;text-align: left;text-wrap: wrap;background-color: rgb(0, 0, 0);color: rgb(255, 255, 255);width: fit-content;">3. 使用 AutoGen Studio

ingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;letter-spacing: normal;text-align: left;text-wrap: wrap;">3.1 Build

可以创建智能体、定义其技能并指定智能体工作流。

ingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;letter-spacing: normal;text-align: left;text-wrap: wrap;">3.2 Playground 功能区

在 Playground 与智能体互动、测试工作流并探索 AutoGen Studio 的相关功能。

ingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;letter-spacing: normal;text-align: left;text-wrap: wrap;background-color: rgb(0, 0, 0);color: rgb(255, 255, 255);width: fit-content;">4. AutoGen 的关键概念--模型、工作流、智能体和技能及示例:

ingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;letter-spacing: normal;text-align: left;text-wrap: wrap;">4.1 模型

在 AutoGen 中,模型通常是指为智能体提供动力的大型语言模型 (LLM)。AutoGen 支持与各种 LLM 集成,例如 OpenAI 的 GPT 模型或 Azure OpenAI 服务模型。例如,您可以将 AutoGen 配置为使用 OpenAI 的 "text-davinci-003 "模型或部署在 Azure OpenAI 服务上的自定义模型。

4.2 工作流

AutoGen 中的工作流是一种规范,它定义了一组智能体以及它们应如何协作完成任务。它描述了不同智能体之间的角色、职责和交互。例如,一个工作流程可能涉及与用户交互的 "用户智能体"、生成计划和代码的 "助理智能体 "以及运行和评估所生成代码的 "代码执行智能体"。

4.3 智能体

AutoGen 中的智能体是具有特定能力和职责的人工智能实体。可以为智能体分配角色、技能和指令以指导其行为。例如:可以让 "图像生成智能体" 负责根据文本提示生成图像,或让 "研究智能体" 负责从各种来源查找相关信息。

其中UserProxyAgent、AssistantAgent 和 GroupChat 是 AutoGen 框架中的三个智能体组件模版,它们在多智能体对话系统中各司其职。

  1. UserProxyAgent






欢迎光临 链载Ai (https://www.lianzai.com/) Powered by Discuz! X3.5