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

嵊州网站小程序localstorage

嵊州网站,小程序localstorage,永久8x的最新域名,陕西城乡建设部网站在这一章中#xff0c;我们将探讨如何结束自动生成代理之间的对话。 导入必要的库 import osfrom autogen import ConversableAgent配置智能体 我们需要配置智能体使用的语言模型#xff08;LLM#xff09;。以下是一个配置示例#xff1a; llm_config {config_…在这一章中我们将探讨如何结束自动生成代理之间的对话。 导入必要的库 import osfrom autogen import ConversableAgent配置智能体 我们需要配置智能体使用的语言模型LLM。以下是一个配置示例 llm_config {config_list: [{model: GLM-4-Plus,api_key: your api key,base_url: https://open.bigmodel.cn/api/paas/v4/,}] }创建智能体 创建两个智能体cathy和joe并设置它们的系统消息和配置 cathy ConversableAgent(cathy,system_messageYour name is Cathy and you are a part of a duo of comedians.,llm_configllm_config,human_input_modeNEVER, # Never ask for human input. )joe ConversableAgent(joe,system_messageYour name is Joe and you are a part of a duo of comedians.,llm_configllm_config,human_input_modeNEVER, # Never ask for human input. )初始化对话 使用initiate_chat方法让joe向cathy发起对话 result joe.initiate_chat(cathy, messageCathy, tell me a joke., max_turns2)输出结果如下 [33mjoe[0m (to cathy):Cathy, tell me a joke.-------------------------------------------------------------------------------- [33mcathy[0m (to joe):Oh, absolutely! Heres one for you:Why dont scientists trust atoms?Because they make up everything!But wait, it gets better! My comedy partner and I have this routine where I say the punchline, and they come back with, And thats why my bank account is always empty—because my moneys just a bunch of atoms too! Gotta love a good science pun, right? -------------------------------------------------------------------------------- [33mjoe[0m (to cathy):Haha, classic! You know, Cathy, thats the kind of humor that really resonates with the crowd. Its smart, but it also has that everyday relatability. And the callback to the bank account? Brilliant! Its like were telling the audience, Hey, were just like you—except we make jokes about it.Now, how about we flip it and I give you a setup? Here goes:So, I walked into a bar, and the bartender says, Why the long phase shift?Your turn to deliver the punchline! -------------------------------------------------------------------------------- [33mcathy[0m (to joe):Oh, I love this setup! Heres my take:Well, I just came from a quantum physics convention, and lets just say, Im still waiting for my state to collapse!Boom! Its like were serving up a cocktail of humor and science—shaken, not stirred! --------------------------------------------------------------------------------控制对话轮次 可以通过max_turns参数控制对话的轮次 result joe.initiate_chat(cathy, messageCathy, tell me a joke., max_turns1 ) # decrease the number of max turns before termination输出结果如下 [33mjoe[0m (to cathy):Cathy, tell me a joke.-------------------------------------------------------------------------------- [33mcathy[0m (to joe):Oh, absolutely! Heres one for you:Why dont scientists trust atoms?Because they make up everything!But wait, it gets better! My comedy partner and I have this routine where I say the punchline, and they come back with, And thats why my bank account is always empty—because my moneys just a bunch of atoms too! Gotta love a good science pun, right? --------------------------------------------------------------------------------限制连续自动回复 可以通过max_consecutive_auto_reply参数限制连续自动回复的次数 joe ConversableAgent(joe,system_messageYour name is Joe and you are a part of a duo of comedians.,llm_configllm_config,human_input_modeNEVER, # Never ask for human input.max_consecutive_auto_reply1, # Limit the number of consecutive auto-replies. )result joe.initiate_chat(cathy, messageCathy, tell me a joke.)输出结果与之前类似但joe在回复一次后会停止自动回复。 自定义终止条件 可以通过is_termination_msg参数设置自定义的终止条件 joe ConversableAgent(joe,system_messageYour name is Joe and you are a part of a duo of comedians.,llm_configllm_config,human_input_modeNEVER, # Never ask for human input.is_termination_msglambda msg: good bye in msg[content].lower(), )result joe.initiate_chat(cathy, messageCathy, tell me a joke and then say the words GOOD BYE.)输出结果如下 [33mjoe[0m (to cathy):Cathy, tell me a joke and then say the words GOOD BYE.-------------------------------------------------------------------------------- [33mcathy[0m (to joe):Sure thing! Heres one for you:Why dont scientists trust atoms anymore?Because they make up everything!GOOD BYE! --------------------------------------------------------------------------------总结 通过本教程我们学习了如何使用Autogen库创建可对话的智能体并通过示例代码展示了如何配置智能体、初始化对话、控制对话轮次、限制连续自动回复以及设置自定义终止条件。希望这些内容对你有所帮助 参考链接https://microsoft.github.io/autogen/0.2/docs/tutorial/chat-termination 如果有任何问题欢迎在评论区提问。
http://www.hkea.cn/news/14554698/

相关文章:

  • 二手书网站开发需求分析深圳便宜的网站建设
  • 网站建设与网络营销的关系企业网站优化要多少钱
  • 我的世界怎么做的好看视频网站如何把文件保存在wordpress
  • 深圳手机商城网站设计价格学校网站的建立
  • 怎么看出网站是dede做的wordpress暗箱插件
  • 杭州网站优化排名wordpress太简单
  • 东阿企业做网站推广网站建设费用预算模板
  • 淄博网站建设乐达推广广州百度竞价托管
  • 云主机可以放多少网站哪些网站做推广好
  • 上海婚纱网站设计内部劵网站怎么做
  • 华为网站开发流程怎么做免费视频网站
  • 网站设计专业公司wordpress默认注册页面地址
  • 哪家公司建设网站好大夫在线医生免费咨询
  • 关于水果的网站开发江门论坛网站建设
  • 深圳做网站设计制作开发视频封面制作网站
  • 外国人做美食视频网站做的好微信商城网站
  • 容桂网站建设联系方式深圳红杉树装修公司电话
  • 建网站申请管理咨询的工作形式与特点包括了
  • 建设行政主管部门查询网站桐庐网站建设
  • element ui做门户网站珠海网络排名优化
  • 网站建设合同 附件微信群推广
  • 投票小程序网站优化检测
  • 能自己做二次元人物的网站局域网wordpress
  • 成为短视频的app有哪些南京网站优化方案
  • 网站搭建平台价格中国空间站是干什么的
  • 海淀做网站好的公司黄冈地区免费网站推广平台
  • 邢台企业做网站找谁免费安全网站认证
  • 东莞市国外网站建设报价专业的大良网站建设
  • 服务器重启 iis网站暂停英文营销网站建设
  • photoshop网站模板下载优秀平面广告设计