tracing_context#

langsmith.run_helpers.tracing_context(
*,
project_name: str | None = None,
tags: list[str] | None = None,
metadata: dict[str, Any] | None = None,
parent: RunTree | Mapping | str | Literal[False] | None = None,
enabled: bool | Literal['local'] | None = None,
client: Client | None = None,
replicas: Sequence[tuple[str, dict | None]] | None = None,
**kwargs: Any,
) Generator[None, None, None][源代码]#

为代码块设置追踪上下文。

参数:
  • project_name (str | None) – 要将运行日志记录到的项目名称。默认为 None。

  • tags (list[str] | None) – 要添加到运行的标签。默认为 None。

  • metadata (dict[str, Any] | None) – 要添加到运行的元数据。默认为 None。

  • parent (RunTree | Mapping | str | Literal[False] | None) – 用于上下文的父运行。可以是 Run/RunTree 对象、请求头(用于分布式追踪)或点分隔的顺序字符串。默认为 None。

  • client (Client | None) – 用于将运行日志记录到 LangSmith 的客户端。默认为 None。

  • enabled (bool | Literal['local'] | None) – 是否启用追踪。默认为 None,表示将使用当前上下文值或环境变量。

  • replicas (Sequence[tuple[str, dict | None]] | None) – 包含项目名称和每个副本可选更新的元组序列。示例:[(“my_experiment”, {“reference_example_id”: None}), (“my_project”, None)]

  • kwargs (Any)

返回类型:

Generator[None, None, None]