Haystack Neo4j 集成
deepset 提供的 Neo4j 图数据库与 Haystack v2.0 的集成。在 Neo4j 中,向量搜索索引用于存储文档嵌入和密集检索。
该库允许将 Neo4j 用作 DocumentStore,并实现了所需的协议方法。您可以通过从 `neo4_haystack` 包导入它来开始使用此实现。
安装
# pip install neo4j-haystack
from neo4j_haystack import Neo4jDocumentStore
document_store = Neo4jDocumentStore(
url="bolt://localhost:7687",
username="neo4j",
password="passw0rd",
database="neo4j",
embedding_dim=384,
embedding_field="embedding",
index="document-embeddings", # The name of the Vector Index in Neo4j
node_label="Document", # Providing a label to Neo4j nodes which store Documents
)
功能包括
-
Neo4jEmbeddingRetriever
- 是一个典型的检索器组件,可用于查询向量存储索引并查找相关文档。该组件使用 Neo4jDocumentStore 来查询嵌入。 -
Neo4jDynamicDocumentRetriever
也是一个检索器组件,它可用于在 Neo4j 中查询文档。然而,它与 Neo4jDocumentStore 解耦,并允许运行任意 Cypher 查询来提取文档。实际上,它可以通过与 Neo4jDocumentStore 相同的方式查询 Neo4j,包括向量搜索。