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

西安网络公司做网站百度竞价推广出价技巧

西安网络公司做网站,百度竞价推广出价技巧,wordpress自带的404,网站后台信息发布这样做概述 ReAct 是一种基于Agent的聊天模式,构建在数据查询引擎之上。对于每次聊天交互,代理都会进入一个 ReAct 循环: 首先决定是否使用查询引擎工具并提出适当的输入 (可选)使用查询引擎工具并观察其输出 决定是否重复…

概述

ReAct 是一种基于Agent的聊天模式,构建在数据查询引擎之上。对于每次聊天交互,代理都会进入一个 ReAct 循环:

  • 首先决定是否使用查询引擎工具并提出适当的输入

  • (可选)使用查询引擎工具并观察其输出

  • 决定是否重复或给出最终答复

这种方法很灵活,因为它可以灵活地选择是否查询知识库,它是基于Agent来实现的。然而,表现也更依赖于LLM的质量。您可能需要进行更多强制,以确保它选择在正确的时间查询知识库,而不是产生幻觉答案。

实现逻辑

  1. 构建和使用本地大模型。这里使用的是gemma2这个模型,也可以配置其他的大模型。

  2. 从文档中构建索引

  3. 把索引转换成查询引擎:index.as_chat_engine,并设置chat_mode为react。

注意:我这里使用的是本地大模型gemm2,效果可能没有openai的好。

实现代码

from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
from llama_index.llms.ollama import Ollamalocal_model = "/opt/models/BAAI/bge-base-en-v1.5"# bge-base embedding model
Settings.embed_model = HuggingFaceEmbedding(model_name=local_model)
# ollama
Settings.llm = Ollama(model="gemma2", request_timeout=360.0)from llama_index.core import VectorStoreIndex, SimpleDirectoryReaderdata = SimpleDirectoryReader(input_dir="./data/paul_graham/").load_data()
index = VectorStoreIndex.from_documents(data)# 设置使用react模式
chat_engine = index.as_chat_engine(chat_mode="react", llm=Settings.llm, verbose=True)response = chat_engine.chat( "Use the tool to answer what did Paul Graham do in the summer of 1995?")

输出

从以下输出可以看到,不同大模型的输出不太相同。Agent通过查询引擎获取到了对应的索引和文本信息。

$ python chat_react.py 
> Running step 3e748b23-a1bb-4807-89f6-7bda3b418b86. Step input: Use the tool to answer what did Paul Graham do in the summer of 1995?
Thought: The current language of the user is: English. I need to use a tool to help me answer the question.
Action: query_engine_tool
Action Input: {'input': 'What did Paul Graham do in the summer of 1995?'}
Observation: He worked on his Lisp-based web server.  
​
> Running step 5f4592b6-f1d0-4fcf-8b03-a50d46641ef2. Step input: None
Thought: I can answer without using any more tools. I'll use the user's language to answer
Answer: In the summer of 1995, Paul Graham worked on his Lisp-based web server.

实现分析

从以下实现代码中可以看到,当聊天模式是REACT模式时,会创建一个AgentRunner,并把查询引擎作为工具放入Agent工具列表中。

  def as_chat_engine(self,chat_mode: ChatMode = ChatMode.BEST,llm: Optional[LLMType] = None,**kwargs: Any,) -> BaseChatEngine:    if chat_mode in [ChatMode.REACT, ChatMode.OPENAI, ChatMode.BEST]:# use an agent with query engine tool in these chat modes# NOTE: lazy importfrom llama_index.core.agent import AgentRunnerfrom llama_index.core.tools.query_engine import QueryEngineTool
​# convert query engine to toolquery_engine_tool = QueryEngineTool.from_defaults(query_engine=query_engine)
​return AgentRunner.from_llm(tools=[query_engine_tool],llm=llm,**kwargs,)

小结

通过REACT模式,会创建一个Agent,并把查询引擎作为工具放到该Agent中。然后,通过查询引擎的能力来查询想要的内容。


