autotel-devtools 20.0.1 → 21.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cli.cjs +7 -4
- package/dist/cli.js +7 -4
- package/dist/{error-aggregator-CGgWr2OH.d.cts → error-aggregator-D8VKciLY.d.ts} +12 -10
- package/dist/{error-aggregator-DufjI2IG.d.ts → error-aggregator-DCEKMOm3.d.cts} +12 -10
- package/dist/{exporter-CEKKJTci.d.cts → exporter-Dt4kx128.d.cts} +15 -7
- package/dist/{exporter-BJwufQwg.d.ts → exporter-Due9Rd4s.d.ts} +15 -7
- package/dist/genai/index.cjs +93 -107
- package/dist/genai/index.d.cts +1 -32
- package/dist/genai/index.d.ts +1 -32
- package/dist/genai/index.js +94 -107
- package/dist/{http-uVPjDDld.js → http-CNZMrnzv.js} +214 -60
- package/dist/{http-j-oBI6r6.cjs → http-CXSzX4ee.cjs} +218 -57
- package/dist/index.cjs +11 -4
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +11 -4
- package/dist/json-fields-CPjKZ2WH.js +47 -0
- package/dist/json-fields-DZFlNqT2.cjs +83 -0
- package/dist/{listen-DGzVi7DE.cjs → listen-CEJ3nYJf.cjs} +1 -1
- package/dist/{listen-NVMbBWHw.js → listen-DBfsfcdd.js} +1 -1
- package/dist/server/exporter.d.cts +1 -1
- package/dist/server/exporter.d.ts +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.cts +11 -2
- package/dist/server/index.d.ts +11 -2
- package/dist/server/index.js +1 -1
- package/dist/types-DHDvZnnn.d.cts +47 -0
- package/dist/types-DHDvZnnn.d.ts +47 -0
- package/dist/widget.global.js +15 -13
- package/package.json +2 -2
package/dist/genai/index.d.cts
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/widget/types.d.ts
|
|
3
|
-
interface SpanData {
|
|
4
|
-
traceId: string;
|
|
5
|
-
spanId: string;
|
|
6
|
-
parentSpanId?: string;
|
|
7
|
-
name: string;
|
|
8
|
-
kind: 'INTERNAL' | 'SERVER' | 'CLIENT' | 'PRODUCER' | 'CONSUMER';
|
|
9
|
-
startTime: number;
|
|
10
|
-
endTime: number;
|
|
11
|
-
duration: number;
|
|
12
|
-
attributes: Record<string, any>;
|
|
13
|
-
status: {
|
|
14
|
-
code: 'OK' | 'ERROR' | 'UNSET';
|
|
15
|
-
message?: string;
|
|
16
|
-
};
|
|
17
|
-
events?: Array<{
|
|
18
|
-
name: string;
|
|
19
|
-
timestamp: number;
|
|
20
|
-
attributes?: Record<string, any>;
|
|
21
|
-
}>;
|
|
22
|
-
links?: Array<{
|
|
23
|
-
traceId: string;
|
|
24
|
-
spanId: string;
|
|
25
|
-
attributes?: Record<string, any>;
|
|
26
|
-
}>;
|
|
27
|
-
scope?: {
|
|
28
|
-
name?: string;
|
|
29
|
-
version?: string;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
1
|
+
import { r as SpanData } from "../types-DHDvZnnn.cjs";
|
|
33
2
|
//#region src/widget/genai/detect.d.ts
|
|
34
3
|
declare function isGenAiSpan(span: SpanData): boolean;
|
|
35
4
|
//#endregion
|
package/dist/genai/index.d.ts
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/widget/types.d.ts
|
|
3
|
-
interface SpanData {
|
|
4
|
-
traceId: string;
|
|
5
|
-
spanId: string;
|
|
6
|
-
parentSpanId?: string;
|
|
7
|
-
name: string;
|
|
8
|
-
kind: 'INTERNAL' | 'SERVER' | 'CLIENT' | 'PRODUCER' | 'CONSUMER';
|
|
9
|
-
startTime: number;
|
|
10
|
-
endTime: number;
|
|
11
|
-
duration: number;
|
|
12
|
-
attributes: Record<string, any>;
|
|
13
|
-
status: {
|
|
14
|
-
code: 'OK' | 'ERROR' | 'UNSET';
|
|
15
|
-
message?: string;
|
|
16
|
-
};
|
|
17
|
-
events?: Array<{
|
|
18
|
-
name: string;
|
|
19
|
-
timestamp: number;
|
|
20
|
-
attributes?: Record<string, any>;
|
|
21
|
-
}>;
|
|
22
|
-
links?: Array<{
|
|
23
|
-
traceId: string;
|
|
24
|
-
spanId: string;
|
|
25
|
-
attributes?: Record<string, any>;
|
|
26
|
-
}>;
|
|
27
|
-
scope?: {
|
|
28
|
-
name?: string;
|
|
29
|
-
version?: string;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
1
|
+
import { r as SpanData } from "../types-DHDvZnnn.js";
|
|
33
2
|
//#region src/widget/genai/detect.d.ts
|
|
34
3
|
declare function isGenAiSpan(span: SpanData): boolean;
|
|
35
4
|
//#endregion
|
package/dist/genai/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { a as asStringArray, i as asString, n as asBoolean, r as asNumber, t as asObject } from "../json-fields-CPjKZ2WH.js";
|
|
2
|
+
|
|
1
3
|
//#region src/widget/genai/detect.ts
|
|
2
4
|
const GENAI_MARKERS = [
|
|
3
5
|
"gen_ai.system",
|
|
@@ -148,25 +150,6 @@ function priceCall(inputs) {
|
|
|
148
150
|
|
|
149
151
|
//#endregion
|
|
150
152
|
//#region src/widget/genai/normalize.ts
|
|
151
|
-
function str(v) {
|
|
152
|
-
return typeof v === "string" ? v : void 0;
|
|
153
|
-
}
|
|
154
|
-
function num(v) {
|
|
155
|
-
if (typeof v === "number") return v;
|
|
156
|
-
if (typeof v === "string" && v !== "") {
|
|
157
|
-
const n = Number(v);
|
|
158
|
-
return Number.isFinite(n) ? n : void 0;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
function strArray(v) {
|
|
162
|
-
if (Array.isArray(v) && v.every((x) => typeof x === "string")) return v;
|
|
163
|
-
if (typeof v === "string") return [v];
|
|
164
|
-
}
|
|
165
|
-
function bool(v) {
|
|
166
|
-
if (typeof v === "boolean") return v;
|
|
167
|
-
if (v === "true") return true;
|
|
168
|
-
if (v === "false") return false;
|
|
169
|
-
}
|
|
170
153
|
function parseJson(v) {
|
|
171
154
|
if (v == null) return void 0;
|
|
172
155
|
if (typeof v === "object") return v;
|
|
@@ -219,9 +202,10 @@ function normalizeMessageParts(raw) {
|
|
|
219
202
|
value: p
|
|
220
203
|
};
|
|
221
204
|
});
|
|
222
|
-
|
|
205
|
+
const legacyText = asString(raw.content);
|
|
206
|
+
if (legacyText !== void 0) return [{
|
|
223
207
|
kind: "text",
|
|
224
|
-
text:
|
|
208
|
+
text: legacyText
|
|
225
209
|
}];
|
|
226
210
|
if (raw.content != null) return [{
|
|
227
211
|
kind: "json",
|
|
@@ -230,7 +214,8 @@ function normalizeMessageParts(raw) {
|
|
|
230
214
|
return [];
|
|
231
215
|
}
|
|
232
216
|
function unwrapToolResult(payload) {
|
|
233
|
-
|
|
217
|
+
const wrapper = asObject(payload);
|
|
218
|
+
return wrapper && "value" in wrapper ? wrapper.value : payload;
|
|
234
219
|
}
|
|
235
220
|
function classifyAiSdkPart(part) {
|
|
236
221
|
if (part.type === "tool-call") return {
|
|
@@ -344,8 +329,9 @@ function messagesFromEvents(events) {
|
|
|
344
329
|
for (const ev of events) {
|
|
345
330
|
const attrs = ev.attributes ?? {};
|
|
346
331
|
if (ev.name === "gen_ai.choice") {
|
|
347
|
-
const
|
|
348
|
-
const
|
|
332
|
+
const unparsedMessage = attrs.message;
|
|
333
|
+
const message = parseJson(attrs.message) ?? unparsedMessage;
|
|
334
|
+
const finishReason = asString(attrs.finish_reason);
|
|
349
335
|
if (message) {
|
|
350
336
|
const normalized = normalizeMessage(message);
|
|
351
337
|
if (finishReason) normalized.finishReason = finishReason;
|
|
@@ -357,12 +343,13 @@ function messagesFromEvents(events) {
|
|
|
357
343
|
if (!m) continue;
|
|
358
344
|
const role = m[1];
|
|
359
345
|
const content = attrs.content;
|
|
360
|
-
const
|
|
346
|
+
const contentText = asString(content);
|
|
347
|
+
const parsed = contentText === void 0 ? content : parseJson(contentText) ?? contentText;
|
|
361
348
|
out.push(normalizeMessage({
|
|
362
349
|
role,
|
|
363
350
|
content: parsed,
|
|
364
351
|
tool_calls: parseJson(attrs.tool_calls),
|
|
365
|
-
tool_call_id:
|
|
352
|
+
tool_call_id: asString(attrs.id) ?? asString(attrs.tool_call_id)
|
|
366
353
|
}));
|
|
367
354
|
}
|
|
368
355
|
return out;
|
|
@@ -370,7 +357,7 @@ function messagesFromEvents(events) {
|
|
|
370
357
|
function readToolDefinitions(attrs) {
|
|
371
358
|
const raw = parseJson(attrs["gen_ai.tool.definitions"] ?? attrs["gen_ai.orchestrator.agent.definitions"]);
|
|
372
359
|
if (!Array.isArray(raw)) return void 0;
|
|
373
|
-
return raw.filter((d) =>
|
|
360
|
+
return raw.filter((d) => asString(d.name) !== void 0).map((d) => ({
|
|
374
361
|
name: d.name,
|
|
375
362
|
description: d.description,
|
|
376
363
|
type: d.type,
|
|
@@ -379,18 +366,18 @@ function readToolDefinitions(attrs) {
|
|
|
379
366
|
}
|
|
380
367
|
function readUsage(attrs) {
|
|
381
368
|
return {
|
|
382
|
-
inputTokens:
|
|
383
|
-
outputTokens:
|
|
384
|
-
reasoningOutputTokens:
|
|
385
|
-
cacheReadInputTokens:
|
|
386
|
-
cacheCreationInputTokens:
|
|
369
|
+
inputTokens: asNumber(attrs["gen_ai.usage.input_tokens"]) ?? asNumber(attrs["gen_ai.usage.prompt_tokens"]) ?? asNumber(attrs["llm.usage.prompt_tokens"]) ?? asNumber(attrs["ai.usage.inputTokens"]),
|
|
370
|
+
outputTokens: asNumber(attrs["gen_ai.usage.output_tokens"]) ?? asNumber(attrs["gen_ai.usage.completion_tokens"]) ?? asNumber(attrs["llm.usage.completion_tokens"]) ?? asNumber(attrs["ai.usage.outputTokens"]),
|
|
371
|
+
reasoningOutputTokens: asNumber(attrs["gen_ai.usage.reasoning.output_tokens"]),
|
|
372
|
+
cacheReadInputTokens: asNumber(attrs["gen_ai.usage.cache_read.input_tokens"]),
|
|
373
|
+
cacheCreationInputTokens: asNumber(attrs["gen_ai.usage.cache_creation.input_tokens"])
|
|
387
374
|
};
|
|
388
375
|
}
|
|
389
376
|
function readStreaming(attrs) {
|
|
390
|
-
const timeToFirstChunkS =
|
|
391
|
-
const timeToFinishS =
|
|
392
|
-
const outputTokensPerSecond =
|
|
393
|
-
const timePerOutputChunkS =
|
|
377
|
+
const timeToFirstChunkS = asNumber(attrs["gen_ai.response.time_to_first_chunk"]);
|
|
378
|
+
const timeToFinishS = asNumber(attrs["gen_ai.response.time_to_finish"]);
|
|
379
|
+
const outputTokensPerSecond = asNumber(attrs["gen_ai.response.output_tokens_per_second"]);
|
|
380
|
+
const timePerOutputChunkS = asNumber(attrs["gen_ai.response.time_per_output_chunk"]);
|
|
394
381
|
if (timeToFirstChunkS === void 0 && timeToFinishS === void 0 && outputTokensPerSecond === void 0 && timePerOutputChunkS === void 0) return;
|
|
395
382
|
return {
|
|
396
383
|
timeToFirstChunkS,
|
|
@@ -400,12 +387,12 @@ function readStreaming(attrs) {
|
|
|
400
387
|
};
|
|
401
388
|
}
|
|
402
389
|
function readSession(attrs) {
|
|
403
|
-
const costUsd =
|
|
404
|
-
const inputTokens =
|
|
405
|
-
const outputTokens =
|
|
406
|
-
const stepCount =
|
|
407
|
-
const toolCallCount =
|
|
408
|
-
const errorCount =
|
|
390
|
+
const costUsd = asNumber(attrs["gen_ai.session.cost.usd"]);
|
|
391
|
+
const inputTokens = asNumber(attrs["gen_ai.session.input_tokens"]);
|
|
392
|
+
const outputTokens = asNumber(attrs["gen_ai.session.output_tokens"]);
|
|
393
|
+
const stepCount = asNumber(attrs["gen_ai.session.step.count"]);
|
|
394
|
+
const toolCallCount = asNumber(attrs["gen_ai.session.tool_call.count"]);
|
|
395
|
+
const errorCount = asNumber(attrs["gen_ai.session.error.count"]);
|
|
409
396
|
if (costUsd === void 0 && inputTokens === void 0 && outputTokens === void 0 && stepCount === void 0 && toolCallCount === void 0 && errorCount === void 0) return;
|
|
410
397
|
return {
|
|
411
398
|
costUsd,
|
|
@@ -417,18 +404,18 @@ function readSession(attrs) {
|
|
|
417
404
|
};
|
|
418
405
|
}
|
|
419
406
|
function readGuardDetails(a, defaultAction) {
|
|
420
|
-
const rule =
|
|
407
|
+
const rule = asString(a["gen_ai.guard.rule"]);
|
|
421
408
|
if (!rule) return void 0;
|
|
422
409
|
return {
|
|
423
410
|
rule,
|
|
424
|
-
action:
|
|
425
|
-
message:
|
|
426
|
-
observed:
|
|
427
|
-
limit:
|
|
411
|
+
action: asString(a["gen_ai.guard.action"]) ?? defaultAction,
|
|
412
|
+
message: asString(a["gen_ai.guard.message"]),
|
|
413
|
+
observed: asNumber(a["gen_ai.guard.observed"]),
|
|
414
|
+
limit: asNumber(a["gen_ai.guard.limit"])
|
|
428
415
|
};
|
|
429
416
|
}
|
|
430
417
|
function readGuardAndWarnings(attrs, events) {
|
|
431
|
-
const stopped =
|
|
418
|
+
const stopped = asBoolean(attrs["gen_ai.guard.stopped"]);
|
|
432
419
|
const warnings = [];
|
|
433
420
|
let guard = readGuardDetails(attrs);
|
|
434
421
|
const apply = (next) => {
|
|
@@ -537,17 +524,17 @@ const KNOWN_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set([
|
|
|
537
524
|
]);
|
|
538
525
|
function toGenAiSpan(span) {
|
|
539
526
|
const attrs = span.attributes ?? {};
|
|
540
|
-
const provider = normalizeProviderName(
|
|
541
|
-
const operation =
|
|
542
|
-
const requestModel =
|
|
543
|
-
const responseModel =
|
|
527
|
+
const provider = normalizeProviderName(asString(attrs["gen_ai.provider.name"]) ?? asString(attrs["gen_ai.system"]) ?? asString(attrs["ai.model.provider"]) ?? "unknown");
|
|
528
|
+
const operation = asString(attrs["gen_ai.operation.name"]) ?? "chat";
|
|
529
|
+
const requestModel = asString(attrs["gen_ai.request.model"]) ?? asString(attrs["llm.request.model"]) ?? asString(attrs["model_name"]) ?? asString(attrs["ai.model.id"]) ?? "unknown";
|
|
530
|
+
const responseModel = asString(attrs["gen_ai.response.model"]) ?? asString(attrs["llm.response.model"]) ?? asString(attrs["ai.response.model"]);
|
|
544
531
|
const inputMessages = readMessagesAttribute(attrs, "gen_ai.input.messages") ?? [];
|
|
545
532
|
const outputMessages = readMessagesAttribute(attrs, "gen_ai.output.messages") ?? [];
|
|
546
533
|
let systemInstructions = [];
|
|
547
534
|
const rawSystem = parseJson(attrs["gen_ai.system_instructions"]);
|
|
548
535
|
if (Array.isArray(rawSystem) && rawSystem.length > 0) {
|
|
549
|
-
const first = rawSystem[0];
|
|
550
|
-
if (first &&
|
|
536
|
+
const first = asObject(rawSystem[0]);
|
|
537
|
+
if (first && "role" in first) systemInstructions = rawSystem.map((m) => normalizeMessage(m));
|
|
551
538
|
else systemInstructions = [{
|
|
552
539
|
role: "system",
|
|
553
540
|
parts: rawSystem.map((p) => p.type === "text" || p.content !== void 0 ? {
|
|
@@ -564,8 +551,8 @@ function toGenAiSpan(span) {
|
|
|
564
551
|
...inputMessages,
|
|
565
552
|
...outputMessages
|
|
566
553
|
] : messagesFromEvents(span.events);
|
|
567
|
-
const inputRef =
|
|
568
|
-
const outputRef =
|
|
554
|
+
const inputRef = asString(attrs["gen_ai.input.messages.ref"]);
|
|
555
|
+
const outputRef = asString(attrs["gen_ai.output.messages.ref"]);
|
|
569
556
|
const hasInputContent = messages.some((m) => m.role === "system" || m.role === "user");
|
|
570
557
|
const hasOutputContent = messages.some((m) => m.role === "assistant");
|
|
571
558
|
if (inputRef && !hasInputContent) messages.push({
|
|
@@ -608,14 +595,14 @@ function toGenAiSpan(span) {
|
|
|
608
595
|
}
|
|
609
596
|
}
|
|
610
597
|
const aiResponseToolCalls = parseJson(attrs["ai.response.toolCalls"]);
|
|
611
|
-
const assistantToolCalls = Array.isArray(aiResponseToolCalls) ? aiResponseToolCalls.filter((c) =>
|
|
598
|
+
const assistantToolCalls = Array.isArray(aiResponseToolCalls) ? aiResponseToolCalls.filter((c) => asString(c.toolName) !== void 0).map((c) => ({
|
|
612
599
|
id: c.toolCallId,
|
|
613
600
|
name: c.toolName,
|
|
614
601
|
arguments: parseJson(c.input ?? c.args) ?? c.input ?? c.args ?? {}
|
|
615
602
|
})) : void 0;
|
|
616
|
-
const aiResponseText =
|
|
603
|
+
const aiResponseText = asString(attrs["ai.response.text"]);
|
|
617
604
|
if (aiResponseText || assistantToolCalls && assistantToolCalls.length > 0) {
|
|
618
|
-
const finishReason =
|
|
605
|
+
const finishReason = asStringArray(attrs["gen_ai.response.finish_reasons"])?.[0] ?? asString(attrs["ai.response.finishReason"]);
|
|
619
606
|
const msg = normalizeMessage({
|
|
620
607
|
role: "assistant",
|
|
621
608
|
content: aiResponseText ?? ""
|
|
@@ -632,7 +619,7 @@ function toGenAiSpan(span) {
|
|
|
632
619
|
if (messages.length === 0) {
|
|
633
620
|
const legacy = [];
|
|
634
621
|
for (let i = 0; i < 32; i++) {
|
|
635
|
-
const role =
|
|
622
|
+
const role = asString(attrs[`gen_ai.prompt.${i}.role`]) ?? asString(attrs[`llm.prompts.${i}.role`]);
|
|
636
623
|
const content = attrs[`gen_ai.prompt.${i}.content`] ?? attrs[`llm.prompts.${i}.content`];
|
|
637
624
|
if (!role) break;
|
|
638
625
|
legacy.push(normalizeMessage({
|
|
@@ -641,9 +628,9 @@ function toGenAiSpan(span) {
|
|
|
641
628
|
}));
|
|
642
629
|
}
|
|
643
630
|
for (let i = 0; i < 32; i++) {
|
|
644
|
-
const role =
|
|
631
|
+
const role = asString(attrs[`gen_ai.completion.${i}.role`]) ?? asString(attrs[`llm.completions.${i}.role`]);
|
|
645
632
|
const content = attrs[`gen_ai.completion.${i}.content`] ?? attrs[`llm.completions.${i}.content`];
|
|
646
|
-
const finishReason =
|
|
633
|
+
const finishReason = asString(attrs[`gen_ai.completion.${i}.finish_reason`]);
|
|
647
634
|
if (!role) break;
|
|
648
635
|
const msg = normalizeMessage({
|
|
649
636
|
role,
|
|
@@ -690,7 +677,7 @@ function toGenAiSpan(span) {
|
|
|
690
677
|
cacheReadInputTokens: usage.cacheReadInputTokens,
|
|
691
678
|
cacheCreationInputTokens: usage.cacheCreationInputTokens
|
|
692
679
|
});
|
|
693
|
-
const reportedCost =
|
|
680
|
+
const reportedCost = asNumber(attrs["gen_ai.usage.cost.usd"]);
|
|
694
681
|
const cost = reportedCost !== void 0 ? {
|
|
695
682
|
currency: "USD",
|
|
696
683
|
input: tableCost?.input ?? 0,
|
|
@@ -703,34 +690,34 @@ function toGenAiSpan(span) {
|
|
|
703
690
|
const streaming = readStreaming(attrs);
|
|
704
691
|
const session = readSession(attrs);
|
|
705
692
|
const { guard, warnings } = readGuardAndWarnings(attrs, span.events);
|
|
706
|
-
const finishReasons =
|
|
707
|
-
const agentName =
|
|
708
|
-
const agentId =
|
|
709
|
-
const agentDescription =
|
|
710
|
-
const toolName =
|
|
711
|
-
const toolCallId =
|
|
712
|
-
const handoffFrom =
|
|
713
|
-
const handoffTo =
|
|
714
|
-
const guardrailName =
|
|
715
|
-
const guardrailTriggered =
|
|
716
|
-
const evalName =
|
|
717
|
-
const evalScoreValue =
|
|
718
|
-
const evalScoreLabel =
|
|
719
|
-
const evalExplanation =
|
|
720
|
-
const audioIn =
|
|
721
|
-
const audioOut =
|
|
722
|
-
const speechVoice =
|
|
723
|
-
const speechInputText =
|
|
724
|
-
const transcriptionText =
|
|
725
|
-
const embeddingDims =
|
|
726
|
-
const consentOutcome =
|
|
727
|
-
const policyDecision =
|
|
728
|
-
const injectionVerdict =
|
|
729
|
-
const actionRiskClass =
|
|
730
|
-
const inputProvenance =
|
|
731
|
-
const planStepIndex =
|
|
732
|
-
const securityEvent =
|
|
733
|
-
const guardStoppedAttr =
|
|
693
|
+
const finishReasons = asStringArray(attrs["gen_ai.response.finish_reasons"]);
|
|
694
|
+
const agentName = asString(attrs["gen_ai.agent.name"]);
|
|
695
|
+
const agentId = asString(attrs["gen_ai.agent.id"]);
|
|
696
|
+
const agentDescription = asString(attrs["gen_ai.agent.description"]);
|
|
697
|
+
const toolName = asString(attrs["gen_ai.tool.name"]);
|
|
698
|
+
const toolCallId = asString(attrs["gen_ai.tool.call.id"]);
|
|
699
|
+
const handoffFrom = asString(attrs["gen_ai.handoff.from_agent"]);
|
|
700
|
+
const handoffTo = asString(attrs["gen_ai.handoff.to_agent"]);
|
|
701
|
+
const guardrailName = asString(attrs["gen_ai.guardrail.name"]);
|
|
702
|
+
const guardrailTriggered = asBoolean(attrs["gen_ai.guardrail.triggered"]);
|
|
703
|
+
const evalName = asString(attrs["gen_ai.evaluation.name"]);
|
|
704
|
+
const evalScoreValue = asNumber(attrs["gen_ai.evaluation.score.value"]);
|
|
705
|
+
const evalScoreLabel = asString(attrs["gen_ai.evaluation.score.label"]);
|
|
706
|
+
const evalExplanation = asString(attrs["gen_ai.evaluation.explanation"]);
|
|
707
|
+
const audioIn = asString(attrs["gen_ai.audio.input.format"]);
|
|
708
|
+
const audioOut = asString(attrs["gen_ai.audio.output.format"]);
|
|
709
|
+
const speechVoice = asString(attrs["gen_ai.speech.voice"]);
|
|
710
|
+
const speechInputText = asString(attrs["gen_ai.speech.input_text"]);
|
|
711
|
+
const transcriptionText = asString(attrs["gen_ai.transcription.text"]);
|
|
712
|
+
const embeddingDims = asNumber(attrs["gen_ai.embeddings.dimension.count"]);
|
|
713
|
+
const consentOutcome = asString(attrs["agent.consent.outcome"]);
|
|
714
|
+
const policyDecision = asString(attrs["policy.decision"]);
|
|
715
|
+
const injectionVerdict = asString(attrs["mcp.security.injection.verdict"]);
|
|
716
|
+
const actionRiskClass = asString(attrs["agent.action.risk_class"]);
|
|
717
|
+
const inputProvenance = asString(attrs["agent.input.provenance"]);
|
|
718
|
+
const planStepIndex = asNumber(attrs["agent.plan.step_index"]);
|
|
719
|
+
const securityEvent = asString(attrs["security.event"]);
|
|
720
|
+
const guardStoppedAttr = asBoolean(attrs["gen_ai.guard.stopped"]);
|
|
734
721
|
const agentSecurity = consentOutcome || policyDecision || injectionVerdict || actionRiskClass || inputProvenance || planStepIndex !== void 0 || securityEvent || guardStoppedAttr !== void 0 || guard?.stopped ? {
|
|
735
722
|
...consentOutcome && { consentOutcome },
|
|
736
723
|
...policyDecision && { policyDecision },
|
|
@@ -762,15 +749,15 @@ function toGenAiSpan(span) {
|
|
|
762
749
|
requestModel,
|
|
763
750
|
responseModel,
|
|
764
751
|
params: {
|
|
765
|
-
temperature:
|
|
766
|
-
topP:
|
|
767
|
-
topK:
|
|
768
|
-
maxTokens:
|
|
769
|
-
stopSequences:
|
|
770
|
-
seed:
|
|
771
|
-
frequencyPenalty:
|
|
772
|
-
presencePenalty:
|
|
773
|
-
choiceCount:
|
|
752
|
+
temperature: asNumber(attrs["gen_ai.request.temperature"]),
|
|
753
|
+
topP: asNumber(attrs["gen_ai.request.top_p"]),
|
|
754
|
+
topK: asNumber(attrs["gen_ai.request.top_k"]),
|
|
755
|
+
maxTokens: asNumber(attrs["gen_ai.request.max_tokens"]),
|
|
756
|
+
stopSequences: asStringArray(attrs["gen_ai.request.stop_sequences"]),
|
|
757
|
+
seed: asNumber(attrs["gen_ai.request.seed"]),
|
|
758
|
+
frequencyPenalty: asNumber(attrs["gen_ai.request.frequency_penalty"]),
|
|
759
|
+
presencePenalty: asNumber(attrs["gen_ai.request.presence_penalty"]),
|
|
760
|
+
choiceCount: asNumber(attrs["gen_ai.request.choice.count"])
|
|
774
761
|
},
|
|
775
762
|
messages,
|
|
776
763
|
toolDefinitions: readToolDefinitions(attrs),
|
|
@@ -782,7 +769,7 @@ function toGenAiSpan(span) {
|
|
|
782
769
|
session,
|
|
783
770
|
warnings,
|
|
784
771
|
finishReasons,
|
|
785
|
-
responseId:
|
|
772
|
+
responseId: asString(attrs["gen_ai.response.id"]),
|
|
786
773
|
agent: agentId || agentName || agentDescription ? {
|
|
787
774
|
id: agentId,
|
|
788
775
|
name: agentName,
|
|
@@ -800,7 +787,7 @@ function toGenAiSpan(span) {
|
|
|
800
787
|
name: guardrailName,
|
|
801
788
|
triggered: guardrailTriggered
|
|
802
789
|
} : void 0,
|
|
803
|
-
conversationId:
|
|
790
|
+
conversationId: asString(attrs["gen_ai.conversation.id"]),
|
|
804
791
|
agentSecurity,
|
|
805
792
|
evaluation: evalName || evalScoreValue !== void 0 || evalScoreLabel || evalExplanation ? {
|
|
806
793
|
name: evalName,
|
|
@@ -817,12 +804,12 @@ function toGenAiSpan(span) {
|
|
|
817
804
|
embeddingDimensions: embeddingDims
|
|
818
805
|
} : void 0,
|
|
819
806
|
extras: {
|
|
820
|
-
openaiServiceTier:
|
|
821
|
-
request:
|
|
822
|
-
response:
|
|
807
|
+
openaiServiceTier: asString(attrs["gen_ai.openai.request.service_tier"]) || asString(attrs["gen_ai.openai.response.service_tier"]) || asString(attrs["openai.request.service_tier"]) || asString(attrs["openai.response.service_tier"]) ? {
|
|
808
|
+
request: asString(attrs["gen_ai.openai.request.service_tier"]) ?? asString(attrs["openai.request.service_tier"]),
|
|
809
|
+
response: asString(attrs["gen_ai.openai.response.service_tier"]) ?? asString(attrs["openai.response.service_tier"])
|
|
823
810
|
} : void 0,
|
|
824
|
-
openaiSystemFingerprint:
|
|
825
|
-
openaiResponseFormat:
|
|
811
|
+
openaiSystemFingerprint: asString(attrs["gen_ai.openai.response.system_fingerprint"]) ?? asString(attrs["openai.response.system_fingerprint"]),
|
|
812
|
+
openaiResponseFormat: asString(attrs["gen_ai.openai.request.response_format"]) ?? asString(attrs["openai.request.response_format"]),
|
|
826
813
|
raw
|
|
827
814
|
}
|
|
828
815
|
};
|