Haystack Neo4j 集成

将 Neo4j 图数据库与 deepset 的 Haystack v2.0 集成。在 Neo4j 中使用向量搜索索引来存储文档嵌入和密集检索。

该库允许将 Neo4j 用作 DocumentStore,并实现所需的协议方法。您可以通过从 neo4_haystack 包导入来开始使用该实现。

安装

# pip install neo4j-haystack
from neo4j_haystack import Neo4jDocumentStore

document_store = Neo4jDocumentStore(
    url="bolt://: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 部分:集成工作原理

© . This site is unofficial and not affiliated with Neo4j, Inc.