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

集成:Chroma

用于从 Chroma 存储和检索文档的文档存储

作者
Massimiliano Pippi
deepset

目录

安装

使用 pip 安装 Chroma

pip install chroma-haystack

使用

安装后,初始化您的 Chroma 数据库以将其与 Haystack 一起使用

from haystack_integrations.document_stores.chroma import ChromaDocumentStore

# Chroma is used in-memory so we use the same instances in the two pipelines below
document_store = ChromaDocumentStore()

将文档写入 ChromaDocumentStore

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

from haystack.components.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": {"sources": file_paths}})

示例

您可以在 此仓库example/ 文件夹中找到一个展示如何使用文档存储和检索器的代码示例,或者按照 📓 Chroma 索引和 RAG 示例 进行操作。

许可证

chroma-haystack 根据 Apache-2.0 许可证分发。