

运行
_运行_是表示 LLM 应用程序中单个工作单元或操作的跨度。这可以是从对 LLM 或链的单个调用、到提示格式化调用、到可运行的 lambda 调用的任何内容。如果您熟悉 OpenTelemetry,您可以将运行视为跨度。
跟踪
_跟踪_是单个操作的运行集合。例如,如果您有一个触发链的用户请求,并且该链调用 LLM,然后调用输出解析器等,所有这些运行都将是同一跟踪的一部分。如果您熟悉 OpenTelemetry,您可以将 LangSmith 跟踪视为跨度的集合。运行通过唯一的跟踪 ID 绑定到跟踪。
线程
_线程_是表示单个对话的跟踪序列。许多 LLM 应用程序都有类似聊天机器人的界面,用户和 LLM 应用程序进行多轮对话。对话中的每一轮都表示为自己的跟踪,但这些跟踪通过成为同一线程的一部分而链接在一起。线程中最近的跟踪是最新的消息交换。 要将跟踪分组到线程中,您传递一个特殊的元数据键(session_id、thread_id 或 conversation_id),其唯一标识符值将跟踪链接在一起。
了解如何配置线程。
项目
_项目_是跟踪的集合。您可以将项目视为与单个应用程序或服务相关的所有跟踪的容器。您可以有多个项目,每个项目可以有多个跟踪。
反馈
_反馈_允许您根据特定标准对单个运行进行评分。每个反馈条目由反馈标签和反馈分数组成,并通过唯一的运行 ID 绑定到运行。反馈可以是连续的或离散的(分类的),您可以在组织内的不同运行中重用反馈标签。 您可以通过多种方式收集运行的反馈: 要了解有关如何在应用程序中存储反馈的更多信息,请参阅反馈数据格式指南。
标签
_标签_是可以附加到运行的字符串集合。您可以使用标签在 LangSmith UI 中执行以下操作:- 对运行进行分类以便于搜索。
- 过滤运行。
- 将运行分组以进行分析。
元数据
_元数据_是可以附加到运行的键值对集合。您可以使用元数据存储有关运行的其他信息,例如生成运行的应用程序版本、生成运行的环境,或您想要与运行关联的任何其他信息。与标签类似,您可以使用元数据在 LangSmith UI 中过滤运行或将运行分组以进行分析。 了解如何向您的跟踪添加元数据。
Data storage and retention
For traces ingested on or after Wednesday, May 22, 2024, LangSmith (SaaS) retains trace data for a maximum of 400 days past the date and time the trace was inserted into the LangSmith trace database. After 400 days, the traces are permanently deleted from LangSmith, with a limited amount of metadata retained for the purpose of showing accurate statistics, such as historic usage and cost.If you wish to keep tracing data longer than the data retention period, you can add it to a dataset. A dataset allows you to store the trace inputs and outputs (e.g., as a key-value dataset), and will persist indefinitely, even after the trace gets deleted.
Deleting traces from LangSmith
If you need to remove a trace from LangSmith before its expiration date, you can do so by deleting the project that contains it. You can delete a project with one of the following ways:- In the LangSmith UI, select the Delete option on the project’s overflow menu.
- With the
delete_tracer_sessionsAPI endpoint - With the
delete_project()(Python) ordeleteProject()(JS/TS) in the LangSmith SDK.