微餐饮网站建设官网wordpress网标

bicheng/2025/10/14 16:53:11/文章来源:
微餐饮网站建设官网,wordpress网标,淄博中企动力,做一个app大概需要多少费用检索增强生成(RAG)已成为增强大型语言模型(LLM)能力的一种强大技术。通过从知识来源中检索相关信息并将其纳入提示#xff0c;RAG为LLM提供了有用的上下文#xff0c;以产生基于事实的输出。 但是现有的单代理RAG系统面临着检索效率低下、高延迟和次优提示的挑战。这些问题在…检索增强生成(RAG)已成为增强大型语言模型(LLM)能力的一种强大技术。通过从知识来源中检索相关信息并将其纳入提示RAG为LLM提供了有用的上下文以产生基于事实的输出。 但是现有的单代理RAG系统面临着检索效率低下、高延迟和次优提示的挑战。这些问题在限制了真实世界的RAG性能。多代理体系结构提供了一个理想的框架来克服这些挑战并释放RAG的全部潜力。通过划分职责多代理系统允许专门的角色、并行执行和优化协作。 单代理RAG 当前的RAG系统使用单个代理来处理完整的工作流程——查询分析、段落检索、排序、摘要和提示增强。 这种单一的方法提供了一个简单的一体化解决方案。但是对每个任务依赖一个代理会导致瓶颈。代理会浪费时间从大量语料库中检索无关紧要的段落。长上下文的总结很糟糕并且提示无法以最佳方式集成原始问题和检索到的信息。 这些低效率严重限制了实时应用程序的RAG的可伸缩性和速度。 多代理RAG 多代理体系结构可以克服单代理的限制。通过将RAG划分为并发执行的模块化角色可以实现: 检索专用检索代理专注于使用优化的搜索技术进行有效的通道检索。这将最小化延迟。 搜索通过排除检索因素搜索可以在检索代理之间并行化以减少等待时间。 排名单独的排名代理评估检索的丰富度特异性和其他相关信号的传代。这将过滤最大的相关性。 总结将冗长的上下文总结成简洁的片段只包含最重要的事实。 优化提示动态调整原始提示和检索信息的集成。 灵活的体系可以替换和添加代理来定制系统。可视化工具代理可以提供对工作流的洞察。 通过将RAG划分为专门的协作角色多代理系统增强了相关性减少了延迟并优化了提示。这将解锁可伸缩的高性能RAG。 划分职责允许检索代理结合互补技术如向量相似性、知识图谱和互联网抓取。这种多信号方法允许检索捕获相关性不同方面的不同内容。 通过在代理之间协作分解检索和排序可以从不同的角度优化相关性。结合阅读和编排代理它支持可伸缩的多角度RAG。 模块化架构允许工程师跨专门代理组合不同的检索技术。 Llama index的多代理 RAG Llama index概述了使用多代理RAG的具体示例: 文档代理——在单个文档中执行QA和摘要。 向量索引——为每个文档代理启用语义搜索。 摘要索引——允许对每个文档代理进行摘要。 高阶TOP-LEVEL代理——编排文档代理以使用工具检索回答跨文档的问题。 对于多文档QA比单代理RAG基线显示出真正的优势。由顶级代理协调的专门文档代理提供基于特定文档的更集中、更相关的响应。 下面我们看看Llama index是如何实现的 我们将下载关于不同城市的Wikipedia文章。每篇文章都是单独存储的。我们只找了18个城市虽然不是很大但是这已经可以很好的演示高级文档检索的功能。 from llama_index import (VectorStoreIndex,SummaryIndex,SimpleKeywordTableIndex,SimpleDirectoryReader,ServiceContext,)from llama_index.schema import IndexNodefrom llama_index.tools import QueryEngineTool, ToolMetadatafrom llama_index.llms import OpenAI下面是城市的列表 wiki_titles [Toronto,Seattle,Chicago,Boston,Houston,Tokyo,Berlin,Lisbon,Paris,London,Atlanta,Munich,Shanghai,Beijing,Copenhagen,Moscow,Cairo,Karachi,]下面是下载每个城市文档代码 from pathlib import Pathimport requestsfor title in wiki_titles:response requests.get(https://en.wikipedia.org/w/api.php,params{action: query,format: json,titles: title,prop: extracts,# exintro: True,explaintext: True,},).json()page next(iter(response[query][pages].values()))wiki_text page[extract]data_path Path(data)if not data_path.exists():Path.mkdir(data_path)with open(data_path / f{title}.txt, w) as fp:fp.write(wiki_text)加载下载的文档 # Load all wiki documentscity_docs {}for wiki_title in wiki_titles:city_docs[wiki_title] SimpleDirectoryReader(input_files[fdata/{wiki_title}.txt]).load_data()定义LLM 上下文回调管理器 llm OpenAI(temperature0, modelgpt-3.5-turbo)service_context ServiceContext.from_defaults(llmllm)我们为每个文档定义“文档代理”为每个文档定义向量索引(用于语义搜索)和摘要索引(用于摘要)。然后将这两个查询引擎转换为传递给OpenAI函数调用工具。 文档代理可以动态选择在给定文档中执行语义搜索或摘要。我们为每个城市创建一个单独的文档代理。 from llama_index.agent import OpenAIAgentfrom llama_index import load_index_from_storage, StorageContextfrom llama_index.node_parser import SimpleNodeParserimport osnode_parser SimpleNodeParser.from_defaults()# Build agents dictionaryagents {}query_engines {}# this is for the baselineall_nodes []for idx, wiki_title in enumerate(wiki_titles):nodes node_parser.get_nodes_from_documents(city_docs[wiki_title])all_nodes.extend(nodes)if not os.path.exists(f./data/{wiki_title}):# build vector indexvector_index VectorStoreIndex(nodes, service_contextservice_context)vector_index.storage_context.persist(persist_dirf./data/{wiki_title})else:vector_index load_index_from_storage(StorageContext.from_defaults(persist_dirf./data/{wiki_title}),service_contextservice_context,)# build summary indexsummary_index SummaryIndex(nodes, service_contextservice_context)# define query enginesvector_query_engine vector_index.as_query_engine()summary_query_engine summary_index.as_query_engine()# define toolsquery_engine_tools [QueryEngineTool(query_enginevector_query_engine,metadataToolMetadata(namevector_tool,description(Useful for questions related to specific aspects off {wiki_title} (e.g. the history, arts and culture, sports, demographics, or more).),),),QueryEngineTool(query_enginesummary_query_engine,metadataToolMetadata(namesummary_tool,description(Useful for any requests that require a holistic summaryf of EVERYTHING about {wiki_title}. For questions about more specific sections, please use the vector_tool.),),),]# build agentfunction_llm OpenAI(modelgpt-4)agent OpenAIAgent.from_tools(query_engine_tools,llmfunction_llm,verboseTrue,system_promptf\You are a specialized agent designed to answer queries about {wiki_title}.You must ALWAYS use at least one of the tools provided when answering a question; do NOT rely on prior knowledge.\,)agents[wiki_title] agentquery_engines[wiki_title] vector_index.as_query_engine(similarity_top_k2)下面就是高阶代理它可以跨不同的文档代理进行编排回答任何用户查询。 高阶代理可以将所有文档代理作为工具执行检索。这里我们使用top-k检索器但最好的方法是根据我们的需求进行自定义检索。 # define tool for each document agentall_tools []for wiki_title in wiki_titles:wiki_summary (fThis content contains Wikipedia articles about {wiki_title}. Usef this tool if you want to answer any questions about {wiki_title}.\n)doc_tool QueryEngineTool(query_engineagents[wiki_title],metadataToolMetadata(nameftool_{wiki_title},descriptionwiki_summary,),)all_tools.append(doc_tool)# define an object index and retriever over these toolsfrom llama_index import VectorStoreIndexfrom llama_index.objects import ObjectIndex, SimpleToolNodeMappingtool_mapping SimpleToolNodeMapping.from_objects(all_tools)obj_index ObjectIndex.from_objects(all_tools,tool_mapping,VectorStoreIndex,)from llama_index.agent import FnRetrieverOpenAIAgenttop_agent FnRetrieverOpenAIAgent.from_retriever(obj_index.as_retriever(similarity_top_k3),system_prompt \You are an agent designed to answer queries about a set of given cities.Please always use the tools provided to answer a question. Do not rely on prior knowledge.\,verboseTrue,)作为比较我们定义了一个“简单”的RAG管道它将所有文档转储到单个矢量索引集合中。设置top_k 4 base_index VectorStoreIndex(all_nodes)base_query_engine base_index.as_query_engine(similarity_top_k4)让我们运行一些示例查询对比单个文档的QA /摘要到多个文档的QA /摘要。 response top_agent.query(Tell me about the arts and culture in Boston)结果如下 Calling Function Calling function: tool_Boston with args: {input: arts and culture} Calling Function Calling function: vector_tool with args: {input: arts and culture}Got output: Boston is known for its vibrant arts and culture scene. The city is home to a number of performing arts organizations, including the Boston Ballet, Boston Lyric Opera Company, Opera Boston, Boston Baroque, and the Handel and Haydn Society. There are also several theaters in or near the Theater District, such as the Cutler Majestic Theatre, Citi Performing Arts Center, the Colonial Theater, and the Orpheum Theatre. Boston is a center for contemporary classical music, with groups like the Boston Modern Orchestra Project and Boston Musica Viva. The city also hosts major annual events, such as First Night, the Boston Early Music Festival, and the Boston Arts Festival. In addition, Boston has several art museums and galleries, including the Museum of Fine Arts, the Isabella Stewart Gardner Museum, and the Institute of Contemporary Art.Got output: Boston is renowned for its vibrant arts and culture scene. It is home to numerous performing arts organizations, including the Boston Ballet, Boston Lyric Opera Company, Opera Boston, Boston Baroque, and the Handel and Haydn Society. The citys Theater District houses several theaters, such as the Cutler Majestic Theatre, Citi Performing Arts Center, the Colonial Theater, and the Orpheum Theatre.Boston is also a hub for contemporary classical music, with groups like the Boston Modern Orchestra Project and Boston Musica Viva. The city hosts major annual events, such as First Night, the Boston Early Music Festival, and the Boston Arts Festival, which contribute to its cultural richness.In terms of visual arts, Boston boasts several art museums and galleries. The Museum of Fine Arts, the Isabella Stewart Gardner Museum, and the Institute of Contemporary Art are among the most notable. These institutions offer a wide range of art collections, from ancient to contemporary, attracting art enthusiasts from around the world.下面我们看看上面的简单RAG管道的结果 # baselineresponse base_query_engine.query(Tell me about the arts and culture in Boston)print(str(response))Boston has a rich arts and culture scene. The city is home to a variety of performing arts organizations, such as the Boston Ballet, Boston Lyric Opera Company, Opera Boston, Boston Baroque, and the Handel and Haydn Society. Additionally, there are numerous contemporary classical music groups associated with the citys conservatories and universities, like the Boston Modern Orchestra Project and Boston Musica Viva. The Theater District in Boston is a hub for theater, with notable venues including the Cutler Majestic Theatre, Citi Performing Arts Center, the Colonial Theater, and the Orpheum Theatre. Boston also hosts several significant annual events, including First Night, the Boston Early Music Festival, the Boston Arts Festival, and the Boston gay pride parade and festival. The city is renowned for its historic sites connected to the American Revolution, as well as its art museums and galleries, such as the Museum of Fine Arts, Isabella Stewart Gardner Museum, and the Institute of Contemporary Art.可以看到我们构建的多代理系统的结果要好的多。 总结 RAG系统必须发展多代理体系结构以实现企业级性能。正如这个例子所说明的划分职责可以在相关性、速度、摘要质量和及时优化方面获得收益。通过将RAG分解为专门的协作角色多代理系统可以克服单代理的限制并启用可扩展的高性能RAG。 https://avoid.overfit.cn/post/7f39d14f7e1a47188870b04c0c332641

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/90362.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

