@fallom/trace 0.2.24 → 0.2.26
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/chunk-2NGJF2JZ.mjs +661 -0
- package/dist/chunk-3HBKT4HK.mjs +827 -0
- package/dist/{chunk-3VWF2OJX.mjs → chunk-FTZVXPQN.mjs} +25 -8
- package/dist/chunk-GZ6TE7G4.mjs +923 -0
- package/dist/chunk-XBZ3ESNV.mjs +824 -0
- package/dist/{core-Q3IHBEHB.mjs → core-46Z4Q54J.mjs} +1 -1
- package/dist/core-4L56QWI7.mjs +21 -0
- package/dist/core-DUG2SP2V.mjs +21 -0
- package/dist/core-JLHYFVYS.mjs +21 -0
- package/dist/core-NTEI2B5Z.mjs +21 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +217 -63
- package/dist/index.mjs +195 -58
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_JUDGE_MODEL,
|
|
3
|
+
_apiKey,
|
|
4
|
+
_baseUrl,
|
|
5
|
+
_initialized,
|
|
6
|
+
compareModels,
|
|
7
|
+
evaluate,
|
|
8
|
+
init,
|
|
9
|
+
uploadResultsPublic
|
|
10
|
+
} from "./chunk-3HBKT4HK.mjs";
|
|
11
|
+
import "./chunk-7P6ASYW6.mjs";
|
|
12
|
+
export {
|
|
13
|
+
DEFAULT_JUDGE_MODEL,
|
|
14
|
+
_apiKey,
|
|
15
|
+
_baseUrl,
|
|
16
|
+
_initialized,
|
|
17
|
+
compareModels,
|
|
18
|
+
evaluate,
|
|
19
|
+
init,
|
|
20
|
+
uploadResultsPublic
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_JUDGE_MODEL,
|
|
3
|
+
_apiKey,
|
|
4
|
+
_baseUrl,
|
|
5
|
+
_initialized,
|
|
6
|
+
compareModels,
|
|
7
|
+
evaluate,
|
|
8
|
+
init,
|
|
9
|
+
uploadResultsPublic
|
|
10
|
+
} from "./chunk-GZ6TE7G4.mjs";
|
|
11
|
+
import "./chunk-7P6ASYW6.mjs";
|
|
12
|
+
export {
|
|
13
|
+
DEFAULT_JUDGE_MODEL,
|
|
14
|
+
_apiKey,
|
|
15
|
+
_baseUrl,
|
|
16
|
+
_initialized,
|
|
17
|
+
compareModels,
|
|
18
|
+
evaluate,
|
|
19
|
+
init,
|
|
20
|
+
uploadResultsPublic
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_JUDGE_MODEL,
|
|
3
|
+
_apiKey,
|
|
4
|
+
_baseUrl,
|
|
5
|
+
_initialized,
|
|
6
|
+
compareModels,
|
|
7
|
+
evaluate,
|
|
8
|
+
init,
|
|
9
|
+
uploadResultsPublic
|
|
10
|
+
} from "./chunk-XBZ3ESNV.mjs";
|
|
11
|
+
import "./chunk-7P6ASYW6.mjs";
|
|
12
|
+
export {
|
|
13
|
+
DEFAULT_JUDGE_MODEL,
|
|
14
|
+
_apiKey,
|
|
15
|
+
_baseUrl,
|
|
16
|
+
_initialized,
|
|
17
|
+
compareModels,
|
|
18
|
+
evaluate,
|
|
19
|
+
init,
|
|
20
|
+
uploadResultsPublic
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_JUDGE_MODEL,
|
|
3
|
+
_apiKey,
|
|
4
|
+
_baseUrl,
|
|
5
|
+
_initialized,
|
|
6
|
+
compareModels,
|
|
7
|
+
evaluate,
|
|
8
|
+
init,
|
|
9
|
+
uploadResultsPublic
|
|
10
|
+
} from "./chunk-FTZVXPQN.mjs";
|
|
11
|
+
import "./chunk-7P6ASYW6.mjs";
|
|
12
|
+
export {
|
|
13
|
+
DEFAULT_JUDGE_MODEL,
|
|
14
|
+
_apiKey,
|
|
15
|
+
_baseUrl,
|
|
16
|
+
_initialized,
|
|
17
|
+
compareModels,
|
|
18
|
+
evaluate,
|
|
19
|
+
init,
|
|
20
|
+
uploadResultsPublic
|
|
21
|
+
};
|
package/dist/index.d.mts
CHANGED
|
@@ -445,6 +445,12 @@ interface EvalResult {
|
|
|
445
445
|
input: string;
|
|
446
446
|
output: string;
|
|
447
447
|
systemMessage?: string;
|
|
448
|
+
/** Expected/golden output for comparison (if provided) */
|
|
449
|
+
expectedOutput?: string;
|
|
450
|
+
/** Retrieved documents/context for RAG evaluation */
|
|
451
|
+
context?: string[];
|
|
452
|
+
/** Additional metadata */
|
|
453
|
+
metadata?: Record<string, unknown>;
|
|
448
454
|
model: string;
|
|
449
455
|
isProduction: boolean;
|
|
450
456
|
answerRelevancy?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -445,6 +445,12 @@ interface EvalResult {
|
|
|
445
445
|
input: string;
|
|
446
446
|
output: string;
|
|
447
447
|
systemMessage?: string;
|
|
448
|
+
/** Expected/golden output for comparison (if provided) */
|
|
449
|
+
expectedOutput?: string;
|
|
450
|
+
/** Retrieved documents/context for RAG evaluation */
|
|
451
|
+
context?: string[];
|
|
452
|
+
/** Additional metadata */
|
|
453
|
+
metadata?: Record<string, unknown>;
|
|
448
454
|
model: string;
|
|
449
455
|
isProduction: boolean;
|
|
450
456
|
answerRelevancy?: number;
|
package/dist/index.js
CHANGED
|
@@ -1047,13 +1047,22 @@ async function evaluate(options) {
|
|
|
1047
1047
|
_skipUpload = false
|
|
1048
1048
|
} = options;
|
|
1049
1049
|
let dataset;
|
|
1050
|
+
let testCaseExtras = /* @__PURE__ */ new Map();
|
|
1050
1051
|
if (testCases !== void 0 && testCases.length > 0) {
|
|
1051
|
-
dataset = testCases.map((tc) =>
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1052
|
+
dataset = testCases.map((tc, idx) => {
|
|
1053
|
+
if (tc.expectedOutput || tc.context) {
|
|
1054
|
+
testCaseExtras.set(idx, {
|
|
1055
|
+
expectedOutput: tc.expectedOutput,
|
|
1056
|
+
context: tc.context
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
return {
|
|
1060
|
+
input: tc.input,
|
|
1061
|
+
output: tc.actualOutput,
|
|
1062
|
+
systemMessage: tc.systemMessage,
|
|
1063
|
+
metadata: tc.metadata
|
|
1064
|
+
};
|
|
1065
|
+
});
|
|
1057
1066
|
} else if (datasetInput !== void 0) {
|
|
1058
1067
|
dataset = await resolveDataset(datasetInput);
|
|
1059
1068
|
} else {
|
|
@@ -1072,10 +1081,14 @@ async function evaluate(options) {
|
|
|
1072
1081
|
for (let i = 0; i < dataset.length; i++) {
|
|
1073
1082
|
const item = dataset[i];
|
|
1074
1083
|
if (verbose) console.log(`Evaluating item ${i + 1}/${dataset.length}...`);
|
|
1084
|
+
const extras = testCaseExtras.get(i);
|
|
1075
1085
|
const result = {
|
|
1076
1086
|
input: item.input,
|
|
1077
1087
|
output: item.output,
|
|
1078
1088
|
systemMessage: item.systemMessage,
|
|
1089
|
+
expectedOutput: extras?.expectedOutput,
|
|
1090
|
+
context: extras?.context,
|
|
1091
|
+
metadata: item.metadata,
|
|
1079
1092
|
model: "production",
|
|
1080
1093
|
isProduction: true,
|
|
1081
1094
|
reasoning: {}
|
|
@@ -1175,6 +1188,7 @@ async function compareModels(options) {
|
|
|
1175
1188
|
input: item.input,
|
|
1176
1189
|
output,
|
|
1177
1190
|
systemMessage: item.systemMessage,
|
|
1191
|
+
metadata: item.metadata,
|
|
1178
1192
|
model: model.name,
|
|
1179
1193
|
isProduction: false,
|
|
1180
1194
|
reasoning: {},
|
|
@@ -1286,6 +1300,9 @@ async function uploadResults(results, name, description, judgeModel, verbose) {
|
|
|
1286
1300
|
results: allResults.map((r) => ({
|
|
1287
1301
|
input: r.input,
|
|
1288
1302
|
system_message: r.systemMessage,
|
|
1303
|
+
expected_output: r.expectedOutput,
|
|
1304
|
+
context: r.context,
|
|
1305
|
+
metadata: r.metadata,
|
|
1289
1306
|
model: r.model,
|
|
1290
1307
|
output: r.output,
|
|
1291
1308
|
is_production: r.isProduction,
|
|
@@ -1395,7 +1412,7 @@ var import_exporter_trace_otlp_http = require("@opentelemetry/exporter-trace-otl
|
|
|
1395
1412
|
// node_modules/@opentelemetry/resources/build/esm/Resource.js
|
|
1396
1413
|
var import_api = require("@opentelemetry/api");
|
|
1397
1414
|
|
|
1398
|
-
// node_modules/@opentelemetry/
|
|
1415
|
+
// node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js
|
|
1399
1416
|
var SemanticResourceAttributes = {
|
|
1400
1417
|
/**
|
|
1401
1418
|
* Name of the cloud provider.
|
|
@@ -2842,6 +2859,101 @@ function wrapGoogleAI(model, sessionCtx) {
|
|
|
2842
2859
|
return model;
|
|
2843
2860
|
}
|
|
2844
2861
|
|
|
2862
|
+
// src/trace/wrappers/vercel-ai/utils.ts
|
|
2863
|
+
function extractProviderInfo(model, aiModule, result) {
|
|
2864
|
+
const info = {};
|
|
2865
|
+
try {
|
|
2866
|
+
if (aiModule) {
|
|
2867
|
+
info.aiSdkVersion = aiModule.version ?? aiModule.VERSION ?? void 0;
|
|
2868
|
+
}
|
|
2869
|
+
if (!model) return info;
|
|
2870
|
+
info.modelId = model.modelId ?? model.id ?? String(model);
|
|
2871
|
+
if (model.provider) {
|
|
2872
|
+
if (typeof model.provider === "string") {
|
|
2873
|
+
info.provider = model.provider;
|
|
2874
|
+
} else if (typeof model.provider === "object") {
|
|
2875
|
+
info.provider = model.provider.id ?? model.provider.name;
|
|
2876
|
+
info.providerId = model.provider.id;
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
if (model.providerId) {
|
|
2880
|
+
info.providerId = model.providerId;
|
|
2881
|
+
}
|
|
2882
|
+
const baseUrl4 = model.config?.baseURL ?? model.config?.baseUrl ?? model.settings?.baseURL ?? model.settings?.baseUrl ?? model.baseURL ?? model.baseUrl;
|
|
2883
|
+
if (baseUrl4 && typeof baseUrl4 === "string") {
|
|
2884
|
+
info.baseUrl = baseUrl4;
|
|
2885
|
+
if (!info.provider) {
|
|
2886
|
+
if (baseUrl4.includes("openrouter.ai")) {
|
|
2887
|
+
info.provider = "openrouter";
|
|
2888
|
+
} else if (baseUrl4.includes("api.openai.com")) {
|
|
2889
|
+
info.provider = "openai";
|
|
2890
|
+
} else if (baseUrl4.includes("api.anthropic.com")) {
|
|
2891
|
+
info.provider = "anthropic";
|
|
2892
|
+
} else if (baseUrl4.includes("generativelanguage.googleapis.com")) {
|
|
2893
|
+
info.provider = "google";
|
|
2894
|
+
} else if (baseUrl4.includes("api.mistral.ai")) {
|
|
2895
|
+
info.provider = "mistral";
|
|
2896
|
+
} else if (baseUrl4.includes("api.together.xyz")) {
|
|
2897
|
+
info.provider = "together";
|
|
2898
|
+
} else if (baseUrl4.includes("api.groq.com")) {
|
|
2899
|
+
info.provider = "groq";
|
|
2900
|
+
} else if (baseUrl4.includes("localhost") || baseUrl4.includes("127.0.0.1")) {
|
|
2901
|
+
info.provider = "local";
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
if (!info.provider && info.modelId) {
|
|
2906
|
+
const modelStr = String(info.modelId).toLowerCase();
|
|
2907
|
+
if (modelStr.includes("gpt-") || modelStr.includes("o1-") || modelStr.includes("text-embedding")) {
|
|
2908
|
+
info.provider = info.provider ?? "openai";
|
|
2909
|
+
} else if (modelStr.includes("claude-")) {
|
|
2910
|
+
info.provider = info.provider ?? "anthropic";
|
|
2911
|
+
} else if (modelStr.includes("gemini-") || modelStr.includes("gemma-")) {
|
|
2912
|
+
info.provider = info.provider ?? "google";
|
|
2913
|
+
} else if (modelStr.includes("mistral-") || modelStr.includes("mixtral-")) {
|
|
2914
|
+
info.provider = info.provider ?? "mistral";
|
|
2915
|
+
} else if (modelStr.includes("llama-") || modelStr.includes("meta-llama")) {
|
|
2916
|
+
info.provider = info.provider ?? "meta";
|
|
2917
|
+
} else if (modelStr.includes("/")) {
|
|
2918
|
+
info.provider = info.provider ?? "openrouter";
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
if (result?.response) {
|
|
2922
|
+
if (!info.modelId && result.response.modelId) {
|
|
2923
|
+
info.modelId = result.response.modelId;
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
info.raw = {};
|
|
2927
|
+
if (model.modelId) info.raw.modelId = model.modelId;
|
|
2928
|
+
if (model.provider) {
|
|
2929
|
+
info.raw.provider = typeof model.provider === "object" ? { id: model.provider.id, name: model.provider.name } : model.provider;
|
|
2930
|
+
}
|
|
2931
|
+
if (model.providerId) info.raw.providerId = model.providerId;
|
|
2932
|
+
if (model.specificationVersion) info.raw.specificationVersion = model.specificationVersion;
|
|
2933
|
+
} catch {
|
|
2934
|
+
}
|
|
2935
|
+
return info;
|
|
2936
|
+
}
|
|
2937
|
+
function providerInfoToAttributes(info) {
|
|
2938
|
+
const attrs = {};
|
|
2939
|
+
if (info.provider) {
|
|
2940
|
+
attrs["fallom.provider"] = info.provider;
|
|
2941
|
+
}
|
|
2942
|
+
if (info.providerId) {
|
|
2943
|
+
attrs["fallom.provider_id"] = info.providerId;
|
|
2944
|
+
}
|
|
2945
|
+
if (info.baseUrl) {
|
|
2946
|
+
attrs["fallom.base_url"] = info.baseUrl;
|
|
2947
|
+
}
|
|
2948
|
+
if (info.aiSdkVersion) {
|
|
2949
|
+
attrs["fallom.ai_sdk_version"] = info.aiSdkVersion;
|
|
2950
|
+
}
|
|
2951
|
+
if (info.raw && Object.keys(info.raw).length > 0) {
|
|
2952
|
+
attrs["fallom.provider_raw"] = JSON.stringify(info.raw);
|
|
2953
|
+
}
|
|
2954
|
+
return attrs;
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2845
2957
|
// src/trace/wrappers/vercel-ai/generate-text.ts
|
|
2846
2958
|
function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
2847
2959
|
const ctx = sessionCtx;
|
|
@@ -2865,34 +2977,44 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2865
2977
|
)) {
|
|
2866
2978
|
if (tool && typeof tool.execute === "function") {
|
|
2867
2979
|
const originalExecute = tool.execute;
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2980
|
+
const wrappedTool = Object.create(Object.getPrototypeOf(tool) || {});
|
|
2981
|
+
const allKeys = [
|
|
2982
|
+
...Object.getOwnPropertyNames(tool),
|
|
2983
|
+
...Object.getOwnPropertySymbols(tool)
|
|
2984
|
+
];
|
|
2985
|
+
for (const key of allKeys) {
|
|
2986
|
+
if (key === "execute") continue;
|
|
2987
|
+
const descriptor = Object.getOwnPropertyDescriptor(tool, key);
|
|
2988
|
+
if (descriptor) {
|
|
2989
|
+
Object.defineProperty(wrappedTool, key, descriptor);
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
wrappedTool.execute = async (...executeArgs) => {
|
|
2993
|
+
const toolStartTime = Date.now();
|
|
2994
|
+
const toolCallId = `${toolName}-${toolStartTime}`;
|
|
2995
|
+
try {
|
|
2996
|
+
const result = await originalExecute(...executeArgs);
|
|
2997
|
+
const toolEndTime = Date.now();
|
|
2998
|
+
toolTimings.set(toolCallId, {
|
|
2999
|
+
name: toolName,
|
|
3000
|
+
startTime: toolStartTime - startTime,
|
|
3001
|
+
// Relative to request start
|
|
3002
|
+
endTime: toolEndTime - startTime,
|
|
3003
|
+
duration: toolEndTime - toolStartTime
|
|
3004
|
+
});
|
|
3005
|
+
return result;
|
|
3006
|
+
} catch (error) {
|
|
3007
|
+
const toolEndTime = Date.now();
|
|
3008
|
+
toolTimings.set(toolCallId, {
|
|
3009
|
+
name: toolName,
|
|
3010
|
+
startTime: toolStartTime - startTime,
|
|
3011
|
+
endTime: toolEndTime - startTime,
|
|
3012
|
+
duration: toolEndTime - toolStartTime
|
|
3013
|
+
});
|
|
3014
|
+
throw error;
|
|
2894
3015
|
}
|
|
2895
3016
|
};
|
|
3017
|
+
wrappedTools[toolName] = wrappedTool;
|
|
2896
3018
|
} else {
|
|
2897
3019
|
wrappedTools[toolName] = tool;
|
|
2898
3020
|
}
|
|
@@ -2908,9 +3030,12 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2908
3030
|
console.log(" steps:", result?.steps?.length || 0);
|
|
2909
3031
|
}
|
|
2910
3032
|
const modelId = result?.response?.modelId || params?.model?.modelId || String(params?.model || "unknown");
|
|
3033
|
+
const providerInfo = extractProviderInfo(params?.model, aiModule, result);
|
|
2911
3034
|
const attributes = {
|
|
2912
3035
|
"fallom.sdk_version": "2",
|
|
2913
|
-
"fallom.method": "generateText"
|
|
3036
|
+
"fallom.method": "generateText",
|
|
3037
|
+
// Provider info for debugging
|
|
3038
|
+
...providerInfoToAttributes(providerInfo)
|
|
2914
3039
|
};
|
|
2915
3040
|
if (captureContent2) {
|
|
2916
3041
|
attributes["fallom.raw.request"] = JSON.stringify({
|
|
@@ -2924,7 +3049,17 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
2924
3049
|
const mapToolCall = (tc) => {
|
|
2925
3050
|
let args2 = tc?.args ?? tc?.input;
|
|
2926
3051
|
if (args2 === void 0 && tc) {
|
|
2927
|
-
const {
|
|
3052
|
+
const {
|
|
3053
|
+
type,
|
|
3054
|
+
toolCallId,
|
|
3055
|
+
toolName,
|
|
3056
|
+
providerExecuted,
|
|
3057
|
+
dynamic,
|
|
3058
|
+
invalid,
|
|
3059
|
+
error,
|
|
3060
|
+
providerMetadata,
|
|
3061
|
+
...rest
|
|
3062
|
+
} = tc;
|
|
2928
3063
|
if (Object.keys(rest).length > 0) {
|
|
2929
3064
|
args2 = rest;
|
|
2930
3065
|
}
|
|
@@ -3168,33 +3303,43 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
3168
3303
|
)) {
|
|
3169
3304
|
if (tool && typeof tool.execute === "function") {
|
|
3170
3305
|
const originalExecute = tool.execute;
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3306
|
+
const wrappedTool = Object.create(Object.getPrototypeOf(tool) || {});
|
|
3307
|
+
const allKeys = [
|
|
3308
|
+
...Object.getOwnPropertyNames(tool),
|
|
3309
|
+
...Object.getOwnPropertySymbols(tool)
|
|
3310
|
+
];
|
|
3311
|
+
for (const key of allKeys) {
|
|
3312
|
+
if (key === "execute") continue;
|
|
3313
|
+
const descriptor = Object.getOwnPropertyDescriptor(tool, key);
|
|
3314
|
+
if (descriptor) {
|
|
3315
|
+
Object.defineProperty(wrappedTool, key, descriptor);
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
wrappedTool.execute = async (...executeArgs) => {
|
|
3319
|
+
const toolStartTime = Date.now();
|
|
3320
|
+
const toolCallId = `${toolName}-${toolStartTime}`;
|
|
3321
|
+
try {
|
|
3322
|
+
const result2 = await originalExecute(...executeArgs);
|
|
3323
|
+
const toolEndTime = Date.now();
|
|
3324
|
+
toolTimings.set(toolCallId, {
|
|
3325
|
+
name: toolName,
|
|
3326
|
+
startTime: toolStartTime - startTime,
|
|
3327
|
+
endTime: toolEndTime - startTime,
|
|
3328
|
+
duration: toolEndTime - toolStartTime
|
|
3329
|
+
});
|
|
3330
|
+
return result2;
|
|
3331
|
+
} catch (error) {
|
|
3332
|
+
const toolEndTime = Date.now();
|
|
3333
|
+
toolTimings.set(toolCallId, {
|
|
3334
|
+
name: toolName,
|
|
3335
|
+
startTime: toolStartTime - startTime,
|
|
3336
|
+
endTime: toolEndTime - startTime,
|
|
3337
|
+
duration: toolEndTime - toolStartTime
|
|
3338
|
+
});
|
|
3339
|
+
throw error;
|
|
3196
3340
|
}
|
|
3197
3341
|
};
|
|
3342
|
+
wrappedTools[toolName] = wrappedTool;
|
|
3198
3343
|
} else {
|
|
3199
3344
|
wrappedTools[toolName] = tool;
|
|
3200
3345
|
}
|
|
@@ -3305,10 +3450,13 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
3305
3450
|
providerMetadata = void 0;
|
|
3306
3451
|
}
|
|
3307
3452
|
}
|
|
3453
|
+
const providerInfo = extractProviderInfo(params?.model, aiModule, result);
|
|
3308
3454
|
const attributes = {
|
|
3309
3455
|
"fallom.sdk_version": "2",
|
|
3310
3456
|
"fallom.method": "streamText",
|
|
3311
|
-
"fallom.is_streaming": true
|
|
3457
|
+
"fallom.is_streaming": true,
|
|
3458
|
+
// Provider info for debugging
|
|
3459
|
+
...providerInfoToAttributes(providerInfo)
|
|
3312
3460
|
};
|
|
3313
3461
|
if (captureContent2) {
|
|
3314
3462
|
const mapToolCall = (tc) => {
|
|
@@ -3579,9 +3727,12 @@ function createGenerateObjectWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
3579
3727
|
);
|
|
3580
3728
|
}
|
|
3581
3729
|
const modelId = result?.response?.modelId || params?.model?.modelId || String(params?.model || "unknown");
|
|
3730
|
+
const providerInfo = extractProviderInfo(params?.model, aiModule, result);
|
|
3582
3731
|
const attributes = {
|
|
3583
3732
|
"fallom.sdk_version": "2",
|
|
3584
|
-
"fallom.method": "generateObject"
|
|
3733
|
+
"fallom.method": "generateObject",
|
|
3734
|
+
// Provider info for debugging
|
|
3735
|
+
...providerInfoToAttributes(providerInfo)
|
|
3585
3736
|
};
|
|
3586
3737
|
if (captureContent2) {
|
|
3587
3738
|
attributes["fallom.raw.request"] = JSON.stringify({
|
|
@@ -3704,10 +3855,13 @@ function createStreamObjectWrapper(aiModule, sessionCtx, debug = false) {
|
|
|
3704
3855
|
providerMetadata = void 0;
|
|
3705
3856
|
}
|
|
3706
3857
|
}
|
|
3858
|
+
const providerInfo = extractProviderInfo(params?.model, aiModule, result);
|
|
3707
3859
|
const attributes = {
|
|
3708
3860
|
"fallom.sdk_version": "2",
|
|
3709
3861
|
"fallom.method": "streamObject",
|
|
3710
|
-
"fallom.is_streaming": true
|
|
3862
|
+
"fallom.is_streaming": true,
|
|
3863
|
+
// Provider info for debugging
|
|
3864
|
+
...providerInfoToAttributes(providerInfo)
|
|
3711
3865
|
};
|
|
3712
3866
|
if (captureContent2) {
|
|
3713
3867
|
attributes["fallom.raw.request"] = JSON.stringify({
|