微信扫码
添加专属顾问
我要投稿
reader = SimpleDirectoryReader(input_files=['dense_x_retrieval.pdf'])documents_userA = reader.load_data()reader = SimpleDirectoryReader(input_files=['llm_compiler.pdf'])documents_userB = reader.load_data()
index = VectorStoreIndex.from_documents(documents=[])
摄入管道:
pipeline = IngestionPipeline(transformations=[SentenceSplitter(chunk_size=512, chunk_overlap=20),])
for document in documents_userA:document.metadata['user'] ='userA'nodes = pipeline.run(documents=documents_userA)index.insert_nodes(nodes)for document in documents_userB:document.metadata['user'] ='userB'nodes = pipeline.run(documents=documents_userB)index.insert_nodes(nodes)
# 对于user A= index.as_query_engine(filters=MetadataFilters(filters=[ExactMatchFilter(key="user",="userA",)]),similarity_top_k=3)# 对于userBuserB_query_engine = index.as_query_engine(filters=MetadataFilters(filters=[ExactMatchFilter(key="user",value="userB",)]),similarity_top_k=3)
# UserA拥有Dense X Retrieval论文,应该能够回答以下问题。response = userA_query_engine.query("what are propositions mentioned in the paper?")# userB 拥有LLMCompiler论文response = userB_query_engine.query("what are steps involved in LLM Compiler?")LLMCompiler 由三个关键组件组成:一个LLM规划器、一个任务获取单元和一个执行器。LLM规划器通过定义基于用户输入的不同函数调用及其依赖关系来确定执行流程。
任务获取单元在用前一个任务的实际输出替换变量后,调度可以并行执行的函数调用。最后,执行器使用相关工具执行调度的函数调用任务。这些组件协同工作,优化了LLM的并行函数调用性能。
# 这不应该被回答,因为userA没有关于LLMCompiler的信息response = userA_query_engine.query("what are steps involved in LLMCompiler?")LLM:对不起,但我在给定的上下文中找不到有关LLMCompiler涉及的步骤的任何信息。
正如所演示的,如果 userA 查询 userB 索引的文档,系统不会从该文档检索到任何答案。
一键整合包
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费POC验证,效果达标后再合作。零风险落地应用大模型,已交付160+中大型企业
2026-05-22
四种索引,一个系统,重新定义 AI 如何理解知识
2026-05-22
腾讯云Agent Memory节省61% Token提升52%成功率的诀窍:Mermaid无限画布×上下文卸载
2026-05-22
企业知识库下半场:从 RAG 到 context architecture
2026-05-22
每个RAG工程师都应该了解的Ranking技术
2026-05-21
清华提出NaviRAG:让RAG学会"主动导航",长文问答F1涨4.8分
2026-05-20
AIOps探索:给不能联网的客户做一个AI运维助手到底有多难?
2026-05-18
别再错过啦,AI Agent记忆革命:95.2%检索率的持久记忆系统深度解析
2026-05-18
有多少人把Agent与RAG的检索策略,简化成了 if-else?
2026-03-23
2026-04-06
2026-02-22
2026-03-18
2026-03-20
2026-02-27
2026-03-21
2026-03-31
2026-04-27
2026-03-17
2026-05-20
2026-05-18
2026-05-11
2026-05-07
2026-05-06
2026-04-27
2026-04-21
2026-03-17