@fallom/trace 0.2.13 → 0.2.15
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/dist/index.d.mts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +54 -13
- package/dist/index.mjs +54 -13
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -11,6 +11,10 @@ interface SessionContext {
|
|
|
11
11
|
configKey: string;
|
|
12
12
|
sessionId: string;
|
|
13
13
|
customerId?: string;
|
|
14
|
+
/** Custom key-value metadata for filtering/grouping */
|
|
15
|
+
metadata?: Record<string, string | number | boolean>;
|
|
16
|
+
/** Simple string tags for quick filtering */
|
|
17
|
+
tags?: string[];
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
16
20
|
* Trace context for linking spans together.
|
|
@@ -42,6 +46,8 @@ interface TraceData {
|
|
|
42
46
|
error_message?: string;
|
|
43
47
|
time_to_first_token_ms?: number;
|
|
44
48
|
is_streaming?: boolean;
|
|
49
|
+
metadata?: Record<string, string | number | boolean>;
|
|
50
|
+
tags?: string[];
|
|
45
51
|
attributes?: Record<string, unknown>;
|
|
46
52
|
prompt_key?: string;
|
|
47
53
|
prompt_version?: number;
|
|
@@ -58,6 +64,18 @@ interface SessionOptions {
|
|
|
58
64
|
sessionId: string;
|
|
59
65
|
/** Optional customer/user identifier for analytics */
|
|
60
66
|
customerId?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Custom key-value metadata for filtering/grouping traces.
|
|
69
|
+
* Use this for structured data like deployment type, environment, etc.
|
|
70
|
+
* @example { deployment: "dedicated", requestType: "transcript", provider: "novita" }
|
|
71
|
+
*/
|
|
72
|
+
metadata?: Record<string, string | number | boolean>;
|
|
73
|
+
/**
|
|
74
|
+
* Simple string tags for quick filtering.
|
|
75
|
+
* Use this for simple labels/categories.
|
|
76
|
+
* @example ["production", "dedicated", "transcript-analysis"]
|
|
77
|
+
*/
|
|
78
|
+
tags?: string[];
|
|
61
79
|
}
|
|
62
80
|
/**
|
|
63
81
|
* Options for wrapAISDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ interface SessionContext {
|
|
|
11
11
|
configKey: string;
|
|
12
12
|
sessionId: string;
|
|
13
13
|
customerId?: string;
|
|
14
|
+
/** Custom key-value metadata for filtering/grouping */
|
|
15
|
+
metadata?: Record<string, string | number | boolean>;
|
|
16
|
+
/** Simple string tags for quick filtering */
|
|
17
|
+
tags?: string[];
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
16
20
|
* Trace context for linking spans together.
|
|
@@ -42,6 +46,8 @@ interface TraceData {
|
|
|
42
46
|
error_message?: string;
|
|
43
47
|
time_to_first_token_ms?: number;
|
|
44
48
|
is_streaming?: boolean;
|
|
49
|
+
metadata?: Record<string, string | number | boolean>;
|
|
50
|
+
tags?: string[];
|
|
45
51
|
attributes?: Record<string, unknown>;
|
|
46
52
|
prompt_key?: string;
|
|
47
53
|
prompt_version?: number;
|
|
@@ -58,6 +64,18 @@ interface SessionOptions {
|
|
|
58
64
|
sessionId: string;
|
|
59
65
|
/** Optional customer/user identifier for analytics */
|
|
60
66
|
customerId?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Custom key-value metadata for filtering/grouping traces.
|
|
69
|
+
* Use this for structured data like deployment type, environment, etc.
|
|
70
|
+
* @example { deployment: "dedicated", requestType: "transcript", provider: "novita" }
|
|
71
|
+
*/
|
|
72
|
+
metadata?: Record<string, string | number | boolean>;
|
|
73
|
+
/**
|
|
74
|
+
* Simple string tags for quick filtering.
|
|
75
|
+
* Use this for simple labels/categories.
|
|
76
|
+
* @example ["production", "dedicated", "transcript-analysis"]
|
|
77
|
+
*/
|
|
78
|
+
tags?: string[];
|
|
61
79
|
}
|
|
62
80
|
/**
|
|
63
81
|
* Options for wrapAISDK.
|
package/dist/index.js
CHANGED
|
@@ -2118,6 +2118,8 @@ function wrapOpenAI(client, sessionCtx) {
|
|
|
2118
2118
|
config_key: ctx.configKey,
|
|
2119
2119
|
session_id: ctx.sessionId,
|
|
2120
2120
|
customer_id: ctx.customerId,
|
|
2121
|
+
metadata: ctx.metadata,
|
|
2122
|
+
tags: ctx.tags,
|
|
2121
2123
|
trace_id: traceId,
|
|
2122
2124
|
span_id: spanId,
|
|
2123
2125
|
parent_span_id: parentSpanId,
|
|
@@ -2143,6 +2145,8 @@ function wrapOpenAI(client, sessionCtx) {
|
|
|
2143
2145
|
config_key: ctx.configKey,
|
|
2144
2146
|
session_id: ctx.sessionId,
|
|
2145
2147
|
customer_id: ctx.customerId,
|
|
2148
|
+
metadata: ctx.metadata,
|
|
2149
|
+
tags: ctx.tags,
|
|
2146
2150
|
trace_id: traceId,
|
|
2147
2151
|
span_id: spanId,
|
|
2148
2152
|
parent_span_id: parentSpanId,
|
|
@@ -2238,6 +2242,8 @@ function wrapAnthropic(client, sessionCtx) {
|
|
|
2238
2242
|
config_key: ctx.configKey,
|
|
2239
2243
|
session_id: ctx.sessionId,
|
|
2240
2244
|
customer_id: ctx.customerId,
|
|
2245
|
+
metadata: ctx.metadata,
|
|
2246
|
+
tags: ctx.tags,
|
|
2241
2247
|
trace_id: traceId,
|
|
2242
2248
|
span_id: spanId,
|
|
2243
2249
|
parent_span_id: parentSpanId,
|
|
@@ -2263,6 +2269,8 @@ function wrapAnthropic(client, sessionCtx) {
|
|
|
2263
2269
|
config_key: ctx.configKey,
|
|
2264
2270
|
session_id: ctx.sessionId,
|
|
2265
2271
|
customer_id: ctx.customerId,
|
|
2272
|
+
metadata: ctx.metadata,
|
|
2273
|
+
tags: ctx.tags,
|
|
2266
2274
|
trace_id: traceId,
|
|
2267
2275
|
span_id: spanId,
|
|
2268
2276
|
parent_span_id: parentSpanId,
|
|
@@ -2353,6 +2361,8 @@ function wrapGoogleAI(model, sessionCtx) {
|
|
|
2353
2361
|
config_key: ctx.configKey,
|
|
2354
2362
|
session_id: ctx.sessionId,
|
|
2355
2363
|
customer_id: ctx.customerId,
|
|
2364
|
+
metadata: ctx.metadata,
|
|
2365
|
+
tags: ctx.tags,
|
|
2356
2366
|
trace_id: traceId,
|
|
2357
2367
|
span_id: spanId,
|
|
2358
2368
|
parent_span_id: parentSpanId,
|
|
@@ -2378,6 +2388,8 @@ function wrapGoogleAI(model, sessionCtx) {
|
|
|
2378
2388
|
config_key: ctx.configKey,
|
|
2379
2389
|
session_id: ctx.sessionId,
|
|
2380
2390
|
customer_id: ctx.customerId,
|
|
2391
|
+
metadata: ctx.metadata,
|
|
2392
|
+
tags: ctx.tags,
|
|
2381
2393
|
trace_id: traceId,
|
|
2382
2394
|
span_id: spanId,
|
|
2383
2395
|
parent_span_id: parentSpanId,
|
|
@@ -2462,10 +2474,9 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2462
2474
|
const result = await aiModule.generateText(wrappedParams);
|
|
2463
2475
|
const endTime = Date.now();
|
|
2464
2476
|
if (debug || isDebugMode()) {
|
|
2465
|
-
console.log(
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
);
|
|
2477
|
+
console.log("\n\u{1F50D} [Fallom Debug] generateText result:");
|
|
2478
|
+
console.log(" toolCalls:", result?.toolCalls?.length || 0);
|
|
2479
|
+
console.log(" steps:", result?.steps?.length || 0);
|
|
2469
2480
|
}
|
|
2470
2481
|
const modelId = result?.response?.modelId || params?.model?.modelId || String(params?.model || "unknown");
|
|
2471
2482
|
const attributes = {
|
|
@@ -2484,15 +2495,15 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2484
2495
|
const mapToolCall = (tc) => ({
|
|
2485
2496
|
toolCallId: tc?.toolCallId,
|
|
2486
2497
|
toolName: tc?.toolName,
|
|
2487
|
-
args: tc?.args,
|
|
2488
|
-
//
|
|
2498
|
+
args: tc?.args ?? tc?.input,
|
|
2499
|
+
// v4: args, v5: input
|
|
2489
2500
|
type: tc?.type
|
|
2490
2501
|
});
|
|
2491
2502
|
const mapToolResult = (tr) => ({
|
|
2492
2503
|
toolCallId: tr?.toolCallId,
|
|
2493
2504
|
toolName: tr?.toolName,
|
|
2494
|
-
result: tr?.result,
|
|
2495
|
-
//
|
|
2505
|
+
result: tr?.result ?? tr?.output,
|
|
2506
|
+
// v4: result, v5: output
|
|
2496
2507
|
type: tr?.type
|
|
2497
2508
|
});
|
|
2498
2509
|
attributes["fallom.raw.response"] = JSON.stringify({
|
|
@@ -2628,6 +2639,8 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2628
2639
|
config_key: ctx.configKey,
|
|
2629
2640
|
session_id: ctx.sessionId,
|
|
2630
2641
|
customer_id: ctx.customerId,
|
|
2642
|
+
metadata: ctx.metadata,
|
|
2643
|
+
tags: ctx.tags,
|
|
2631
2644
|
trace_id: traceId,
|
|
2632
2645
|
span_id: spanId,
|
|
2633
2646
|
parent_span_id: parentSpanId,
|
|
@@ -2654,6 +2667,8 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2654
2667
|
config_key: ctx.configKey,
|
|
2655
2668
|
session_id: ctx.sessionId,
|
|
2656
2669
|
customer_id: ctx.customerId,
|
|
2670
|
+
metadata: ctx.metadata,
|
|
2671
|
+
tags: ctx.tags,
|
|
2657
2672
|
trace_id: traceId,
|
|
2658
2673
|
span_id: spanId,
|
|
2659
2674
|
parent_span_id: parentSpanId,
|
|
@@ -2801,15 +2816,15 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2801
2816
|
const mapToolCall = (tc) => ({
|
|
2802
2817
|
toolCallId: tc?.toolCallId,
|
|
2803
2818
|
toolName: tc?.toolName,
|
|
2804
|
-
args: tc?.args,
|
|
2805
|
-
//
|
|
2819
|
+
args: tc?.args ?? tc?.input,
|
|
2820
|
+
// v4: args, v5: input
|
|
2806
2821
|
type: tc?.type
|
|
2807
2822
|
});
|
|
2808
2823
|
const mapToolResult = (tr) => ({
|
|
2809
2824
|
toolCallId: tr?.toolCallId,
|
|
2810
2825
|
toolName: tr?.toolName,
|
|
2811
|
-
result: tr?.result,
|
|
2812
|
-
//
|
|
2826
|
+
result: tr?.result ?? tr?.output,
|
|
2827
|
+
// v4: result, v5: output
|
|
2813
2828
|
type: tr?.type
|
|
2814
2829
|
});
|
|
2815
2830
|
attributes["fallom.raw.request"] = JSON.stringify({
|
|
@@ -2929,6 +2944,8 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2929
2944
|
config_key: ctx.configKey,
|
|
2930
2945
|
session_id: ctx.sessionId,
|
|
2931
2946
|
customer_id: ctx.customerId,
|
|
2947
|
+
metadata: ctx.metadata,
|
|
2948
|
+
tags: ctx.tags,
|
|
2932
2949
|
trace_id: traceId,
|
|
2933
2950
|
span_id: spanId,
|
|
2934
2951
|
parent_span_id: parentSpanId,
|
|
@@ -2957,6 +2974,8 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2957
2974
|
config_key: ctx.configKey,
|
|
2958
2975
|
session_id: ctx.sessionId,
|
|
2959
2976
|
customer_id: ctx.customerId,
|
|
2977
|
+
metadata: ctx.metadata,
|
|
2978
|
+
tags: ctx.tags,
|
|
2960
2979
|
trace_id: traceId,
|
|
2961
2980
|
span_id: spanId,
|
|
2962
2981
|
parent_span_id: parentSpanId,
|
|
@@ -3058,6 +3077,8 @@ function createGenerateObjectWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
3058
3077
|
config_key: ctx.configKey,
|
|
3059
3078
|
session_id: ctx.sessionId,
|
|
3060
3079
|
customer_id: ctx.customerId,
|
|
3080
|
+
metadata: ctx.metadata,
|
|
3081
|
+
tags: ctx.tags,
|
|
3061
3082
|
trace_id: traceId,
|
|
3062
3083
|
span_id: spanId,
|
|
3063
3084
|
parent_span_id: parentSpanId,
|
|
@@ -3084,6 +3105,8 @@ function createGenerateObjectWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
3084
3105
|
config_key: ctx.configKey,
|
|
3085
3106
|
session_id: ctx.sessionId,
|
|
3086
3107
|
customer_id: ctx.customerId,
|
|
3108
|
+
metadata: ctx.metadata,
|
|
3109
|
+
tags: ctx.tags,
|
|
3087
3110
|
trace_id: traceId,
|
|
3088
3111
|
span_id: spanId,
|
|
3089
3112
|
parent_span_id: parentSpanId,
|
|
@@ -3173,6 +3196,8 @@ function createStreamObjectWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
3173
3196
|
config_key: ctx.configKey,
|
|
3174
3197
|
session_id: ctx.sessionId,
|
|
3175
3198
|
customer_id: ctx.customerId,
|
|
3199
|
+
metadata: ctx.metadata,
|
|
3200
|
+
tags: ctx.tags,
|
|
3176
3201
|
trace_id: traceId,
|
|
3177
3202
|
span_id: spanId,
|
|
3178
3203
|
parent_span_id: parentSpanId,
|
|
@@ -3198,6 +3223,8 @@ function createStreamObjectWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
3198
3223
|
config_key: ctx.configKey,
|
|
3199
3224
|
session_id: ctx.sessionId,
|
|
3200
3225
|
customer_id: ctx.customerId,
|
|
3226
|
+
metadata: ctx.metadata,
|
|
3227
|
+
tags: ctx.tags,
|
|
3201
3228
|
trace_id: traceId,
|
|
3202
3229
|
span_id: spanId,
|
|
3203
3230
|
parent_span_id: parentSpanId,
|
|
@@ -3264,6 +3291,8 @@ function wrapMastraAgent(agent, sessionCtx) {
|
|
|
3264
3291
|
config_key: ctx.configKey,
|
|
3265
3292
|
session_id: ctx.sessionId,
|
|
3266
3293
|
customer_id: ctx.customerId,
|
|
3294
|
+
metadata: ctx.metadata,
|
|
3295
|
+
tags: ctx.tags,
|
|
3267
3296
|
trace_id: traceId,
|
|
3268
3297
|
span_id: spanId,
|
|
3269
3298
|
parent_span_id: parentSpanId,
|
|
@@ -3283,6 +3312,8 @@ function wrapMastraAgent(agent, sessionCtx) {
|
|
|
3283
3312
|
config_key: ctx.configKey,
|
|
3284
3313
|
session_id: ctx.sessionId,
|
|
3285
3314
|
customer_id: ctx.customerId,
|
|
3315
|
+
metadata: ctx.metadata,
|
|
3316
|
+
tags: ctx.tags,
|
|
3286
3317
|
trace_id: traceId,
|
|
3287
3318
|
span_id: spanId,
|
|
3288
3319
|
parent_span_id: parentSpanId,
|
|
@@ -3312,7 +3343,9 @@ var FallomSession = class {
|
|
|
3312
3343
|
this.ctx = {
|
|
3313
3344
|
configKey: options.configKey,
|
|
3314
3345
|
sessionId: options.sessionId,
|
|
3315
|
-
customerId: options.customerId
|
|
3346
|
+
customerId: options.customerId,
|
|
3347
|
+
metadata: options.metadata,
|
|
3348
|
+
tags: options.tags
|
|
3316
3349
|
};
|
|
3317
3350
|
}
|
|
3318
3351
|
/** Get the session context. */
|
|
@@ -3363,6 +3396,8 @@ var FallomSession = class {
|
|
|
3363
3396
|
config_key: ctx.configKey,
|
|
3364
3397
|
session_id: ctx.sessionId,
|
|
3365
3398
|
customer_id: ctx.customerId,
|
|
3399
|
+
metadata: ctx.metadata,
|
|
3400
|
+
tags: ctx.tags,
|
|
3366
3401
|
trace_id: traceId,
|
|
3367
3402
|
span_id: spanId,
|
|
3368
3403
|
parent_span_id: traceCtx?.parentSpanId,
|
|
@@ -3387,6 +3422,8 @@ var FallomSession = class {
|
|
|
3387
3422
|
config_key: ctx.configKey,
|
|
3388
3423
|
session_id: ctx.sessionId,
|
|
3389
3424
|
customer_id: ctx.customerId,
|
|
3425
|
+
metadata: ctx.metadata,
|
|
3426
|
+
tags: ctx.tags,
|
|
3390
3427
|
trace_id: traceId,
|
|
3391
3428
|
span_id: spanId,
|
|
3392
3429
|
parent_span_id: traceCtx?.parentSpanId,
|
|
@@ -3420,6 +3457,8 @@ var FallomSession = class {
|
|
|
3420
3457
|
config_key: ctx.configKey,
|
|
3421
3458
|
session_id: ctx.sessionId,
|
|
3422
3459
|
customer_id: ctx.customerId,
|
|
3460
|
+
metadata: ctx.metadata,
|
|
3461
|
+
tags: ctx.tags,
|
|
3423
3462
|
trace_id: traceId,
|
|
3424
3463
|
span_id: spanId,
|
|
3425
3464
|
parent_span_id: traceCtx?.parentSpanId,
|
|
@@ -3444,6 +3483,8 @@ var FallomSession = class {
|
|
|
3444
3483
|
config_key: ctx.configKey,
|
|
3445
3484
|
session_id: ctx.sessionId,
|
|
3446
3485
|
customer_id: ctx.customerId,
|
|
3486
|
+
metadata: ctx.metadata,
|
|
3487
|
+
tags: ctx.tags,
|
|
3447
3488
|
trace_id: traceId,
|
|
3448
3489
|
span_id: spanId,
|
|
3449
3490
|
parent_span_id: traceCtx?.parentSpanId,
|
package/dist/index.mjs
CHANGED
|
@@ -1123,6 +1123,8 @@ function wrapOpenAI(client, sessionCtx) {
|
|
|
1123
1123
|
config_key: ctx.configKey,
|
|
1124
1124
|
session_id: ctx.sessionId,
|
|
1125
1125
|
customer_id: ctx.customerId,
|
|
1126
|
+
metadata: ctx.metadata,
|
|
1127
|
+
tags: ctx.tags,
|
|
1126
1128
|
trace_id: traceId,
|
|
1127
1129
|
span_id: spanId,
|
|
1128
1130
|
parent_span_id: parentSpanId,
|
|
@@ -1148,6 +1150,8 @@ function wrapOpenAI(client, sessionCtx) {
|
|
|
1148
1150
|
config_key: ctx.configKey,
|
|
1149
1151
|
session_id: ctx.sessionId,
|
|
1150
1152
|
customer_id: ctx.customerId,
|
|
1153
|
+
metadata: ctx.metadata,
|
|
1154
|
+
tags: ctx.tags,
|
|
1151
1155
|
trace_id: traceId,
|
|
1152
1156
|
span_id: spanId,
|
|
1153
1157
|
parent_span_id: parentSpanId,
|
|
@@ -1243,6 +1247,8 @@ function wrapAnthropic(client, sessionCtx) {
|
|
|
1243
1247
|
config_key: ctx.configKey,
|
|
1244
1248
|
session_id: ctx.sessionId,
|
|
1245
1249
|
customer_id: ctx.customerId,
|
|
1250
|
+
metadata: ctx.metadata,
|
|
1251
|
+
tags: ctx.tags,
|
|
1246
1252
|
trace_id: traceId,
|
|
1247
1253
|
span_id: spanId,
|
|
1248
1254
|
parent_span_id: parentSpanId,
|
|
@@ -1268,6 +1274,8 @@ function wrapAnthropic(client, sessionCtx) {
|
|
|
1268
1274
|
config_key: ctx.configKey,
|
|
1269
1275
|
session_id: ctx.sessionId,
|
|
1270
1276
|
customer_id: ctx.customerId,
|
|
1277
|
+
metadata: ctx.metadata,
|
|
1278
|
+
tags: ctx.tags,
|
|
1271
1279
|
trace_id: traceId,
|
|
1272
1280
|
span_id: spanId,
|
|
1273
1281
|
parent_span_id: parentSpanId,
|
|
@@ -1358,6 +1366,8 @@ function wrapGoogleAI(model, sessionCtx) {
|
|
|
1358
1366
|
config_key: ctx.configKey,
|
|
1359
1367
|
session_id: ctx.sessionId,
|
|
1360
1368
|
customer_id: ctx.customerId,
|
|
1369
|
+
metadata: ctx.metadata,
|
|
1370
|
+
tags: ctx.tags,
|
|
1361
1371
|
trace_id: traceId,
|
|
1362
1372
|
span_id: spanId,
|
|
1363
1373
|
parent_span_id: parentSpanId,
|
|
@@ -1383,6 +1393,8 @@ function wrapGoogleAI(model, sessionCtx) {
|
|
|
1383
1393
|
config_key: ctx.configKey,
|
|
1384
1394
|
session_id: ctx.sessionId,
|
|
1385
1395
|
customer_id: ctx.customerId,
|
|
1396
|
+
metadata: ctx.metadata,
|
|
1397
|
+
tags: ctx.tags,
|
|
1386
1398
|
trace_id: traceId,
|
|
1387
1399
|
span_id: spanId,
|
|
1388
1400
|
parent_span_id: parentSpanId,
|
|
@@ -1467,10 +1479,9 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
1467
1479
|
const result = await aiModule.generateText(wrappedParams);
|
|
1468
1480
|
const endTime = Date.now();
|
|
1469
1481
|
if (debug || isDebugMode()) {
|
|
1470
|
-
console.log(
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
);
|
|
1482
|
+
console.log("\n\u{1F50D} [Fallom Debug] generateText result:");
|
|
1483
|
+
console.log(" toolCalls:", result?.toolCalls?.length || 0);
|
|
1484
|
+
console.log(" steps:", result?.steps?.length || 0);
|
|
1474
1485
|
}
|
|
1475
1486
|
const modelId = result?.response?.modelId || params?.model?.modelId || String(params?.model || "unknown");
|
|
1476
1487
|
const attributes = {
|
|
@@ -1489,15 +1500,15 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
1489
1500
|
const mapToolCall = (tc) => ({
|
|
1490
1501
|
toolCallId: tc?.toolCallId,
|
|
1491
1502
|
toolName: tc?.toolName,
|
|
1492
|
-
args: tc?.args,
|
|
1493
|
-
//
|
|
1503
|
+
args: tc?.args ?? tc?.input,
|
|
1504
|
+
// v4: args, v5: input
|
|
1494
1505
|
type: tc?.type
|
|
1495
1506
|
});
|
|
1496
1507
|
const mapToolResult = (tr) => ({
|
|
1497
1508
|
toolCallId: tr?.toolCallId,
|
|
1498
1509
|
toolName: tr?.toolName,
|
|
1499
|
-
result: tr?.result,
|
|
1500
|
-
//
|
|
1510
|
+
result: tr?.result ?? tr?.output,
|
|
1511
|
+
// v4: result, v5: output
|
|
1501
1512
|
type: tr?.type
|
|
1502
1513
|
});
|
|
1503
1514
|
attributes["fallom.raw.response"] = JSON.stringify({
|
|
@@ -1633,6 +1644,8 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
1633
1644
|
config_key: ctx.configKey,
|
|
1634
1645
|
session_id: ctx.sessionId,
|
|
1635
1646
|
customer_id: ctx.customerId,
|
|
1647
|
+
metadata: ctx.metadata,
|
|
1648
|
+
tags: ctx.tags,
|
|
1636
1649
|
trace_id: traceId,
|
|
1637
1650
|
span_id: spanId,
|
|
1638
1651
|
parent_span_id: parentSpanId,
|
|
@@ -1659,6 +1672,8 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
1659
1672
|
config_key: ctx.configKey,
|
|
1660
1673
|
session_id: ctx.sessionId,
|
|
1661
1674
|
customer_id: ctx.customerId,
|
|
1675
|
+
metadata: ctx.metadata,
|
|
1676
|
+
tags: ctx.tags,
|
|
1662
1677
|
trace_id: traceId,
|
|
1663
1678
|
span_id: spanId,
|
|
1664
1679
|
parent_span_id: parentSpanId,
|
|
@@ -1806,15 +1821,15 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
1806
1821
|
const mapToolCall = (tc) => ({
|
|
1807
1822
|
toolCallId: tc?.toolCallId,
|
|
1808
1823
|
toolName: tc?.toolName,
|
|
1809
|
-
args: tc?.args,
|
|
1810
|
-
//
|
|
1824
|
+
args: tc?.args ?? tc?.input,
|
|
1825
|
+
// v4: args, v5: input
|
|
1811
1826
|
type: tc?.type
|
|
1812
1827
|
});
|
|
1813
1828
|
const mapToolResult = (tr) => ({
|
|
1814
1829
|
toolCallId: tr?.toolCallId,
|
|
1815
1830
|
toolName: tr?.toolName,
|
|
1816
|
-
result: tr?.result,
|
|
1817
|
-
//
|
|
1831
|
+
result: tr?.result ?? tr?.output,
|
|
1832
|
+
// v4: result, v5: output
|
|
1818
1833
|
type: tr?.type
|
|
1819
1834
|
});
|
|
1820
1835
|
attributes["fallom.raw.request"] = JSON.stringify({
|
|
@@ -1934,6 +1949,8 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
1934
1949
|
config_key: ctx.configKey,
|
|
1935
1950
|
session_id: ctx.sessionId,
|
|
1936
1951
|
customer_id: ctx.customerId,
|
|
1952
|
+
metadata: ctx.metadata,
|
|
1953
|
+
tags: ctx.tags,
|
|
1937
1954
|
trace_id: traceId,
|
|
1938
1955
|
span_id: spanId,
|
|
1939
1956
|
parent_span_id: parentSpanId,
|
|
@@ -1962,6 +1979,8 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
1962
1979
|
config_key: ctx.configKey,
|
|
1963
1980
|
session_id: ctx.sessionId,
|
|
1964
1981
|
customer_id: ctx.customerId,
|
|
1982
|
+
metadata: ctx.metadata,
|
|
1983
|
+
tags: ctx.tags,
|
|
1965
1984
|
trace_id: traceId,
|
|
1966
1985
|
span_id: spanId,
|
|
1967
1986
|
parent_span_id: parentSpanId,
|
|
@@ -2063,6 +2082,8 @@ function createGenerateObjectWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2063
2082
|
config_key: ctx.configKey,
|
|
2064
2083
|
session_id: ctx.sessionId,
|
|
2065
2084
|
customer_id: ctx.customerId,
|
|
2085
|
+
metadata: ctx.metadata,
|
|
2086
|
+
tags: ctx.tags,
|
|
2066
2087
|
trace_id: traceId,
|
|
2067
2088
|
span_id: spanId,
|
|
2068
2089
|
parent_span_id: parentSpanId,
|
|
@@ -2089,6 +2110,8 @@ function createGenerateObjectWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2089
2110
|
config_key: ctx.configKey,
|
|
2090
2111
|
session_id: ctx.sessionId,
|
|
2091
2112
|
customer_id: ctx.customerId,
|
|
2113
|
+
metadata: ctx.metadata,
|
|
2114
|
+
tags: ctx.tags,
|
|
2092
2115
|
trace_id: traceId,
|
|
2093
2116
|
span_id: spanId,
|
|
2094
2117
|
parent_span_id: parentSpanId,
|
|
@@ -2178,6 +2201,8 @@ function createStreamObjectWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2178
2201
|
config_key: ctx.configKey,
|
|
2179
2202
|
session_id: ctx.sessionId,
|
|
2180
2203
|
customer_id: ctx.customerId,
|
|
2204
|
+
metadata: ctx.metadata,
|
|
2205
|
+
tags: ctx.tags,
|
|
2181
2206
|
trace_id: traceId,
|
|
2182
2207
|
span_id: spanId,
|
|
2183
2208
|
parent_span_id: parentSpanId,
|
|
@@ -2203,6 +2228,8 @@ function createStreamObjectWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2203
2228
|
config_key: ctx.configKey,
|
|
2204
2229
|
session_id: ctx.sessionId,
|
|
2205
2230
|
customer_id: ctx.customerId,
|
|
2231
|
+
metadata: ctx.metadata,
|
|
2232
|
+
tags: ctx.tags,
|
|
2206
2233
|
trace_id: traceId,
|
|
2207
2234
|
span_id: spanId,
|
|
2208
2235
|
parent_span_id: parentSpanId,
|
|
@@ -2269,6 +2296,8 @@ function wrapMastraAgent(agent, sessionCtx) {
|
|
|
2269
2296
|
config_key: ctx.configKey,
|
|
2270
2297
|
session_id: ctx.sessionId,
|
|
2271
2298
|
customer_id: ctx.customerId,
|
|
2299
|
+
metadata: ctx.metadata,
|
|
2300
|
+
tags: ctx.tags,
|
|
2272
2301
|
trace_id: traceId,
|
|
2273
2302
|
span_id: spanId,
|
|
2274
2303
|
parent_span_id: parentSpanId,
|
|
@@ -2288,6 +2317,8 @@ function wrapMastraAgent(agent, sessionCtx) {
|
|
|
2288
2317
|
config_key: ctx.configKey,
|
|
2289
2318
|
session_id: ctx.sessionId,
|
|
2290
2319
|
customer_id: ctx.customerId,
|
|
2320
|
+
metadata: ctx.metadata,
|
|
2321
|
+
tags: ctx.tags,
|
|
2291
2322
|
trace_id: traceId,
|
|
2292
2323
|
span_id: spanId,
|
|
2293
2324
|
parent_span_id: parentSpanId,
|
|
@@ -2317,7 +2348,9 @@ var FallomSession = class {
|
|
|
2317
2348
|
this.ctx = {
|
|
2318
2349
|
configKey: options.configKey,
|
|
2319
2350
|
sessionId: options.sessionId,
|
|
2320
|
-
customerId: options.customerId
|
|
2351
|
+
customerId: options.customerId,
|
|
2352
|
+
metadata: options.metadata,
|
|
2353
|
+
tags: options.tags
|
|
2321
2354
|
};
|
|
2322
2355
|
}
|
|
2323
2356
|
/** Get the session context. */
|
|
@@ -2368,6 +2401,8 @@ var FallomSession = class {
|
|
|
2368
2401
|
config_key: ctx.configKey,
|
|
2369
2402
|
session_id: ctx.sessionId,
|
|
2370
2403
|
customer_id: ctx.customerId,
|
|
2404
|
+
metadata: ctx.metadata,
|
|
2405
|
+
tags: ctx.tags,
|
|
2371
2406
|
trace_id: traceId,
|
|
2372
2407
|
span_id: spanId,
|
|
2373
2408
|
parent_span_id: traceCtx?.parentSpanId,
|
|
@@ -2392,6 +2427,8 @@ var FallomSession = class {
|
|
|
2392
2427
|
config_key: ctx.configKey,
|
|
2393
2428
|
session_id: ctx.sessionId,
|
|
2394
2429
|
customer_id: ctx.customerId,
|
|
2430
|
+
metadata: ctx.metadata,
|
|
2431
|
+
tags: ctx.tags,
|
|
2395
2432
|
trace_id: traceId,
|
|
2396
2433
|
span_id: spanId,
|
|
2397
2434
|
parent_span_id: traceCtx?.parentSpanId,
|
|
@@ -2425,6 +2462,8 @@ var FallomSession = class {
|
|
|
2425
2462
|
config_key: ctx.configKey,
|
|
2426
2463
|
session_id: ctx.sessionId,
|
|
2427
2464
|
customer_id: ctx.customerId,
|
|
2465
|
+
metadata: ctx.metadata,
|
|
2466
|
+
tags: ctx.tags,
|
|
2428
2467
|
trace_id: traceId,
|
|
2429
2468
|
span_id: spanId,
|
|
2430
2469
|
parent_span_id: traceCtx?.parentSpanId,
|
|
@@ -2449,6 +2488,8 @@ var FallomSession = class {
|
|
|
2449
2488
|
config_key: ctx.configKey,
|
|
2450
2489
|
session_id: ctx.sessionId,
|
|
2451
2490
|
customer_id: ctx.customerId,
|
|
2491
|
+
metadata: ctx.metadata,
|
|
2492
|
+
tags: ctx.tags,
|
|
2452
2493
|
trace_id: traceId,
|
|
2453
2494
|
span_id: spanId,
|
|
2454
2495
|
parent_span_id: traceCtx?.parentSpanId,
|
package/package.json
CHANGED