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,包括向量搜索。

视频和教程

Sergey Bondarenco 和 Andreas Kollegger 的在线聚会/直播

Neo4j 和 Haystack 第 1 部分:用于 RAG 的知识图谱

Neo4j 和 Haystack 第 2 部分:集成工作原理