AutoGen使用指南 #124
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: HswOAuth/llm_course#124
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
AutoGen使用指南
一、引言
AutoGen是微软推出的一款创新工具,对于复杂任务,AutoGen支持通过多智能体协作来完成。你可以创建多个助理代理,每个代理负责任务的不同部分,通过对话和消息传递机制协同工作。
二、AutoGen的使用步骤
1. 安装与配置
安装AutoGen可以通过pip命令完成:
pip install pyautogen
此外,由于AutoGen依赖于大型语言模型API调用,还需要配置相应的API密钥。以下是一个简单的示例,展示如何设置API密钥:
2. 定义智能体(Agents)
在AutoGen中,智能体是执行特定任务的核心组件。AutoGen提供了多种类型的智能体,如用户代理(UserProxyAgent)和助理代理(AssistantAgent)。用户代理代表人类用户,负责发布任务和接收反馈;助理代理则代表大型语言模型,负责执行任务并生成响应。
3.智能体之间的对话交互
在AutoGen中,智能体之间的对话交互是通过消息传递机制实现的。
三、举例说明
设定场景,设置两个智能体,从一个问题的正反两方面来论证。有许多问题是没有标准答案的,站在不同的立场便看到的不同,这也正是辩论的魅力所在。
1. 实现步骤
创建智能体:创建两个智能体。
配置对话流程:根据问题主题将任务分配给相应的智能体。
以下是一个实现上述功能的代码示例:
2. 效果如下
四、参考
https://microsoft.github.io/autogen/docs/Getting-Started
<期待与你交流,希望能玩出更多的花样>
写得很好喔,又学到了