SuperAPI AI 工具集

threads-conversations

通用与其它

查看项目

更新于 10-16 05:03

技能介绍

用途:把多轮对话的各轮次按会话分组到同一线程,便于按会话查看与评估。每轮对话对应一条 trace,共享同一 thread_id 即属于同一线程。

主要能力:写入 thread_id 进行线程归属;对线程而非单条 trace 做会话级评估,内置 SessionCompletenessMetric、UserFrustrationMetric、ConversationalCoherenceMetric 等对话指标。

使用方式:在入口函数上用 @opik.track(entrypoint=True) 装饰,并调用 opik.update_current_trace(thread_id=session_id);没有天然会话 ID 时,可为每个会话生成一次 str(uuid.uuid4()) 作为 thread_id。评估使用 from opik.evaluation import evaluate_threads,传入 project_name 与指标列表(如 evaluate_threads(project_name="chat-agent", metrics=[...]))。

适用场景:聊天智能体、支持机器人、多步骤助手等多轮交互场景;单次调用型智能体或批处理不适用。

限制与常见问题:缺少 thread_id 时各轮会显示为互不相关的 trace;若每轮生成一个 thread_id 而非按会话生成,则每轮各自成为独立线程;多个用户共用同一 thread_id 会导致对话混杂。其余收费、平台与价格信息暂未提供。