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

鑫鼎信长春网站建设wordpress 相册模板

鑫鼎信长春网站建设,wordpress 相册模板,thinkphp wordpress,投标网站怎么做分类目录#xff1a;《大模型从入门到应用》总目录 代理执行器接受一个代理和工具#xff0c;并使用代理来决定调用哪些工具以及以何种顺序调用。本文将参数如何结合使用Agent和VectorStore。这种用法是将数据加载到VectorStore中#xff0c;并希望以Agent的方式与之进行交互…分类目录《大模型从入门到应用》总目录 代理执行器接受一个代理和工具并使用代理来决定调用哪些工具以及以何种顺序调用。本文将参数如何结合使用Agent和VectorStore。这种用法是将数据加载到VectorStore中并希望以Agent的方式与之进行交互。 推荐的方法是创建一个RetrievalQA然后将其作为整体Agent中的工具来使用。让我们在下面看一下如何实现我们可以使用多个不同的vectordbs将Agent作为它们之间的路由器。有两种不同的方法可以实现这一点 让Agent像正常工具一样使用vectorstores设置return_directTrue来将Agent真正用作路由 创建VectorStore from langchain.embeddings.openai import OpenAIEmbeddings from langchain.vectorstores import Chroma from langchain.text_splitter import CharacterTextSplitter from langchain.llms import OpenAI from langchain.chains import RetrievalQA llm OpenAI(temperature0) from pathlib import Path relevant_parts [] for p in Path(.).absolute().parts:relevant_parts.append(p)if relevant_parts[-3:] [langchain, docs, modules]:break doc_path str(Path(*relevant_parts) / state_of_the_union.txt) from langchain.document_loaders import TextLoader loader TextLoader(doc_path) documents loader.load() text_splitter CharacterTextSplitter(chunk_size1000, chunk_overlap0) texts text_splitter.split_documents(documents)embeddings OpenAIEmbeddings() docsearch Chroma.from_documents(texts, embeddings, collection_namestate-of-union)日志输出 Running Chroma using direct local API. Using DuckDB in-memory for database. Data will be transient. state_of_union RetrievalQA.from_chain_type(llmllm, chain_typestuff, retrieverdocsearch.as_retriever())输入 from langchain.document_loaders import WebBaseLoader loader WebBaseLoader(https://beta.ruff.rs/docs/faq/) docs loader.load() ruff_texts text_splitter.split_documents(docs) ruff_db Chroma.from_documents(ruff_texts, embeddings, collection_nameruff) ruff RetrievalQA.from_chain_type(llmllm, chain_typestuff, retrieverruff_db.as_retriever())日志输出 Running Chroma using direct local API. Using DuckDB in-memory for database. Data will be transient.创建代理 # Import things that are needed generically from langchain.agents import initialize_agent, Tool from langchain.agents import AgentType from langchain.tools import BaseTool from langchain.llms import OpenAI from langchain import LLMMathChain, SerpAPIWrapper tools [Tool(name State of Union QA System,funcstate_of_union.run,descriptionuseful for when you need to answer questions about the most recent state of the union address. Input should be a fully formed question.),Tool(name Ruff QA System,funcruff.run,descriptionuseful for when you need to answer questions about ruff (a python linter). Input should be a fully formed question.), ] # Construct the agent. We will use the default agent type here. # See documentation for a full list of options. agent initialize_agent(tools, llm, agentAgentType.ZERO_SHOT_REACT_DESCRIPTION, verboseTrue) agent.run(What did biden say about ketanji brown jackson in the state of the union address?)日志输出 Entering new AgentExecutor chain... I need to find out what Biden said about Ketanji Brown Jackson in the State of the Union address. Action: State of Union QA System Action Input: What did Biden say about Ketanji Brown Jackson in the State of the Union address? Observation: Biden said that Jackson is one of the nations top legal minds and that she will continue Justice Breyers legacy of excellence. Thought:I now know the final answer Final Answer: Biden said that Jackson is one of the nations top legal minds and that she will continue Justice Breyers legacy of excellence.Finished chain.输出 Biden said that Jackson is one of the nations top legal minds and that she will continue Justice Breyers legacy of excellence.输入 agent.run(Why use ruff over flake8?)输出 Entering new AgentExecutor chain... I need to find out the advantages of using ruff over flake8 Action: Ruff QA System Action Input: What are the advantages of using ruff over flake8? Observation: Ruff can be used as a drop-in replacement for Flake8 when used (1) without or with a small number of plugins, (2) alongside Black, and (3) on Python 3 code. It also re-implements some of the most popular Flake8 plugins and related code quality tools natively, including isort, yesqa, eradicate, and most of the rules implemented in pyupgrade. Ruff also supports automatically fixing its own lint violations, which Flake8 does not. Thought:I now know the final answer Final Answer: Ruff can be used as a drop-in replacement for Flake8 when used (1) without or with a small number of plugins, (2) alongside Black, and (3) on Python 3 code. It also re-implements some of the most popular Flake8 plugins and related code quality tools natively, including isort, yesqa, eradicate, and most of the rules implemented in pyupgrade. Ruff also supports automatically fixing its own lint violations, which Flake8 does not.Finished chain.输出 Ruff can be used as a drop-in replacement for Flake8 when used (1) without or with a small number of plugins, (2) alongside Black, and (3) on Python 3 code. It also re-implements some of the most popular Flake8 plugins and related code quality tools natively, including isort, yesqa, eradicate, and most of the rules implemented in pyupgrade. Ruff also supports automatically fixing its own lint violations, which Flake8 does not.仅将Agent用作路由器 如果我们打算将Agent用作路由并且只想直接返回RetrievalQAChain的结果我们还可以设置return_directTrue。 需要注意的是在上面的示例中Agent在查询RetrievalQAChain之后还做了一些额外的工作我们可以避免这样做直接返回结果。 tools [Tool(name State of Union QA System,funcstate_of_union.run,descriptionuseful for when you need to answer questions about the most recent state of the union address. Input should be a fully formed question.,return_directTrue),Tool(name Ruff QA System,funcruff.run,descriptionuseful for when you need to answer questions about ruff (a python linter). Input should be a fully formed question.,return_directTrue), ] agent initialize_agent(tools, llm, agentAgentType.ZERO_SHOT_REACT_DESCRIPTION, verboseTrue) agent.run(What did biden say about ketanji brown jackson in the state of the union address?)日志输出 Entering new AgentExecutor chain... I need to find out what Biden said about Ketanji Brown Jackson in the State of the Union address. Action: State of Union QA System Action Input: What did Biden say about Ketanji Brown Jackson in the State of the Union address? Observation: Biden said that Jackson is one of the nations top legal minds and that she will continue Justice Breyers legacy of excellence.Finished chain.输出 Biden said that Jackson is one of the nations top legal minds and that she will continue Justice Breyers legacy of excellence.输入 agent.run(Why use ruff over flake8?)日志输出 Entering new AgentExecutor chain... I need to find out the advantages of using ruff over flake8 Action: Ruff QA System Action Input: What are the advantages of using ruff over flake8? Observation: Ruff can be used as a drop-in replacement for Flake8 when used (1) without or with a small number of plugins, (2) alongside Black, and (3) on Python 3 code. It also re-implements some of the most popular Flake8 plugins and related code quality tools natively, including isort, yesqa, eradicate, and most of the rules implemented in pyupgrade. Ruff also supports automatically fixing its own lint violations, which Flake8 does not.Finished chain.输出 Ruff can be used as a drop-in replacement for Flake8 when used (1) without or with a small number of plugins, (2) alongside Black, and (3) on Python 3 code. It also re-implements some of the most popular Flake8 plugins and related code quality tools natively, including isort, yesqa, eradicate, and most of the rules implemented in pyupgrade. Ruff also supports automatically fixing its own lint violations, which Flake8 does not.多跳向量存储推理 由于vectorstores可以很容易地作为Agent中的工具使用因此可以轻松使用现有的Agent框架回答依赖于vectorstores的多跳问题。 tools [Tool(name State of Union QA System,funcstate_of_union.run,descriptionuseful for when you need to answer questions about the most recent state of the union address. Input should be a fully formed question, not referencing any obscure pronouns from the conversation before.),Tool(name Ruff QA System,funcruff.run,descriptionuseful for when you need to answer questions about ruff (a python linter). Input should be a fully formed question, not referencing any obscure pronouns from the conversation before.), ] # Construct the agent. We will use the default agent type here. # See documentation for a full list of options. agent initialize_agent(tools, llm, agentAgentType.ZERO_SHOT_REACT_DESCRIPTION, verboseTrue) agent.run(What tool does ruff use to run over Jupyter Notebooks? Did the president mention that tool in the state of the union?)日志输出 Entering new AgentExecutor chain... I need to find out what tool ruff uses to run over Jupyter Notebooks, and if the president mentioned it in the state of the union. Action: Ruff QA System Action Input: What tool does ruff use to run over Jupyter Notebooks? Observation: Ruff is integrated into nbQA, a tool for running linters and code formatters over Jupyter Notebooks. After installing ruff and nbqa, you can run Ruff over a notebook like so: nbqa ruff Untitled.ipynb Thought:I now need to find out if the president mentioned this tool in the state of the union. Action: State of Union QA System Action Input: Did the president mention nbQA in the state of the union? Observation: No, the president did not mention nbQA in the state of the union. Thought:I now know the final answer. Final Answer: No, the president did not mention nbQA in the state of the union.Finished chain.输出 No, the president did not mention nbQA in the state of the union.参考文献 [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.hkea.cn/news/14553944/

