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

驻马店建设网站网站做文献格式

驻马店建设网站,网站做文献格式,微信公众号做网站,二手车网站开发背景Langchain 的 Conversation summary memory 现在让我们看一下使用稍微复杂的内存类型 - ConversationSummaryMemory 。这种类型的记忆会随着时间的推移创建对话的摘要。这对于随着时间的推移压缩对话中的信息非常有用。对话摘要内存对发生的对话进行总结#xff0c;并将当前摘… Langchain 的 Conversation summary memory 现在让我们看一下使用稍微复杂的内存类型 - ConversationSummaryMemory 。这种类型的记忆会随着时间的推移创建对话的摘要。这对于随着时间的推移压缩对话中的信息非常有用。对话摘要内存对发生的对话进行总结并将当前摘要存储在内存中。然后可以使用该内存将迄今为止的对话摘要注入提示/链中。此内存对于较长的对话最有用因为在提示中逐字保留过去的消息历史记录会占用太多令牌。 我们首先来探讨一下这种存储器的基本功能。 示例代码 from langchain.memory import ConversationSummaryMemory, ChatMessageHistory from langchain.llms import OpenAImemory ConversationSummaryMemory(llmOpenAI(temperature0)) memory.save_context({input: hi}, {output: whats up})memory.load_memory_variables({})输出结果 {history: \nThe human greets the AI, to which the AI responds.}我们还可以获取历史记录作为消息列表如果您将其与聊天模型一起使用这非常有用。 memory ConversationSummaryMemory(llmOpenAI(temperature0), return_messagesTrue) memory.save_context({input: hi}, {output: whats up})memory.load_memory_variables({})输出结果 {history: [SystemMessage(content\nThe human greets the AI, to which the AI responds., additional_kwargs{})]}我们也可以直接使用 predict_new_summary 方法。 messages memory.chat_memory.messages previous_summary memory.predict_new_summary(messages, previous_summary)输出结果 \nThe human greets the AI, to which the AI responds.Initializing with messages 如果您有此类之外的消息您可以使用 ChatMessageHistory 轻松初始化该类。加载期间将计算摘要。 示例代码 history ChatMessageHistory() history.add_user_message(hi) history.add_ai_message(hi there!)memory ConversationSummaryMemory.from_messages(llmOpenAI(temperature0), chat_memoryhistory, return_messagesTrue)memory.buffer输出结果 \nThe human greets the AI, to which the AI responds with a friendly greeting.Using in a chain 让我们看一下在链中使用它的示例再次设置 verboseTrue 以便我们可以看到提示。 示例代码 from langchain.llms import OpenAI from langchain.chains import ConversationChain llm OpenAI(temperature0) conversation_with_summary ConversationChain(llmllm, memoryConversationSummaryMemory(llmOpenAI()),verboseTrue ) conversation_with_summary.predict(inputHi, whats up?)输出结果 Entering new ConversationChain chain...Prompt after formatting:The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.Current conversation:Human: Hi, whats up?AI: Finished chain. Hi there! Im doing great. Im currently helping a customer with a technical issue. How about you?示例代码 conversation_with_summary.predict(inputTell me more about it!)输出结果 Entering new ConversationChain chain...Prompt after formatting:The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.Current conversation:The human greeted the AI and asked how it was doing. The AI replied that it was doing great and was currently helping a customer with a technical issue.Human: Tell me more about it!AI: Finished chain. Sure! The customer is having trouble with their computer not connecting to the internet. Im helping them troubleshoot the issue and figure out what the problem is. So far, weve tried resetting the router and checking the network settings, but the issue still persists. Were currently looking into other possible solutions.示例代码 conversation_with_summary.predict(inputVery cool -- what is the scope of the project?)输出结果 Entering new ConversationChain chain...Prompt after formatting:The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.Current conversation:The human greeted the AI and asked how it was doing. The AI replied that it was doing great and was currently helping a customer with a technical issue where their computer was not connecting to the internet. The AI was troubleshooting the issue and had already tried resetting the router and checking the network settings, but the issue still persisted and they were looking into other possible solutions.Human: Very cool -- what is the scope of the project?AI: Finished chain. The scope of the project is to troubleshoot the customers computer issue and find a solution that will allow them to connect to the internet. We are currently exploring different possibilities and have already tried resetting the router and checking the network settings, but the issue still persists.完结
http://www.sczhlp.com/news/216574/

相关文章:

  • 绿色食品网站模板个人主页原型图
  • 深圳商城网站设计多少钱个人网站的前途
  • 运动网站建设主题大连地区建设网站
  • 潍坊网站建设品牌云盘网页版登录
  • 常州网站建设推广怎么开网店?去哪里注册?
  • 查钓鱼网站网站导航栏按钮
  • 带数据库网站模板南山做网站方案
  • 金融类的网站怎么做岳阳网站开发公司推荐
  • 广东建设工程质量安全协会网站网站开发具体问题
  • 房产网站设计京东商城网站特色
  • 搜集10个优秀网站网站备案信息查询申请表
  • 邯郸网站建设效果好wordpress 新页面打开
  • html5网站建设企业论文免费漫画软件
  • 主机屋空间安装织梦后台程序后怎么弄成淘宝客网站福建漳州东山建设局网站
  • 网站做短链统计优缺点博客园wordpress模板
  • 坂田网站设计网站建设公司南宁
  • 网站建设二团队免费做视频的软件app
  • 如何用百度搜自己做的网站中文命名网页制作素材会怎么样
  • 网站建设北京pda智能巡检系统
  • 方正园林建设监理中心网站做网站需要购买什么
  • 昨天正常的网站突然显示建设中想做电商需要投资多少钱
  • 网页设计与网站建设作业郑州定制网站开发
  • 浙江省建设厅网站查询石家庄百度推广开户
  • 百度开放云搭建网站化工网站建站模板下载
  • 达州市住房和城乡建设局网站dw网页制作三个页面跳转
  • 2025 年深圳餐饮设计公司最新推荐排行榜: IP 化设计机构口碑甄选,助力餐饮品牌破局同质化竞争
  • [ACTF2020 新生赛]Include 1 文件包含
  • 编程语言变量的引用共享问题
  • 分析一下url的格式和windows与Linux共享文件的格式
  • 如何查询一个网站的空间微信朋友圈网站广告怎么做