当前位置: 首页 > news >正文

网站甲假发头套真头发做的假发四川疫情最新消息

网站甲假发头套真头发做的假发,四川疫情最新消息,网站建设五合一,建设网站怎么办理why autogen The whole is greater than the sum of its parts.(整体的功能或价值往往超过单独部分简单相加的总和。) -Aristotle autogen 例子 1. 导入必要的库 首先,导入os库和autogen库中的ConversableAgent类。 import os from autogen import Conversable…

why autogen

The whole is greater than the sum of its parts.(整体的功能或价值往往超过单独部分简单相加的总和。)
-Aristotle

autogen 例子

1. 导入必要的库

首先,导入os库和autogen库中的ConversableAgent类。

import os
from autogen import ConversableAgent

2. 配置LLM(大型语言模型)

接下来,配置LLM的参数。这里我们使用GLM-4-Plus模型,并提供了API密钥和基础URL。

llm_config = {"config_list": [{"model": "GLM-4-Plus","api_key": "your_api_key","base_url": "https://open.bigmodel.cn/api/paas/v4/",}]
}

3. 创建对话代理

使用ConversableAgent类创建一个对话代理。这里我们创建一个名为chatbot的代理,并关闭代码执行功能和人类输入模式。

agent = ConversableAgent("chatbot",llm_config=llm_config,code_execution_config=False,  # 关闭代码执行,默认为关闭。function_map=None,  # 没有注册函数,默认为None。human_input_mode="NEVER",  # 从不请求人类输入。
)

4. 生成回复

我们可以通过调用generate_reply方法来生成对话回复。这里我们传入一个包含用户消息的列表。

reply = agent.generate_reply(messages=[{"content": "Tell me a joke.", "role": "user"}])
print(reply)

输出结果如下:

[autogen.oai.client: 11-24 16:28:32] {351} WARNING - Model GLM-4-Plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing.
Sure! Here's one for you:Why don't skeletons fight each other?Because they don't have the guts! 🦴😄

5. 创建多个对话代理

创建多个对话代理,并为它们设置不同的系统消息。这里创建两个喜剧演员代理:Cathy和Joe。

cathy = ConversableAgent("cathy",system_message="Your name is Cathy and you are a part of a duo of comedians.",llm_config=llm_config,human_input_mode="NEVER",  # 从不请求人类输入。
)joe = ConversableAgent("joe",system_message="Your name is Joe and you are a part of a duo of comedians.",llm_config=llm_config,human_input_mode="NEVER",  # 从不请求人类输入。
)

6. 初始化对话

使用initiate_chat方法初始化对话。这里我们让Joe向Cathy发起对话,并设置最大对话轮数为2。

result = joe.initiate_chat(cathy, message="Cathy, tell me a simple and easy-to-understand joke.", max_turns=2)

输出结果如下:

[33mjoe[0m (to cathy):Cathy, tell me a simple and easy-to-understand joke.--------------------------------------------------------------------------------
[autogen.oai.client: 11-24 16:40:20] {351} WARNING - Model GLM-4-Plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing.
[33mcathy[0m (to joe):Sure thing! Here's one for you:Why don't eggs tell jokes?Because they might crack up! 🥚😂--------------------------------------------------------------------------------
[autogen.oai.client: 11-24 16:40:23] {351} WARNING - Model GLM-4-Plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing.
[33mjoe[0m (to cathy):Oh, Cathy, that's a classic! You know, eggs are always walking on eggshells, trying not to break their yolks. But let me add a punchline to that:Why don't eggs tell jokes?Because they might crack up, and then we'd have a real scrambled situation on our hands! 🍳😂Now, let's get out there and egg-ceed our audience's expectations! 🎤🤣--------------------------------------------------------------------------------
[autogen.oai.client: 11-24 16:40:27] {351} WARNING - Model GLM-4-Plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing.
[33mcathy[0m (to joe):Oh, I love it! That's the spirit! Adding a little extra zing to the punchline really takes it up a notch. 🌟 With that kind of egg-cellent humor, we're bound to have them laughing all the way to the fridge! Let's crack those jokes and whisk up some fun! 🥚🎭🤣 Ready to take the stage and egg-press our comedic genius? Let's do this! 🚀🎤

总结

通过本教程,我们学习了如何使用Autogen库创建对话代理,并展示了如何生成对话回复和初始化多代理对话。希望这能帮助你更好地理解和应用Autogen库。

参考链接:https://microsoft.github.io/autogen/0.2/docs/tutorial/introduction
如果有任何问题,欢迎在评论区提问。

http://www.hkea.cn/news/997689/

相关文章:

  • wordpress php推送示例seozou是什么意思
  • 做网站多久天津seo网站管理
  • 建设局查询网站网络上市场推广
  • 怎么做装修网站b2b多平台一键发布
  • ASP做网站源代码大专网络营销专业好不好
  • 网络公司网站 优帮云做网站排名服务热线
  • 制作网页设计软件列表案例谷歌seo 优化
  • wordpress网站备案上海搜索推广
  • 网站建设套餐有哪些安卓在线视频嗅探app
  • 做电影网站要买什么重庆seo网站哪家好
  • 广州北京网站建设公司网站外部优化的4大重点
  • 网站建设书优化大师是干什么的
  • 优秀的网站建设公司百度指数人群画像
  • wordpress企业中文模板太原seo哪家好
  • 广东网广东网站建设网站推广方案模板
  • 网站运营知识快手seo
  • 咖啡公司网站建设策划书微信营销方式
  • 柳江区城乡住房建设局网站上海seo优化服务公司
  • 西城企业网站建设企业网站怎么优化
  • 初学者做动态网站项目例子游戏特效培训机构排名
  • 汽车类网站搭建直链平台
  • 做网站遇到的困难总结网络营销软件代理
  • 做网站登录论坛外链代发
  • 东营专业网站建设公司排行青岛谷歌优化公司
  • 公众号和网站先做哪个口碑营销的形式
  • 长沙企业建网站费用关键词搜索推广排行榜
  • 怎么做网站端口代理沧州网络推广外包公司
  • php wordpress 目录seo课程培训机构
  • 常州网站建设方案优化引流app推广软件
  • 网络营销网站建设实训网络营销步骤