Align `gen_ai.decide` span payloads with the AI Agents module spec

未关闭
#25,614 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript

调研方向

Start with packages/server-utils/src/ai/core/utils.ts and the OpenAI mapping and integration tests mentioned in the issue. Compare emitted decision inputs and outputs with the linked Decision span spec, then trace the shared token usage helper and TypeSafe addResponseAttributes; the issue notes that changing shared token handling affects all AI spans. Check real Jev output for the noul fields, and update or add tests for the agreed payload behavior.

由索引模型根据 Issue 内容生成。

描述

The Decision span spec and our decide spans differ in some places. This applies to all decide integrations: TypeSafe / LangChain Jev, Workers AI (Jev, Clef), OpenAI decisions, Vercel AI experimental_decide, and the Mastra classifier.

The op, the span name, the operation name, the model, and the tokens are correct. The question and answer layouts are correct (OpenAI is converted in openai/mapping.ts).

Gaps

  1. Extra type: "evaluation" key. We send [{type: "evaluation", state, questions}] and [{type: "evaluation", answers}]. The spec says [{state, questions}] and [{answers}]. Remove the key in getEvaluationInputMessages / getEvaluationOutputMessages (packages/server-utils/src/ai/core/utils.ts), or add the key to the spec.
  2. No [Blob substitute] in state. The spec says to replace binary data and data: URLs. We send them raw. The OpenAI v7 integration test asserts that a data:image/png;base64,... input goes out unchanged.
  3. We send gen_ai.usage.total_tokens. The spec lists it under "Derived by Relay, don't send". TypeSafe addResponseAttributes, OpenAI, and the shared getTokenUsageAttributes set it. Relay overwrites the value, so nothing breaks. The shared helper is used by all AI spans, so this fix is wider than decide spans.
  4. gen_ai.agent.name is not set when a decision runs inside an agent. Low priority.

Open question

The spec has a noul question type and a noul answer field. None of our fixtures has a noul answer, so check it against real Jev output.

主要语言
TypeScript
星标
8.8k
派生
1.9k
平均合并
1 天 8 小时
30 天内合并 PR
744

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

getsentry/sentry-javascript 的其他 Issue

查看 getsentry/sentry-javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。