微信扫码
与创始人交个朋友
我要投稿
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
)
# 对于userB
userB_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+中大型企业
2025-02-06
基于RAG开发大语言模型
2025-02-06
小模型也能玩转RAG!性能仅降1%,存储省75%,边缘设备轻松跑
2025-02-06
基于 DeepSeek R1 和 Ollama 开发 RAG 系统(含代码)
2025-02-05
浏览量超 10w 的热图,描述 RAG 的主流架构
2025-02-05
RAG+LlamaParse:引领PDF解析与检索新时代!
2025-02-05
打造RAG智能助手:实时数据检索的终极指南!惊呆你的需求,如何一步到位?
2025-02-05
RAG知识库中文档包含表格数据如何处理?
2025-02-05
产品思维的角度来讲,Deep Research本质是Co-RAG
2024-07-18
2024-09-04
2024-05-05
2024-06-20
2024-10-27
2024-07-09
2024-07-09
2024-06-13
2024-05-19
2024-07-07
2025-02-05
2025-02-05
2025-01-24
2025-01-24
2025-01-20
2025-01-18
2025-01-18
2025-01-18