提供网站建设商家怎样做网站网站

个人主页:金鳞踏雨 个人简介:大家好,我是金鳞,一个初出茅庐的Java小白 目前状况:22届普通本科毕业生,几经波折了,现在任职于一家国内大型知名日化公司,从事Java开发工作 我的博客&am…

旅游类网站开发开题报告范文广东建设网站

前言 1Panel 是一个现代化、开源的 Linux 服务器运维管理面板。1Panel 的功能和优势包括: 快速建站:深度集成 Wordpress 和 Halo,域名绑定、SSL 证书配置等一键搞定;高效管理:通过 Web 端轻松管理 Linux 服务器,包括主机监控、文件管理、数据库管理、容器管理等;安全可…

铁道部售票网站多少钱建设建立自我追求无我是什么意思

未来已来!AI大模型正以惊人的速度引领着科技革命。随着科技的发展,人工智能在各个领域展现出了非凡的能力和潜力,大模型更是成为了科技领域的明星。从自然语言处理到图像识别,从智能推荐到语音识别,大模型的应用正在改…

网站建设的电销湖南手机网站制作公司

案例目标 文字部分自适应并且居中 图中是一个弹窗&#xff0c;我现在使用flex的布局来实现&#xff0c;标题和关闭按钮。因为是uni-app,所以标签是view 。你可以自行替换为 代码 <view class"popup-box"><view class"title"><view class&…