相关文章:

  • 建设个直播网站要多少钱建立网站难吗
  • 快速做网站的技术wordpress wp super
  • 制作一个网站怎么做的wordpress首页生成静态
  • 科技公司建设网站公司餐饮 网站模板
  • 海关申报网站怎么做建站行业获客
  • c 网站开发模板批量修改wordpress文章分类目录
  • 网站 支持建设单位十六局门户网
  • 湛江网站建设方案服务小程序开发公司简介
  • 移动端的网站建设s吗网站虚拟主机
  • 网站搭建思路二级域名网站可以做360推广
  • 百度地图网站开发自己写的网页怎么发布到网上
  • 什么是cms网站系统怎样注册电商平台成为卖家
  • 物流网站建设方案范文域名被锁定网站打不开怎么办
  • 怎样建设手机网站域名主机网站导航
  • 网站首页优化的目的用户中心wordpress
  • 什么网站系统好无锡app定制
  • 哪个网站能帮助做试卷wordpress 邮件
  • 坐什么网站能用到html5网站开发怎么收费
  • 平台网站功能潍坊做网站潍坊做网站
  • 怎么网站wordpress中category参数
  • 城市建设网站鹤岗市免费注册126免费邮箱
  • 深圳市住房城乡建设局网站wordpress版本降级
  • 个人作品网站怎么做友汇网网站建设管理后台网站
  • 无锡网站建设哪家好惠州网站建设设计
  • 最优做网站裙晖wordpress
  • 学校网站建设小组及分工吃什么补肾最快
  • 手机网站 手机app在哪里建网站免费
  • 网站开发工具.枫子科技网络推广的目标
  • 厂家网站怎么做做seo的网站有那些
  • 手机wap网站模板免费下载天美影视传媒有限公司