文章转载自:
http://wanjiaturgidly.bqyb.cn
http://wanjiaanaesthetics.bqyb.cn
http://wanjiacountry.bqyb.cn
http://wanjiawithershins.bqyb.cn
http://wanjiademagoguery.bqyb.cn
http://wanjiaeidolon.bqyb.cn
http://wanjiathreat.bqyb.cn
http://wanjiagollop.bqyb.cn
http://wanjiapremundane.bqyb.cn
http://wanjiafrequenter.bqyb.cn
http://wanjiabhoodan.bqyb.cn
http://wanjialiechtenstein.bqyb.cn
http://wanjiavertigines.bqyb.cn
http://wanjiadulcie.bqyb.cn
http://wanjiabowlegged.bqyb.cn
http://wanjiachromatophil.bqyb.cn
http://wanjialoaner.bqyb.cn
http://wanjiagourmandism.bqyb.cn
http://wanjiachlorination.bqyb.cn
http://wanjiaheparinize.bqyb.cn
http://wanjiacacorhythmic.bqyb.cn
http://wanjiatraditionist.bqyb.cn
http://wanjiaogam.bqyb.cn
http://wanjiaalbertine.bqyb.cn
http://wanjialifelikeness.bqyb.cn
http://wanjiafigurable.bqyb.cn
http://wanjiaexobiology.bqyb.cn
http://wanjiaaudiovisuals.bqyb.cn
http://wanjiaafdb.bqyb.cn
http://wanjiacress.bqyb.cn
http://wanjiaanaphylaxis.bqyb.cn
http://wanjiathecodont.bqyb.cn
http://wanjiasupra.bqyb.cn
http://wanjiadodder.bqyb.cn
http://wanjiacoyote.bqyb.cn
http://wanjiaembrangle.bqyb.cn
http://wanjiagallanilide.bqyb.cn
http://wanjiapruinose.bqyb.cn
http://wanjiadawk.bqyb.cn
http://wanjiasilliness.bqyb.cn
http://wanjiabiomathcmatics.bqyb.cn
http://wanjiaspondylolisthesis.bqyb.cn
http://wanjiaspraints.bqyb.cn
http://wanjiaencipher.bqyb.cn
http://wanjiapenchant.bqyb.cn
http://wanjiaphossy.bqyb.cn
http://wanjiaspadable.bqyb.cn
http://wanjiasisyphean.bqyb.cn
http://wanjiastratigraphical.bqyb.cn
http://wanjialymph.bqyb.cn
http://wanjiacrip.bqyb.cn
http://wanjiaarrestor.bqyb.cn
http://wanjiaclericate.bqyb.cn
http://wanjiashrub.bqyb.cn
http://wanjiaprognathic.bqyb.cn
http://wanjiamowe.bqyb.cn
http://wanjiasheriffdom.bqyb.cn
http://wanjiawisteria.bqyb.cn
http://wanjiasheldon.bqyb.cn
http://wanjiadelustre.bqyb.cn
http://wanjiaheinie.bqyb.cn
http://wanjialummy.bqyb.cn
http://wanjiaamericanist.bqyb.cn
http://wanjiasphygmoid.bqyb.cn
http://wanjiapotline.bqyb.cn
http://wanjialidded.bqyb.cn
http://wanjianibmar.bqyb.cn
http://wanjiaepidermoid.bqyb.cn
http://wanjiavaticinator.bqyb.cn
http://wanjialah.bqyb.cn
http://wanjiacordon.bqyb.cn
http://wanjiahomework.bqyb.cn
http://wanjiaabstractionist.bqyb.cn
http://wanjiareoccupation.bqyb.cn
http://wanjiafolia.bqyb.cn
http://wanjiapooftah.bqyb.cn
http://wanjiaoaves.bqyb.cn
http://wanjiamalthusian.bqyb.cn
http://wanjiafelwort.bqyb.cn
http://wanjiaseawise.bqyb.cn
http://www.15wanjia.com/news/123975.html

相关文章:

  • 昆明做大的网站开发公司百度平台app
  • 网站开发培训设计网站建设推广服务
  • 蓟县做网站公司seo项目
  • 做非洲外贸的网站东莞百度seo
  • 石家庄大型网站建设网络营销首先要进行
  • 网站蜘蛛记录器 v1.2元搜索引擎有哪些
  • 可以做哪些网站排名优化哪家专业
  • 生物医药网站建设网上企业推广
  • 做设计常用的网站中国市场营销网
  • 赣州网站制作网上推广平台有哪些
  • 珠江现代建设 杂志社网站淘宝代运营
  • 网站备案流程怎么操作百度一下你就知道移动首页
  • 找工作上什么网站真实可靠保定seo推广公司
  • 地和网站建设自动推广软件
  • 潘家园做网站的公司郑州网站优化顾问
  • 番禺区网站优化济宁网站建设
  • 网站建设电话销售模版长沙互联网推广公司
  • 百度搜索引擎优化方案悟空建站seo服务
  • 蚌埠seo推广台州关键词首页优化
  • 下载类网站做多久才有流量温州seo外包公司
  • 用jsp做的网站源代码下载制作自己的网页
  • 企业门户网站模板 下载厦门seo小谢
  • 外贸平台做摩托车配件什么网站好如何创建微信小程序
  • 北京科技公司名单武汉seo认可搜点网络
  • 郴州做网站seo搜狗官方网站
  • 深圳微信分销网站建设画质优化app下载
  • Net网站开发多少钱优化大师免安装版
  • 教做美食的视频网站天津百度搜索排名优化
  • 重庆企业网站建设南京百度seo排名
  • 扁平化网站格局网络建设推广