品牌查询网站 优帮云wordpress 发短信

Redis SETNX 特性 当然&#xff0c;让我们通过一个简单的例子&#xff0c;使用 Redis CLI&#xff08;命令行界面&#xff09;来模拟获取锁和释放锁的过程。 在此示例中&#xff0c;我将使用键“lock:tcaccount_[pk]”和“status:tcaccount_[pk]”分别表示锁定键和状态键。 获…

众筹那些网站可以做广西网站建设软件推广

1、什么是网关&#xff1f; API Gateway&#xff08;APIGW / API 网关&#xff09;&#xff0c;顾名思义&#xff0c;是系统对外的唯一入口。API 网关封装了系统内部架构&#xff0c;为每个客户端提供定制的 API。 近几年来移动应用与企业间互联需求的兴起。从以前单一的 Web …

合肥网站建设 乐云seo如何自己做网站手机软件

引言 在数字存储技术的领域中&#xff0c;闪存&#xff08;Flash&#xff09;是一种非易失性存储器&#xff0c;以其高速读写、低功耗和较高的可靠性而备受关注。相比于传统的磁盘存储技术&#xff0c;闪存具有更小的体积、更高的数据密度和更长的寿命&#xff0c;因此在各种应…

北京时间网站建设做lt行业的人让我登网站

