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

网站技建设费计入什么科目批量建wordpress

网站技建设费计入什么科目,批量建wordpress,网站在哪里变更备案信息,论坛企业推广分类目录#xff1a;《自然语言处理从入门到应用》总目录 会话缓存记忆ConversationBufferMemory 本节将介绍如何使用对话缓存记忆ConversationBufferMemory。这种记忆方式允许存储消息#xff0c;并将消息提取到一个变量中#xff0c;我们首先将其提取为字符串#xff1a…分类目录《自然语言处理从入门到应用》总目录 会话缓存记忆ConversationBufferMemory 本节将介绍如何使用对话缓存记忆ConversationBufferMemory。这种记忆方式允许存储消息并将消息提取到一个变量中我们首先将其提取为字符串 from langchain.memory import ConversationBufferMemorymemory ConversationBufferMemory() memory.save_context({input: hi}, {output: whats up}) memory.load_memory_variables({})输出 {history: Human: hi\nAI: whats up}我们还可以将历史记录作为消息列表获取。如果我们与聊天模型一起使用这非常有用 memory ConversationBufferMemory(return_messagesTrue) memory.save_context({input: hi}, {output: whats up}) memory.load_memory_variables({})输出 {history: [HumanMessage(contenthi, additional_kwargs{}),AIMessage(contentwhats up, additional_kwargs{})]}在链式结构中使用 我们还可以在链式结构中使用它设置verboseTrue以便我们可以看到提示 from langchain.llms import OpenAI from langchain.chains import ConversationChainllm OpenAI(temperature0) conversation ConversationChain(llmllm, verboseTrue, memoryConversationBufferMemory() ) conversation.predict(inputHi there!)日志输出 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 there! AI: Finished chain.输出 Hi there! Its nice to meet you. How can I help you today?输入 conversation.predict(inputIm doing well! Just having a conversation with an AI.)日志输出 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 there! AI: Hi there! Its nice to meet you. How can I help you today? Human: Im doing well! Just having a conversation with an AI. AI: Finished chain.输出 Thats great! Its always nice to have a conversation with someone new. What would you like to talk about?输入 conversation.predict(inputTell me about yourself.)日志输出 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 there! AI: Hi there! Its nice to meet you. How can I help you today? Human: Im doing well! Just having a conversation with an AI. AI: Thats great! Its always nice to have a conversation with someone new. What would you like to talk about? Human: Tell me about yourself. AI: Finished chain.输出 Sure! Im an AI created to help people with their everyday tasks. Im programmed to understand natural language and provide helpful information. Im also constantly learning and updating my knowledge base so I can provide more accurate and helpful answers.会话缓存记忆ConversationBufferWindowMemory 会话缓存记忆ConversationBufferWindowMemory保留了对话中随时间变化的交互列表。它只使用最后的 K K K次交互。这对于保持最近交互的滑动窗口很有用以防止缓冲区过大。 from langchain.memory import ConversationBufferWindowMemorymemory ConversationBufferWindowMemory(k1) memory.save_context({input: hi}, {output: whats up}) memory.save_context({input: not much you}, {output: not much}) memory.load_memory_variables({})输出 {history: Human: not much you\nAI: not much}我们还可以将历史记录作为消息列表获取如果我们将其与聊天模型一起使用这将非常有用 memory ConversationBufferWindowMemory(k1, return_messagesTrue)memory.save_context({input: hi}, {output: whats up}) memory.save_context({input: not much you}, {output: not much}) memory.load_memory_variables({})输出 {history: [HumanMessage(contentnot much you, additional_kwargs{}), AIMessage(contentnot much, additional_kwargs{})]}Using in a chain 在下面的示例中再次设置verboseTrue以便查看提示 from langchain.llms import OpenAI from langchain.chains import ConversationChainconversation_with_summary ConversationChain(llmOpenAI(temperature0), memoryConversationBufferWindowMemory(k2), 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(inputWhats their issues?)日志输出 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: Hi there! Im doing great. Im currently helping a customer with a technical issue. How about you? Human: Whats their issues? AI: Finished chain.输出 The customer is having trouble connecting to their Wi-Fi network. Im helping them troubleshoot the issue and get them connected.输入 conversation_with_summary.predict(inputIs it going well?)输出 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: Hi there! Im doing great. Im currently helping a customer with a technical issue. How about you? Human: Whats their issues? AI: The customer is having trouble connecting to their Wi-Fi network. Im helping them troubleshoot the issue and get them connected. Human: Is it going well? AI: Finished chain.输出 Yes, its going well so far. Weve already identified the problem and are now working on a solution.当前若继续对话则 Hi there! Im doing great. Im currently helping a customer with a technical issue. How about you?的记忆将被遗忘 conversation_with_summary.predict(inputWhats the solution?)日志输出 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: Whats their issues? AI: The customer is having trouble connecting to their Wi-Fi network. Im helping them troubleshoot the issue and get them connected. Human: Is it going well? AI: Yes, its going well so far. Weve already identified the problem and are now working on a solution. Human: Whats the solution? AI: Finished chain.输出 The solution is to reset the router and reconfigure the settings. Were currently in the process of doing that.实体记忆Entity Memory 本节演示了如何使用一个记忆模块来记录有关特定实体的信息。它使用语言模型LLMs提取实体相关的信息并随着时间的推移逐渐积累对该实体的知识。让我们首先通过一个例子来了解如何使用这个功能 from langchain.llms import OpenAI from langchain.memory import ConversationEntityMemoryllm OpenAI(temperature0) memory ConversationEntityMemory(llmllm) _input {input: Deven Sam are working on a hackathon project} memory.load_memory_variables(_input) memory.save_context(_input,{output: That sounds like a great project! What kind of project are they working on?} ) memory.load_memory_variables({input: who is Sam})输出 {history: Human: Deven Sam are working on a hackathon project\nAI: That sounds like a great project! What kind of project are they working on?, entities: {Sam: Sam is working on a hackathon project with Deven.}}输入 memory ConversationEntityMemory(llmllm, return_messagesTrue) _input {input: Deven Sam are working on a hackathon project} memory.load_memory_variables(_input) memory.save_context(_input,{output: That sounds like a great project! What kind of project are they working on?} ) memory.load_memory_variables({input: who is Sam})输出 {history: [HumanMessage(contentDeven Sam are working on a hackathon project, additional_kwargs{}), AIMessage(content That sounds like a great project! What kind of project are they working on?, additional_kwargs{})], entities: {Sam: Sam is working on a hackathon project with Deven.}}在链中调用 from langchain.chains import ConversationChain from langchain.memory import ConversationEntityMemory from langchain.memory.prompt import ENTITY_MEMORY_CONVERSATION_TEMPLATE from pydantic import BaseModel from typing import List, Dict, Any conversation ConversationChain(llmllm, verboseTrue,promptENTITY_MEMORY_CONVERSATION_TEMPLATE,memoryConversationEntityMemory(llmllm) )conversation.predict(inputDeven Sam are working on a hackathon project)日志输出 Entering new ConversationChain chain... Prompt after formatting: You are an assistant to a human, powered by a large language model trained by OpenAI.You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.You are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.Context: {Deven: Deven is working on a hackathon project with Sam., Sam: Sam is working on a hackathon project with Deven.}Current conversation:Last line: Human: Deven Sam are working on a hackathon project You: Finished chain.输出 That sounds like a great project! What kind of project are they working on?输入 conversation.memory.entity_store.store输出 {Deven: Deven is working on a hackathon project with Sam, which they are entering into a hackathon., Sam: Sam is working on a hackathon project with Deven.}输入 conversation.predict(inputThey are trying to add more complex memory structures to Langchain)日志输出 Entering new ConversationChain chain... Prompt after formatting: You are an assistant to a human, powered by a large language model trained by OpenAI.You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.You are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.Context: {Deven: Deven is working on a hackathon project with Sam, which they are entering into a hackathon., Sam: Sam is working on a hackathon project with Deven., Langchain: }Current conversation: Human: Deven Sam are working on a hackathon project AI: That sounds like a great project! What kind of project are they working on? Last line: Human: They are trying to add more complex memory structures to Langchain You: Finished chain.输出 That sounds like an interesting project! What kind of memory structures are they trying to add?输入 conversation.predict(inputThey are adding in a key-value store for entities mentioned so far in the conversation.)日志输出 Entering new ConversationChain chain... Prompt after formatting: You are an assistant to a human, powered by a large language model trained by OpenAI.You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.You are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.Context: {Deven: Deven is working on a hackathon project with Sam, which they are entering into a hackathon. They are trying to add more complex memory structures to Langchain., Sam: Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain., Langchain: Langchain is a project that is trying to add more complex memory structures., Key-Value Store: }Current conversation: Human: Deven Sam are working on a hackathon project AI: That sounds like a great project! What kind of project are they working on? Human: They are trying to add more complex memory structures to Langchain AI: That sounds like an interesting project! What kind of memory structures are they trying to add? Last line: Human: They are adding in a key-value store for entities mentioned so far in the conversation. You: Finished chain.输出 That sounds like a great idea! How will the key-value store help with the project?输入 conversation.predict(inputWhat do you know about Deven Sam?)日志输出 Entering new ConversationChain chain... Prompt after formatting: You are an assistant to a human, powered by a large language model trained by OpenAI.You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.You are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.Context: {Deven: Deven is working on a hackathon project with Sam, which they are entering into a hackathon. They are trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation., Sam: Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation.}Current conversation: Human: Deven Sam are working on a hackathon project AI: That sounds like a great project! What kind of project are they working on? Human: They are trying to add more complex memory structures to Langchain AI: That sounds like an interesting project! What kind of memory structures are they trying to add? Human: They are adding in a key-value store for entities mentioned so far in the conversation. AI: That sounds like a great idea! How will the key-value store help with the project? Last line: Human: What do you know about Deven Sam? You: Finished chain.输出 Deven and Sam are working on a hackathon project together, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to be working hard on this project and have a great idea for how the key-value store can help.检查记忆存储 我们也可以直接检查记忆存储。在下面的示例中我们直接查看它然后通过一些添加信息的示例来观察它的变化。 from pprint import pprint pprint(conversation.memory.entity_store.store)输出 {Daimon: Daimon is a company founded by Sam, a successful entrepreneur.,Deven: Deven is working on a hackathon project with Sam, which they are entering into a hackathon. They are trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation, and seem to be working hard on this project with a great idea for how the key-value store can help.,Key-Value Store: A key-value store is being added to the project to store entities mentioned in the conversation.,Langchain: Langchain is a project that is trying to add more complex memory structures, including a key-value store for entities mentioned so far in the conversation.,Sam: Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to have a great idea for how the key-value store can help, and Sam is also the founder of a company called Daimon.}输出 conversation.predict(inputSam is the founder of a company called Daimon.)日志输出 Entering new ConversationChain chain... Prompt after formatting: You are an assistant to a human, powered by a large language model trained by OpenAI.You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.You are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.Context: {Daimon: Daimon is a company founded by Sam, a successful entrepreneur., Sam: Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to have a great idea for how the key-value store can help, and Sam is also the founder of a company called Daimon.}Current conversation: Human: They are adding in a key-value store for entities mentioned so far in the conversation. AI: That sounds like a great idea! How will the key-value store help with the project? Human: What do you know about Deven Sam? AI: Deven and Sam are working on a hackathon project together, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to be working hard on this project and have a great idea for how the key-value store can help. Human: Sam is the founder of a company called Daimon. AI: Thats impressive! It sounds like Sam is a very successful entrepreneur. What kind of company is Daimon? Last line: Human: Sam is the founder of a company called Daimon. You: Finished chain.输出 Thats impressive! It sounds like Sam is a very successful entrepreneur. What kind of company is Daimon?输入 from pprint import pprint pprint(conversation.memory.entity_store.store)输出 {Daimon: Daimon is a company founded by Sam, a successful entrepreneur, who is working on a hackathon project with Deven to add more complex memory structures to Langchain.,Deven: Deven is working on a hackathon project with Sam, which they are entering into a hackathon. They are trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation, and seem to be working hard on this project with a great idea for how the key-value store can help.,Key-Value Store: A key-value store is being added to the project to store entities mentioned in the conversation.,Langchain: Langchain is a project that is trying to add more complex memory structures, including a key-value store for entities mentioned so far in the conversation.,Sam: Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to have a great idea for how the key-value store can help, and Sam is also the founder of a successful company called Daimon.}输入 conversation.predict(inputWhat do you know about Sam?)日志输出 Entering new ConversationChain chain... Prompt after formatting: You are an assistant to a human, powered by a large language model trained by OpenAI.You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.You are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.Context: {Deven: Deven is working on a hackathon project with Sam, which they are entering into a hackathon. They are trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation, and seem to be working hard on this project with a great idea for how the key-value store can help., Sam: Sam is working on a hackathon project with Deven, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to have a great idea for how the key-value store can help, and Sam is also the founder of a successful company called Daimon., Langchain: Langchain is a project that is trying to add more complex memory structures, including a key-value store for entities mentioned so far in the conversation., Daimon: Daimon is a company founded by Sam, a successful entrepreneur, who is working on a hackathon project with Deven to add more complex memory structures to Langchain.}Current conversation: Human: What do you know about Deven Sam? AI: Deven and Sam are working on a hackathon project together, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to be working hard on this project and have a great idea for how the key-value store can help. Human: Sam is the founder of a company called Daimon. AI: Thats impressive! It sounds like Sam is a very successful entrepreneur. What kind of company is Daimon? Human: Sam is the founder of a company called Daimon. AI: Thats impressive! It sounds like Sam is a very successful entrepreneur. What kind of company is Daimon? Last line: Human: What do you know about Sam? You: Finished chain.输出 Sam is the founder of a successful company called Daimon. He is also working on a hackathon project with Deven to add more complex memory structures to Langchain. They seem to have a great idea for how the key-value store can help.参考文献 [1] LangChain官方网站https://www.langchain.com/ [2] LangChain ️ 中文网跟着LangChain一起学LLM/GPT开发https://www.langchain.com.cn/ [3] LangChain中文网 - LangChain 是一个用于开发由语言模型驱动的应用程序的框架http://www.cnlangchain.com/
http://www.zqtcl.cn/news/818745/

