跳到主要内容

Tracing txtai

txtai Tracing via autolog

txtai 是一个一体化的嵌入式数据库,用于语义搜索、LLM 编排和语言模型工作流。

MLflow Tracing 为 txtai 提供了自动跟踪功能。可以通过调用 mlflow.txtai.autolog 函数来启用 txtai 的自动跟踪,MLflow 将捕获 LLM 调用、嵌入、向量搜索的跟踪,并将它们记录到当前的 MLflow Experiment 中。

要开始,请安装 MLflow txtai 扩展

pip install mlflow-txtai

然后,在您的 Python 代码中启用自动日志记录

import mlflow

mlflow.txtai.autolog()

示例

展示跟踪集成的最简单示例是仪器化一个 Textractor 管道

import mlflow
from txtai.pipeline import Textractor

# Enable MLflow auto-tracing for txtai
mlflow.txtai.autolog()

# Optional: Set a tracking URI and an experiment
mlflow.set_tracking_uri("https://:5000")
mlflow.set_experiment("txtai")

# Define and run a simple Textractor pipeline.
textractor = Textractor()
textractor("https://github.com/neuml/txtai")

txtai Textractor Tracing via autolog

更多信息

有关使用 txtai 和 MLflow 的更多示例和指导,请参阅 MLflow txtai 扩展文档