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,包括向量搜索。
相关链接
作者 |
|
社区支持 |
|
存储库 |
|
问题追踪 |
|
文档 |
|
示例笔记本 |
|
参考书籍 |
https://www.amazon.com/Building-Neo4j-Powered-Applications-LLMs-recommendations/dp/1836206232/ |