相关文章:

  • 诸城网站建设费用网站建设便捷
  • 丰台网站建设联系方式全屋定制十大名牌口碑
  • mip网站模板中国建设集团门户网站
  • 笑话 语录用什么网站做搜一搜百度
  • 合肥网站建设新闻营销影视类网站建设
  • 焦作有网站建设公司c 转网站开发
  • 化妆品网站建设报告邯郸在哪个省
  • 自建网站怎么做后台管理系统世界网站流量排名
  • 我做外贸要开国际网站吗官方网站下载微博
  • 佛山专业建设网站网页模板是什么
  • 网站描述标签怎么写wordpress首页图标
  • 做系统去哪个网站好好玩又不用实名认证的游戏
  • 仿帝国网站源码wordpress主题idown
  • 大型网站开发php框架seo全站优化全案例
  • wordpress收录优化做抖音seo用哪些软件
  • DW怎么做招聘网站重庆有什么好玩的
  • 网站建设的网络公司百度官方app下载
  • 医疗电子科技网站建设站群 网站如何做
  • 汇邦团建网站谁做的钢结构招聘网
  • 如何制作一个动态的网站的登录详细步骤页面网站炫酷首页
  • 网站建设找星火龙网站开发 在线支付
  • 如何在公司网站下设置邮箱自己开发一个app要多少钱
  • 珠海市横琴新区建设环保局网站做catia数据的网站
  • 珠海pc网站建设wordpress子主题安全
  • 布吉企业网站建设网站维护与建设内容
  • 专业图书商城网站建设七初SEO网站建设
  • 南通公司网站模板建站wordpress设置主页
  • 小企业网站建设哪找广州app开发平台
  • 建设部国家标准网站免费网站建设 免备案
  • 网站后台批量上传图片ue5培训机构哪家强