综合类网站 那些免费的砖 统计推荐免费工具网站 那些免费的砖 - 优雅地白嫖各种免费资源 (thosefree.com)https://www.thosefree.com/ CSS样式网站 毒蘑菇-配色 CSS 配色&#xff0c;阴影网站 一个好用的配色网站! 毒蘑菇 - 配色 (dumogu.top)https://color.dumogu.top/ …

静态网页怎么做网站wordpress 注册页面插件

1. 数据类型 1.1 常量 整数&#xff1a;整数可以用二进制b或B&#xff0c;八进制o或O&#xff0c;十进制d或D&#xff0c;十六进制h或H表示&#xff0c;例如&#xff0c;8’b00001111表示8位位宽的二进制整数&#xff0c;4’ha表示4位位宽的十六进制整数。 X和Z&#xff1a;X…

中国国音电商平台官网乐陵seo营销

​ web安全渗透 1.通过URL访问http://靶机IP/1&#xff0c;对该页面进行渗透测试&#xff0c;将完成后返回的结果内容作为flag值提交&#xff1b; 访问该网页后发现F12被禁用&#xff0c;使用ctrlshifti查看 ctrlshifti 等效于 F12 flag{fc35fdc70d5fc69d269883a822c7a53e} …

广州市公司网站建设企业河北专业网络营销收费公司

