braintrust 3.31.0 → 3.32.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/dev/dist/index.d.mts +736 -0
- package/dev/dist/index.d.ts +736 -0
- package/dev/dist/index.js +1280 -428
- package/dev/dist/index.mjs +859 -7
- package/dist/apply-auto-instrumentation.js +281 -216
- package/dist/apply-auto-instrumentation.mjs +66 -1
- package/dist/auto-instrumentations/bundler/esbuild.cjs +104 -2
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/next.cjs +104 -2
- package/dist/auto-instrumentations/bundler/next.mjs +3 -3
- package/dist/auto-instrumentations/bundler/rollup.cjs +104 -2
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +104 -2
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +104 -2
- package/dist/auto-instrumentations/bundler/webpack.cjs +104 -2
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
- package/dist/auto-instrumentations/{chunk-U64OYU4Q.mjs → chunk-AFND2U7E.mjs} +38 -1
- package/dist/auto-instrumentations/{chunk-OXINGIEZ.mjs → chunk-QEEPRBIS.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-LW4HDHXT.mjs → chunk-RI4Y55ZF.mjs} +69 -2
- package/dist/auto-instrumentations/hook.mjs +124 -3
- package/dist/auto-instrumentations/index.cjs +39 -1
- package/dist/auto-instrumentations/index.d.mts +3 -1
- package/dist/auto-instrumentations/index.d.ts +3 -1
- package/dist/auto-instrumentations/index.mjs +3 -1
- package/dist/browser.d.mts +2124 -2
- package/dist/browser.d.ts +2124 -2
- package/dist/browser.js +994 -10
- package/dist/browser.mjs +994 -10
- package/dist/{chunk-AJT4FR25.mjs → chunk-4QSAHP7D.mjs} +818 -5
- package/dist/{chunk-4AQGZS6X.js → chunk-AW4QECG5.js} +47 -4
- package/dist/{chunk-V32LW47Z.js → chunk-BTRLPQG5.js} +1663 -850
- package/dist/{chunk-CE3BLB2L.mjs → chunk-WV6QZI2W.mjs} +46 -3
- package/dist/cli.js +923 -8
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +994 -10
- package/dist/edge-light.mjs +994 -10
- package/dist/index.d.mts +2124 -2
- package/dist/index.d.ts +2124 -2
- package/dist/index.js +581 -447
- package/dist/index.mjs +136 -2
- package/dist/instrumentation/index.d.mts +434 -0
- package/dist/instrumentation/index.d.ts +434 -0
- package/dist/instrumentation/index.js +859 -7
- package/dist/instrumentation/index.mjs +859 -7
- package/dist/vitest-evals-reporter.js +16 -16
- package/dist/vitest-evals-reporter.mjs +2 -2
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +994 -10
- package/dist/workerd.mjs +994 -10
- package/package.json +1 -1
- package/util/dist/index.d.mts +326 -0
- package/util/dist/index.d.ts +326 -0
package/dist/index.mjs
CHANGED
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
wrapMastraAgent,
|
|
144
144
|
wrapTraced,
|
|
145
145
|
zodToJsonSchema
|
|
146
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-4QSAHP7D.mjs";
|
|
147
147
|
import {
|
|
148
148
|
INSTRUMENTATION_NAMES,
|
|
149
149
|
__export,
|
|
@@ -156,10 +156,12 @@ import {
|
|
|
156
156
|
cohereChannels,
|
|
157
157
|
cursorSDKChannels,
|
|
158
158
|
debugLogger,
|
|
159
|
+
elevenLabsChannels,
|
|
159
160
|
genkitChannels,
|
|
160
161
|
gitHubCopilotChannels,
|
|
161
162
|
googleADKChannels,
|
|
162
163
|
googleGenAIChannels,
|
|
164
|
+
googleGenerativeAIChannels,
|
|
163
165
|
groqChannels,
|
|
164
166
|
harnessAgentChannels,
|
|
165
167
|
huggingFaceChannels,
|
|
@@ -177,7 +179,7 @@ import {
|
|
|
177
179
|
strandsAgentSDKChannels,
|
|
178
180
|
voyageAIChannels,
|
|
179
181
|
withSpanInstrumentationName
|
|
180
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-WV6QZI2W.mjs";
|
|
181
183
|
|
|
182
184
|
// src/exports.ts
|
|
183
185
|
var exports_exports = {};
|
|
@@ -343,9 +345,11 @@ __export(exports_exports, {
|
|
|
343
345
|
wrapCohere: () => wrapCohere,
|
|
344
346
|
wrapCopilotClient: () => wrapCopilotClient,
|
|
345
347
|
wrapCursorSDK: () => wrapCursorSDK,
|
|
348
|
+
wrapElevenLabs: () => wrapElevenLabs,
|
|
346
349
|
wrapGenkit: () => wrapGenkit,
|
|
347
350
|
wrapGoogleADK: () => wrapGoogleADK,
|
|
348
351
|
wrapGoogleGenAI: () => wrapGoogleGenAI,
|
|
352
|
+
wrapGoogleGenerativeAI: () => wrapGoogleGenerativeAI,
|
|
349
353
|
wrapGroq: () => wrapGroq,
|
|
350
354
|
wrapHuggingFace: () => wrapHuggingFace,
|
|
351
355
|
wrapHuggingFaceTransformers: () => wrapHuggingFaceTransformers,
|
|
@@ -5214,6 +5218,75 @@ function isModuleNamespace5(value) {
|
|
|
5214
5218
|
}
|
|
5215
5219
|
}
|
|
5216
5220
|
|
|
5221
|
+
// src/wrappers/google-generative-ai.ts
|
|
5222
|
+
function wrapGoogleGenerativeAI(client) {
|
|
5223
|
+
if (!isObject(client) || typeof client.getGenerativeModel !== "function")
|
|
5224
|
+
return client;
|
|
5225
|
+
return wrapClient(client);
|
|
5226
|
+
}
|
|
5227
|
+
var proxies = /* @__PURE__ */ new WeakMap();
|
|
5228
|
+
function wrapClient(client) {
|
|
5229
|
+
const cached = proxies.get(client);
|
|
5230
|
+
if (cached) return cached;
|
|
5231
|
+
const proxy = new Proxy(client, {
|
|
5232
|
+
get(target, prop, receiver) {
|
|
5233
|
+
const value = Reflect.get(target, prop, receiver);
|
|
5234
|
+
if (typeof value !== "function") return value;
|
|
5235
|
+
if (prop === "getGenerativeModel" || prop === "getGenerativeModelFromCachedContent" || prop === "startChat") {
|
|
5236
|
+
return (...args) => wrapClient(Reflect.apply(value, target, args));
|
|
5237
|
+
}
|
|
5238
|
+
switch (prop) {
|
|
5239
|
+
case "generateContent":
|
|
5240
|
+
return (...args) => googleGenerativeAIChannels.generateContent.invoke(
|
|
5241
|
+
value,
|
|
5242
|
+
target,
|
|
5243
|
+
args,
|
|
5244
|
+
{}
|
|
5245
|
+
);
|
|
5246
|
+
case "generateContentStream":
|
|
5247
|
+
return (...args) => googleGenerativeAIChannels.generateContentStream.invoke(
|
|
5248
|
+
value,
|
|
5249
|
+
target,
|
|
5250
|
+
args,
|
|
5251
|
+
{}
|
|
5252
|
+
);
|
|
5253
|
+
case "embedContent":
|
|
5254
|
+
return (...args) => googleGenerativeAIChannels.embedContent.invoke(
|
|
5255
|
+
value,
|
|
5256
|
+
target,
|
|
5257
|
+
args,
|
|
5258
|
+
{}
|
|
5259
|
+
);
|
|
5260
|
+
case "batchEmbedContents":
|
|
5261
|
+
return (...args) => googleGenerativeAIChannels.batchEmbedContents.invoke(
|
|
5262
|
+
value,
|
|
5263
|
+
target,
|
|
5264
|
+
args,
|
|
5265
|
+
{}
|
|
5266
|
+
);
|
|
5267
|
+
case "sendMessage":
|
|
5268
|
+
return (...args) => googleGenerativeAIChannels.sendMessage.invoke(
|
|
5269
|
+
value,
|
|
5270
|
+
target,
|
|
5271
|
+
args,
|
|
5272
|
+
{}
|
|
5273
|
+
);
|
|
5274
|
+
case "sendMessageStream":
|
|
5275
|
+
return (...args) => googleGenerativeAIChannels.sendMessageStream.invoke(
|
|
5276
|
+
value,
|
|
5277
|
+
target,
|
|
5278
|
+
args,
|
|
5279
|
+
{}
|
|
5280
|
+
);
|
|
5281
|
+
}
|
|
5282
|
+
return value.bind(target);
|
|
5283
|
+
}
|
|
5284
|
+
});
|
|
5285
|
+
proxies.set(client, proxy);
|
|
5286
|
+
proxies.set(proxy, proxy);
|
|
5287
|
+
return proxy;
|
|
5288
|
+
}
|
|
5289
|
+
|
|
5217
5290
|
// src/wrappers/google-genai.ts
|
|
5218
5291
|
function wrapGoogleGenAI(googleGenAI) {
|
|
5219
5292
|
if (!googleGenAI || typeof googleGenAI !== "object") {
|
|
@@ -12534,6 +12607,65 @@ var evaluatorDefinitionsSchema = z5.record(
|
|
|
12534
12607
|
evaluatorDefinitionSchema
|
|
12535
12608
|
);
|
|
12536
12609
|
|
|
12610
|
+
// src/wrappers/elevenlabs.ts
|
|
12611
|
+
var clients = /* @__PURE__ */ new WeakMap();
|
|
12612
|
+
function wrapElevenLabs(client) {
|
|
12613
|
+
if (!isObject(client) || !isObject(client.textToSpeech) || typeof client.textToSpeech.convert !== "function") {
|
|
12614
|
+
debugLogger.warn("Unsupported ElevenLabs client. Not wrapping.");
|
|
12615
|
+
return client;
|
|
12616
|
+
}
|
|
12617
|
+
const cached = clients.get(client);
|
|
12618
|
+
if (cached) return cached;
|
|
12619
|
+
const sdk = client;
|
|
12620
|
+
const speech = new Proxy(sdk.textToSpeech, {
|
|
12621
|
+
get(target, prop, receiver) {
|
|
12622
|
+
switch (prop) {
|
|
12623
|
+
case "convert":
|
|
12624
|
+
case "stream":
|
|
12625
|
+
return (...args) => elevenLabsChannels[prop].invoke(target[prop], target, args, {});
|
|
12626
|
+
case "convertWithTimestamps":
|
|
12627
|
+
return (...args) => elevenLabsChannels.convertWithTimestamps.invoke(
|
|
12628
|
+
target.convertWithTimestamps,
|
|
12629
|
+
target,
|
|
12630
|
+
args,
|
|
12631
|
+
{}
|
|
12632
|
+
);
|
|
12633
|
+
case "streamWithTimestamps":
|
|
12634
|
+
return (...args) => elevenLabsChannels.streamWithTimestamps.invoke(
|
|
12635
|
+
target.streamWithTimestamps,
|
|
12636
|
+
target,
|
|
12637
|
+
args,
|
|
12638
|
+
{}
|
|
12639
|
+
);
|
|
12640
|
+
default:
|
|
12641
|
+
return Reflect.get(target, prop, receiver);
|
|
12642
|
+
}
|
|
12643
|
+
}
|
|
12644
|
+
});
|
|
12645
|
+
const transcription = new Proxy(sdk.speechToText, {
|
|
12646
|
+
get(target, prop, receiver) {
|
|
12647
|
+
if (prop === "convert")
|
|
12648
|
+
return (request, options) => elevenLabsChannels.transcribe.invoke(
|
|
12649
|
+
target.convert,
|
|
12650
|
+
target,
|
|
12651
|
+
[request, options],
|
|
12652
|
+
{}
|
|
12653
|
+
);
|
|
12654
|
+
return Reflect.get(target, prop, receiver);
|
|
12655
|
+
}
|
|
12656
|
+
});
|
|
12657
|
+
const proxy = new Proxy(sdk, {
|
|
12658
|
+
get(target, prop, receiver) {
|
|
12659
|
+
if (prop === "textToSpeech") return speech;
|
|
12660
|
+
if (prop === "speechToText") return transcription;
|
|
12661
|
+
return Reflect.get(target, prop, receiver);
|
|
12662
|
+
}
|
|
12663
|
+
});
|
|
12664
|
+
clients.set(client, proxy);
|
|
12665
|
+
clients.set(proxy, proxy);
|
|
12666
|
+
return proxy;
|
|
12667
|
+
}
|
|
12668
|
+
|
|
12537
12669
|
// src/node/index.ts
|
|
12538
12670
|
configureNode();
|
|
12539
12671
|
export {
|
|
@@ -12699,9 +12831,11 @@ export {
|
|
|
12699
12831
|
wrapCohere,
|
|
12700
12832
|
wrapCopilotClient,
|
|
12701
12833
|
wrapCursorSDK,
|
|
12834
|
+
wrapElevenLabs,
|
|
12702
12835
|
wrapGenkit,
|
|
12703
12836
|
wrapGoogleADK,
|
|
12704
12837
|
wrapGoogleGenAI,
|
|
12838
|
+
wrapGoogleGenerativeAI,
|
|
12705
12839
|
wrapGroq,
|
|
12706
12840
|
wrapHuggingFace,
|
|
12707
12841
|
wrapHuggingFaceTransformers,
|