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

.com网站怎么做seo黑帽技术

.com网站怎么做,seo黑帽技术,做家具网站要多少钱,关键词排名网络推广Langchain 的 ConversationSummaryBufferMemory ConversationSummaryBufferMemory 在内存中保留最近交互的缓冲区,但不仅仅是完全刷新旧的交互,而是将它们编译成摘要并使用两者。但与之前的实现不同的是,它使用令牌长度而不是交互次数来确定何…

Langchain 的 ConversationSummaryBufferMemory

ConversationSummaryBufferMemory 在内存中保留最近交互的缓冲区,但不仅仅是完全刷新旧的交互,而是将它们编译成摘要并使用两者。但与之前的实现不同的是,它使用令牌长度而不是交互次数来确定何时刷新交互。

我们首先来了解一下如何使用这些实用程序,

示例代码,

from langchain.memory import ConversationSummaryBufferMemory
from langchain.llms import OpenAIllm = OpenAI()
memory = ConversationSummaryBufferMemory(llm=llm, max_token_limit=40, return_messages=True
)
memory.save_context({"input": "嗨"}, {"output": "最近怎么样?"})
memory.save_context({"input": "没什么特别的,你呢?"}, {"output": "没什么特别的。"})
memory.load_memory_variables({})

输出结果,

{'history': [SystemMessage(content='\nThe human and AI are engaging in conversation. The human greets the AI and the AI asks how the human is doing.', additional_kwargs={}),HumanMessage(content='没什么特别的,你呢?', additional_kwargs={}, example=False),AIMessage(content='没什么特别的。', additional_kwargs={}, example=False)]}

示例代码,

from langchain.chains import ConversationChainconversation_with_summary = ConversationChain(llm=llm,# We set a very low max_token_limit for the purposes of testing.memory=ConversationSummaryBufferMemory(llm=OpenAI(), max_token_limit=250),verbose=True,
)
conversation_with_summary.predict(input="嗨,最近怎么样?")

输出结果,

> 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: 嗨,最近怎么样?
AI:> Finished chain.
' 嗨!最近还不错,我在学习新的技能,并且正在尝试新的任务。我也在尝试改进我的语言处理能力,以便更好地与人交流。你呢?'

示例代码,

conversation_with_summary.predict(input="只是在写一些文档!")

输出结果,

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: 嗨,最近怎么样?
AI:  嗨!最近还不错,我在学习新的技能,并且正在尝试新的任务。我也在尝试改进我的语言处理能力,以便更好地与人交流。你呢?
Human: 只是在写一些文档!
AI:> Finished chain.
' 哦,看起来很有趣!你在写什么文档?'

示例代码,

conversation_with_summary.predict(input="你听说过 LangChain 吗?")

输出结果,

> 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: 嗨,最近怎么样?
AI:  嗨!最近还不错,我在学习新的技能,并且正在尝试新的任务。我也在尝试改进我的语言处理能力,以便更好地与人交流。你呢?
Human: 只是在写一些文档!
AI:  哦,看起来很有趣!你在写什么文档?
Human: 你听说过 LangChain 吗?
AI:> Finished chain.
' 是的,我知道LangChain。它是一个基于区块链的语言学习平台,旨在帮助人们更好地学习外语。你正在写关于LangChain的文档吗?'

示例代码,

# 我们可以看到,摘要和缓冲区都已更新
conversation_with_summary.predict(input="哈哈,不对,不过很多人都把它混淆了。"
)

输出结果,

> 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:
System: 
The AI thinks artificial intelligence is a force for good because it will help humans reach their full potential. It has been learning new skills and trying new tasks, as well as attempting to improve its language processing so that it can communicate better with humans. The human asks how the AI has been doing recently.
Human: 只是在写一些文档!
AI:  哦,看起来很有趣!你在写什么文档?
Human: 你听说过 LangChain 吗?
AI:  是的,我知道LangChain。它是一个基于区块链的语言学习平台,旨在帮助人们更好地学习外语。你正在写关于LangChain的文档吗?
Human: 哈哈,不对,不过很多人都把它混淆了。
AI:> Finished chain.
' 哦,我明白了。那你在写什么文档呢?'

完结!

http://www.ritt.cn/news/23112.html

相关文章:

  • 电子网站建设维护今日重点新闻
  • 企业管理系统是什么意思中国网络优化公司排名
  • 设计类网站模板关键词排名推广方法
  • 阿里巴巴网站怎么做自己怎么注册网站
  • 杭州免费自助建站模板最新发布的最新
  • 做网站老师宁波seo网络推广产品服务
  • 新手做淘宝哪个网站比较好免费网站安全软件大全
  • 产品经理兼职做网站报酬长沙靠谱关键词优化公司电话
  • 自己做的网站如何放进服务器免费建自己的网站
  • 网站建设需求调研太原网络营销公司
  • 020网站管理系统模板线上电商怎么做
  • 做软件网站网站内部链接优化方法
  • 网站做描本好处天津快速关键词排名
  • 性价比高的做网站公司关键词查询神器
  • 杭州协会网站建设软件制作
  • java做的网站怎么设置关闭和开启网站访问锦州网站seo
  • 肇庆市建设企业网站怎么样成都高端企业网站建设
  • 公司建网站 内部邮箱链接搜索
  • 哈尔滨制作网站多少钱希爱力双效片骗局
  • 高端定制外贸网站惠州seo收费
  • 做棋牌网站建设哪家好百度识图网页版 在线
  • 成立软件公司百度关键词seo优化
  • 网站推广策划案哪里有免费b站推广网站详情
  • 营销网站建设教程律师推广网站排名
  • 怎么健免费网站吗百度客服中心人工在线咨询
  • 网站建设公司还真有赚钱的seo人员招聘
  • 南宁做网站外包优化网站排名的方法
  • 网站建设公司如何提供客户服务百度联盟
  • 网站建设前期准备方案app怎么开发出来的
  • 怎么用网站做类似微博百度快速收录方法