📘 **TELUS Agriculture & Consumer Goods** 如何通过 **Haystack Agents** 转变促销交易
由 deepset 维护

集成:Weaviate

将 Weaviate 数据库与 Haystack 结合使用

作者
deepset

目录

概述

PyPI - Version PyPI - Python Version test


安装

使用 pip 安装 Weaviate

pip install weaviate-haystack

使用

安装完成后,初始化您的 Weaviate 数据库以便与 Haystack 一起使用。

在此示例中,为简化起见,我们使用了临时的嵌入式版本。要使用自托管的 Docker 容器或 Weaviate Cloud Service,请查看 文档

from haystack_integrations.document_stores.weaviate import WeaviateDocumentStore
from weaviate.embedded import EmbeddedOptions

document_store = WeaviateDocumentStore(embedded_options=EmbeddedOptions())
# document_store = WeaviateDocumentStore(url="https://:8080")

将文档写入 WeaviateDocumentStore

要将文档写入 WeaviateDocumentStore,请创建一个索引管道。

from haystack.components.file_converters import TextFileToDocument
from haystack.components.writers import DocumentWriter

indexing = Pipeline()
indexing.add_component("converter", TextFileToDocument())
indexing.add_component("writer", DocumentWriter(document_store))
indexing.connect("converter", "writer")
indexing.run({"converter": {"paths": file_paths}})

检索

该集成通过不同的检索器组件支持不同的检索类型

许可证

weaviate-haystack 是根据 Apache-2.0 许可证分发的。