✍✍计算机毕业编程指导师 ⭐⭐个人介绍&#xff1a;自己非常喜欢研究技术问题&#xff01;专业做Java、Python、微信小程序、安卓、大数据、爬虫、Golang、大屏等实战项目。 ⛽⛽实战项目&#xff1a;有源码或者技术上的问题欢迎在评论区一起讨论交流&#xff01; ⚡⚡ Java、…

天宁区建设局网站门户网站营销怎么做

文章目录 SqlClient工具的使用 一、​​​​​​​入门

黑马程序员前端培训费用seo程序专员

回答者&#xff1a; 凌波微步- 高级工程师&nbsp&nbsp第11级2009-03-09 08:54:18您可以评论本回答&#xff0c;或直接点击“提交”按钮推荐本回答...我可以取出来&#xff0c;但显示不了。我显示时用的是ms listbox 2.0控件&#xff0c;不过没成功显示出来&#xff0c;多…

网站设计与制作专业软件销售具体怎么做的

框架设计远没有大家想的那么简单&#xff0c;并不是说只把功能开发完成&#xff0c;能用就算完事儿了&#xff0c;这里面还是有很多学问的。比如说&#xff0c;我们的框架应该给用户提供哪些构建产物&#xff1f;产物的模块格式如何&#xff1f;当用户没有以预期的方式使用框架…

云服务器网站解析做公司官网需要哪些数据

题目描述 小明是蓝桥王国的骑士&#xff0c;他喜欢不断突破自我。 这天蓝桥国王给他安排了 N 个对手&#xff0c;他们的战力值分别为 a_1,a_2,…,a_n&#xff0c;且按顺序阻挡在小明的前方。对于这些对手小明可以选择挑战&#xff0c;也可以选择避战。 身为高傲的骑士&#xff…

网站结构形式有哪些昌吉市建设局网站

目录 先分个类吧&#xff1a; 1.对于有向无环图&#xff0c;我们直接拓扑排序&#xff0c;和AOE网类似&#xff0c;把取max改成min即可。 2.边权全部相等&#xff0c;直接BFS即可 3.单源点最短路 从一个点出发&#xff0c;到达其他顶点的最短路长度。 Dijkstra算法&#x…

网站加入地图导航seo公司推广宣传

配电系统中谐波电流的计算涉及很多因素。对于改造项目&#xff0c;可使用专业电能质量分析仪测得所需谐波数据&#xff1b;对于新建项目&#xff0c;设计人员并不能直接获得供电系统的的谐波数据&#xff0c;因此&#xff0c;我司研发人员通过众多不同行业、不同类型的项目&…

网站申请鹤山市网站建设公司

文章目录 概述构造器常用方法1、获取文件和目录基本信息2、列出目录的下一级3.File类的重命名功能4、判断功能的方法5、创建、删除功能 练习 概述 File类及本章下的各种流&#xff0c;都定义在java.io包下。一个File对象代表硬盘或网络中可能存在的一个文件或者文件目录&#…

科技公司网站设计风格广东住房和城乡建设厅网站王芃

pip install cddd 这个命令可能会报错&#xff0c;因为要求是TensorFlow1.10.0 TensorFlow1.10.0对应的Python版本是3.6&#xff0c;所以如果你的Python版本是3.6以上是不行的.....

iis7架设网站个人建网站wordpress

目录 一、判断语句 1.if语句 2.switch语句 二、循环语句 1.传统for循环 2.死循环 3.while模式 4.do-while模式 5.遍历切片 6.遍历map 7.break&#xff0c;continue 三、函数&#xff0c;指针 1.函数定义 2.匿名函数 3.高阶函数 4.闭包 5.值传递和引用传递 6.…