LlamaIndex中的简单融合检索器:多查询与多索引的结合
在本示例中,我们将介绍如何结合多个查询和多个索引的检索结果。检索到的节点将作为所有查询和索引中的top-k返回,并处理任何节点的去重。
设置
对于本笔记本,我们将使用两个非常相似的文档页面,每个页面存储在一个单独的索引中。
from llama_index.core import SimpleDirectoryReader
documents_1 = SimpleDirectoryReader(
input_files=["../../community/integrations/vector_stores.md"]
).load_data()
documents_2 = SimpleDirectoryReader(
input_files=["../../module_guides/storing/vector_stores.md"]
).load_data()
创建向量存储索引:
from llama_index.core import VectorStoreIndex
index_1 = VectorStoreIndex.from_documents(documents_1)
index_2 = VectorStoreIndex.from_documents(documents_2)