Fondant
Fondant 是一个开源框架,旨在通过使容器化组件能够在跨管道和执行环境中使用,从而简化和加速大规模数据处理。受益于内置功能,如自动扩缩容、数据沿袭和管道缓存,并部署到 (托管) 平台,例如 Vertex AI、Sagemaker 和 Kubeflow Pipelines。
Fondant 提供了一个可重用组件库,您可以利用它来构建自己的管道,其中包括一个用于将嵌入写入 Qdrant 的 Qdrant 组件。
用法
使用 Qdrant 构建用于 RAG 的数据加载管道.
一个简单的数据摄取管道可能如下所示
import pyarrow as pa
from fondant.pipeline import Pipeline
indexing_pipeline = Pipeline(
name="ingestion-pipeline",
description="Pipeline to prepare and process data for building a RAG solution",
base_path="./fondant-artifacts",
)
# An custom implemenation of a read component.
text = indexing_pipeline.read(
"path/to/data-source-component",
arguments={
# your custom arguments
}
)
chunks = text.apply(
"chunk_text",
arguments={
"chunk_size": 512,
"chunk_overlap": 32,
},
)
embeddings = chunks.apply(
"embed_text",
arguments={
"model_provider": "huggingface",
"model": "all-MiniLM-L6-v2",
},
)
embeddings.write(
"index_qdrant",
arguments={
"url": "http:localhost:6333",
"collection_name": "some-collection-name",
},
cache=False,
)
一旦您有了管道,就可以使用内置的 CLI 轻松运行它。Fondant 允许您在不同的云环境中在生产中运行管道。
第一个组件是一个需要实现的自定义读取模块,不能直接使用。关于如何重建此管道的详细教程在 GitHub 上提供。
下一步
有关创建自己的管道和组件的更多信息,请参阅Fondant 文档。