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

Offen
#25,614 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
typescript

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
TypeScript
Sterne
8.8k
Forks
1.9k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
744

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus getsentry/sentry-javascript

Alle Issues in getsentry/sentry-javascript

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.