braintrust 3.30.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.
Files changed (55) hide show
  1. package/dev/dist/index.d.mts +740 -1
  2. package/dev/dist/index.d.ts +740 -1
  3. package/dev/dist/index.js +1307 -434
  4. package/dev/dist/index.mjs +886 -13
  5. package/dist/apply-auto-instrumentation.js +281 -216
  6. package/dist/apply-auto-instrumentation.mjs +66 -1
  7. package/dist/auto-instrumentations/bundler/esbuild.cjs +104 -2
  8. package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
  9. package/dist/auto-instrumentations/bundler/next.cjs +113 -5
  10. package/dist/auto-instrumentations/bundler/next.mjs +12 -6
  11. package/dist/auto-instrumentations/bundler/rollup.cjs +104 -2
  12. package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
  13. package/dist/auto-instrumentations/bundler/vite.cjs +104 -2
  14. package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
  15. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +104 -2
  16. package/dist/auto-instrumentations/bundler/webpack.cjs +104 -2
  17. package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
  18. package/dist/auto-instrumentations/{chunk-U64OYU4Q.mjs → chunk-AFND2U7E.mjs} +38 -1
  19. package/dist/auto-instrumentations/{chunk-OXINGIEZ.mjs → chunk-QEEPRBIS.mjs} +1 -1
  20. package/dist/auto-instrumentations/{chunk-LW4HDHXT.mjs → chunk-RI4Y55ZF.mjs} +69 -2
  21. package/dist/auto-instrumentations/hook.mjs +126 -3
  22. package/dist/auto-instrumentations/index.cjs +39 -1
  23. package/dist/auto-instrumentations/index.d.mts +3 -1
  24. package/dist/auto-instrumentations/index.d.ts +3 -1
  25. package/dist/auto-instrumentations/index.mjs +3 -1
  26. package/dist/browser.d.mts +3052 -927
  27. package/dist/browser.d.ts +3052 -927
  28. package/dist/browser.js +1023 -18
  29. package/dist/browser.mjs +1023 -18
  30. package/dist/{chunk-BU6SM54N.mjs → chunk-4QSAHP7D.mjs} +834 -10
  31. package/dist/{chunk-2XDW3UCG.js → chunk-AW4QECG5.js} +47 -4
  32. package/dist/{chunk-TWCDSYJN.js → chunk-BTRLPQG5.js} +1679 -855
  33. package/dist/{chunk-N3JKQ3D3.mjs → chunk-WV6QZI2W.mjs} +46 -3
  34. package/dist/cli.js +950 -14
  35. package/dist/edge-light.d.mts +1 -1
  36. package/dist/edge-light.d.ts +1 -1
  37. package/dist/edge-light.js +1023 -18
  38. package/dist/edge-light.mjs +1023 -18
  39. package/dist/index.d.mts +3052 -927
  40. package/dist/index.d.ts +3052 -927
  41. package/dist/index.js +594 -450
  42. package/dist/index.mjs +149 -5
  43. package/dist/instrumentation/index.d.mts +434 -0
  44. package/dist/instrumentation/index.d.ts +434 -0
  45. package/dist/instrumentation/index.js +875 -12
  46. package/dist/instrumentation/index.mjs +875 -12
  47. package/dist/vitest-evals-reporter.js +16 -16
  48. package/dist/vitest-evals-reporter.mjs +2 -2
  49. package/dist/workerd.d.mts +1 -1
  50. package/dist/workerd.d.ts +1 -1
  51. package/dist/workerd.js +1023 -18
  52. package/dist/workerd.mjs +1023 -18
  53. package/package.json +1 -1
  54. package/util/dist/index.d.mts +326 -0
  55. package/util/dist/index.d.ts +326 -0
@@ -2960,6 +2960,14 @@ var ChatCompletionContentPartImageWithTitle = import_v36.z.object({
2960
2960
  ttl: import_v36.z.enum(["5m", "1h"]).optional()
2961
2961
  }).optional()
2962
2962
  });
2963
+ var ChatCompletionContentPartInputAudioWithTitle = import_v36.z.object({
2964
+ input_audio: import_v36.z.object({ data: import_v36.z.string(), format: import_v36.z.enum(["wav", "mp3"]) }),
2965
+ type: import_v36.z.literal("input_audio"),
2966
+ cache_control: import_v36.z.object({
2967
+ type: import_v36.z.literal("ephemeral"),
2968
+ ttl: import_v36.z.enum(["5m", "1h"]).optional()
2969
+ }).optional()
2970
+ });
2963
2971
  var ChatCompletionContentPartFileFile = import_v36.z.object({ file_data: import_v36.z.string(), filename: import_v36.z.string(), file_id: import_v36.z.string() }).partial();
2964
2972
  var ChatCompletionContentPartFileWithTitle = import_v36.z.object({
2965
2973
  file: ChatCompletionContentPartFileFile,
@@ -2972,6 +2980,7 @@ var ChatCompletionContentPartFileWithTitle = import_v36.z.object({
2972
2980
  var ChatCompletionContentPart = import_v36.z.union([
2973
2981
  ChatCompletionContentPartTextWithTitle,
2974
2982
  ChatCompletionContentPartImageWithTitle,
2983
+ ChatCompletionContentPartInputAudioWithTitle,
2975
2984
  ChatCompletionContentPartFileWithTitle
2976
2985
  ]);
2977
2986
  var ChatCompletionContentPartText = import_v36.z.object({
@@ -3963,6 +3972,7 @@ var ProjectSettings = import_v36.z.union([
3963
3972
  ]),
3964
3973
  disable_realtime_queries: import_v36.z.union([import_v36.z.boolean(), import_v36.z.null()]),
3965
3974
  monitor_charts_use_metrics_start: import_v36.z.union([import_v36.z.boolean(), import_v36.z.null()]),
3975
+ blind_reviews: import_v36.z.union([import_v36.z.boolean(), import_v36.z.null()]),
3966
3976
  default_preprocessor: NullableSavedFunctionId
3967
3977
  }).partial(),
3968
3978
  import_v36.z.null()
@@ -4024,6 +4034,7 @@ var WindowedAutomationConfig = import_v36.z.object({
4024
4034
  auto_approve_tools: import_v36.z.array(import_v36.z.string().min(1)).optional().default([]),
4025
4035
  harness: import_v36.z.enum(["native", "codex", "claude-code"]).optional(),
4026
4036
  model: import_v36.z.string().min(1).optional(),
4037
+ endpoint_name: import_v36.z.string().min(1).optional(),
4027
4038
  reasoning_effort: import_v36.z.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max"]).optional()
4028
4039
  }).optional(),
4029
4040
  actions: import_v36.z.array(
@@ -5795,6 +5806,7 @@ var INSTRUMENTATION_NAMES = {
5795
5806
  GENKIT: "genkit",
5796
5807
  GITHUB_COPILOT: "github-copilot",
5797
5808
  GOOGLE_ADK: "google-adk",
5809
+ GOOGLE_GENERATIVE_AI: "google-generative-ai",
5798
5810
  GOOGLE_GENAI: "google-genai",
5799
5811
  GROQ: "groq",
5800
5812
  HUGGINGFACE: "huggingface",
@@ -5810,12 +5822,13 @@ var INSTRUMENTATION_NAMES = {
5810
5822
  OPENROUTER_AGENT: "openrouter-agent",
5811
5823
  PI_CODING_AGENT: "pi-coding-agent",
5812
5824
  STRANDS_AGENT_SDK: "strands-agent-sdk",
5813
- VOYAGEAI: "voyageai"
5825
+ VOYAGEAI: "voyageai",
5826
+ ELEVENLABS: "elevenlabs"
5814
5827
  };
5815
5828
  var INTERNAL_SPAN_INSTRUMENTATION_NAME = /* @__PURE__ */ Symbol.for(
5816
5829
  "braintrust.spanInstrumentationName"
5817
5830
  );
5818
- var SDK_VERSION = true ? "3.30.0" : "0.0.0";
5831
+ var SDK_VERSION = true ? "3.32.0" : "0.0.0";
5819
5832
  function withSpanInstrumentationName(args, instrumentationName) {
5820
5833
  return {
5821
5834
  ...args,
@@ -10393,6 +10406,16 @@ function renderMessageImpl(render, message, variables) {
10393
10406
  }
10394
10407
  }
10395
10408
  ];
10409
+ case "input_audio":
10410
+ return [
10411
+ {
10412
+ ...c,
10413
+ input_audio: {
10414
+ ...c.input_audio,
10415
+ data: render(c.input_audio.data)
10416
+ }
10417
+ }
10418
+ ];
10396
10419
  case "file":
10397
10420
  return [
10398
10421
  {
@@ -18220,6 +18243,12 @@ function prepareAISDKChildTracing(params, self, parentSpan, denyOutputPaths, aiS
18220
18243
  if (!activeEntry) {
18221
18244
  return result;
18222
18245
  }
18246
+ const executionOptions = args[1];
18247
+ const toolCallId = isObject(executionOptions) ? executionOptions.toolCallId : void 0;
18248
+ const toolInput = {
18249
+ input: serializeToolExecutionInput(args),
18250
+ ...typeof toolCallId === "string" ? { metadata: { toolCallId } } : {}
18251
+ };
18223
18252
  if (isAsyncGenerator(result)) {
18224
18253
  return (async function* () {
18225
18254
  const span = activeEntry.parentSpan.startSpan(
@@ -18233,7 +18262,7 @@ function prepareAISDKChildTracing(params, self, parentSpan, denyOutputPaths, aiS
18233
18262
  INSTRUMENTATION_NAMES.AI_SDK
18234
18263
  )
18235
18264
  );
18236
- span.log({ input: serializeToolExecutionInput(args) });
18265
+ span.log(toolInput);
18237
18266
  try {
18238
18267
  let lastValue;
18239
18268
  for await (const value of result) {
@@ -18251,7 +18280,7 @@ function prepareAISDKChildTracing(params, self, parentSpan, denyOutputPaths, aiS
18251
18280
  }
18252
18281
  return activeEntry.parentSpan.traced(
18253
18282
  async (span) => {
18254
- span.log({ input: serializeToolExecutionInput(args) });
18283
+ span.log(toolInput);
18255
18284
  const awaitedResult = await result;
18256
18285
  span.log({ output: awaitedResult });
18257
18286
  return awaitedResult;
@@ -22655,6 +22684,342 @@ var OpenAIAgentsPlugin = class extends BasePlugin {
22655
22684
  }
22656
22685
  };
22657
22686
 
22687
+ // src/instrumentation/plugins/google-generative-ai-channels.ts
22688
+ var googleGenerativeAIChannels = defineChannels(
22689
+ "@google/generative-ai",
22690
+ {
22691
+ generateContent: channel({ channelName: "GenerativeModel.generateContent", kind: "async" }),
22692
+ generateContentStream: channel({ channelName: "GenerativeModel.generateContentStream", kind: "async" }),
22693
+ embedContent: channel({ channelName: "GenerativeModel.embedContent", kind: "async" }),
22694
+ batchEmbedContents: channel({ channelName: "GenerativeModel.batchEmbedContents", kind: "async" }),
22695
+ sendMessage: channel({ channelName: "ChatSession.sendMessage", kind: "async" }),
22696
+ sendMessageStream: channel({ channelName: "ChatSession.sendMessageStream", kind: "async" })
22697
+ },
22698
+ { instrumentationName: INSTRUMENTATION_NAMES.GOOGLE_GENERATIVE_AI }
22699
+ );
22700
+
22701
+ // src/instrumentation/plugins/google-generative-ai-plugin.ts
22702
+ var GENERATION_CONFIG_KEYS = [
22703
+ "temperature",
22704
+ "topP",
22705
+ "topK",
22706
+ "candidateCount",
22707
+ "maxOutputTokens",
22708
+ "stopSequences",
22709
+ "responseMimeType",
22710
+ "responseSchema",
22711
+ "presencePenalty",
22712
+ "frequencyPenalty",
22713
+ "responseLogprobs",
22714
+ "logprobs",
22715
+ "thinkingConfig"
22716
+ ];
22717
+ var GoogleGenerativeAIPlugin = class extends BasePlugin {
22718
+ onEnable() {
22719
+ this.unsubscribers.push(
22720
+ interceptCall(
22721
+ googleGenerativeAIChannels.generateContent,
22722
+ "generateContent"
22723
+ ),
22724
+ interceptCall(
22725
+ googleGenerativeAIChannels.generateContentStream,
22726
+ "generateContentStream"
22727
+ ),
22728
+ interceptCall(googleGenerativeAIChannels.sendMessage, "sendMessage"),
22729
+ interceptCall(
22730
+ googleGenerativeAIChannels.sendMessageStream,
22731
+ "sendMessageStream"
22732
+ ),
22733
+ interceptCall(googleGenerativeAIChannels.embedContent, "embedContent"),
22734
+ interceptCall(
22735
+ googleGenerativeAIChannels.batchEmbedContents,
22736
+ "batchEmbedContents"
22737
+ )
22738
+ );
22739
+ }
22740
+ onDisable() {
22741
+ this.unsubscribers = unsubscribeAll(this.unsubscribers);
22742
+ }
22743
+ };
22744
+ function interceptCall(channel2, operation) {
22745
+ return channel2.intercept((target, thisArg, args) => {
22746
+ const invokeTarget = () => Reflect.apply(target, thisArg, args);
22747
+ if (isAutoInstrumentationSuppressed()) return invokeTarget();
22748
+ const self = thisArg;
22749
+ const chat = operation.startsWith("sendMessage");
22750
+ const embedding = operation === "embedContent" || operation === "batchEmbedContents";
22751
+ const start = getCurrentUnixTimestamp();
22752
+ let span;
22753
+ try {
22754
+ span = startSpan(
22755
+ withSpanInstrumentationName(
22756
+ {
22757
+ name: embedding ? operation === "embedContent" ? "embed_content" : "batch_embed_contents" : "generate_content",
22758
+ spanAttributes: { type: "llm" /* LLM */ },
22759
+ event: extractInput(self, args[0], operation)
22760
+ },
22761
+ INSTRUMENTATION_NAMES.GOOGLE_GENERATIVE_AI
22762
+ )
22763
+ );
22764
+ } catch (error) {
22765
+ debugLogger.error("Error starting Google Generative AI span:", error);
22766
+ return invokeTarget();
22767
+ }
22768
+ let ended = false;
22769
+ const finish = (log) => {
22770
+ if (ended) return;
22771
+ ended = true;
22772
+ try {
22773
+ log();
22774
+ } catch (error) {
22775
+ debugLogger.error("Error logging Google Generative AI span:", error);
22776
+ }
22777
+ try {
22778
+ span.end();
22779
+ } catch (error) {
22780
+ debugLogger.error("Error ending Google Generative AI span:", error);
22781
+ }
22782
+ };
22783
+ if (chat) {
22784
+ try {
22785
+ void self._sendPromise.then(
22786
+ () => {
22787
+ try {
22788
+ span.log(extractInput(self, args[0], operation));
22789
+ } catch (error) {
22790
+ debugLogger.error("Error capturing Google chat history:", error);
22791
+ }
22792
+ },
22793
+ () => {
22794
+ }
22795
+ );
22796
+ } catch (error) {
22797
+ debugLogger.error("Error observing Google chat history:", error);
22798
+ }
22799
+ }
22800
+ let result;
22801
+ try {
22802
+ result = withCurrent(
22803
+ span,
22804
+ () => runWithAutoInstrumentationSuppressed(invokeTarget)
22805
+ );
22806
+ } catch (error) {
22807
+ finish(() => span.log({ error }));
22808
+ throw error;
22809
+ }
22810
+ void Promise.resolve(result).then(
22811
+ (value) => {
22812
+ try {
22813
+ if ("stream" in value) {
22814
+ let firstToken = false;
22815
+ const partial = { candidates: [] };
22816
+ const candidates = /* @__PURE__ */ new Map();
22817
+ patchStreamIfNeeded(value.stream, {
22818
+ aroundNext: (callback) => withCurrent(span, callback),
22819
+ onChunk: (chunk) => {
22820
+ for (const candidate of chunk.candidates ?? []) {
22821
+ const index = candidate.index ?? 0;
22822
+ const previous = candidates.get(index);
22823
+ const parts = [...previous?.content?.parts ?? []];
22824
+ for (const part of candidate.content?.parts ?? []) {
22825
+ const last = parts[parts.length - 1];
22826
+ if (part.text !== void 0 && last?.text !== void 0) {
22827
+ parts[parts.length - 1] = {
22828
+ ...last,
22829
+ text: last.text + part.text
22830
+ };
22831
+ } else parts.push(part);
22832
+ }
22833
+ candidates.set(index, {
22834
+ ...previous,
22835
+ ...candidate,
22836
+ content: {
22837
+ role: candidate.content?.role ?? previous?.content?.role ?? "model",
22838
+ parts
22839
+ }
22840
+ });
22841
+ }
22842
+ partial.candidates = Array.from(candidates.values());
22843
+ if (chunk.usageMetadata)
22844
+ partial.usageMetadata = chunk.usageMetadata;
22845
+ if (!firstToken && chunk.candidates?.some(
22846
+ (candidate) => candidate.content?.parts.some(
22847
+ (part) => part.text !== void 0 ? part.text.length > 0 : Object.keys(part).length > 0
22848
+ )
22849
+ )) {
22850
+ firstToken = true;
22851
+ span.log({
22852
+ metrics: {
22853
+ time_to_first_token: getCurrentUnixTimestamp() - start
22854
+ }
22855
+ });
22856
+ }
22857
+ },
22858
+ onComplete: () => {
22859
+ },
22860
+ onError: (error) => finish(() => {
22861
+ logResponse(span, partial);
22862
+ span.log({ error });
22863
+ }),
22864
+ onCancel: () => finish(() => logResponse(span, partial))
22865
+ });
22866
+ void value.response.then(
22867
+ (response) => finish(() => logResponse(span, response)),
22868
+ (error) => finish(() => {
22869
+ logResponse(span, partial);
22870
+ span.log({ error });
22871
+ })
22872
+ );
22873
+ } else if ("response" in value) {
22874
+ finish(() => logResponse(span, value.response));
22875
+ } else {
22876
+ const metrics = {};
22877
+ const promptTokens = value.usageMetadata?.promptTokenCount;
22878
+ if (typeof promptTokens === "number" && Number.isFinite(promptTokens) && promptTokens >= 0) {
22879
+ metrics.prompt_tokens = promptTokens;
22880
+ metrics.tokens = promptTokens;
22881
+ }
22882
+ for (const detail of value.usageMetadata?.promptTokenDetails ?? []) {
22883
+ if (detail.modality === "AUDIO" && typeof detail.tokenCount === "number" && Number.isFinite(detail.tokenCount) && detail.tokenCount >= 0) {
22884
+ metrics.prompt_audio_tokens = (metrics.prompt_audio_tokens ?? 0) + detail.tokenCount;
22885
+ }
22886
+ }
22887
+ finish(
22888
+ () => span.log({
22889
+ metrics,
22890
+ output: {
22891
+ count: value.embeddings?.length ?? (value.embedding ? 1 : 0)
22892
+ }
22893
+ })
22894
+ );
22895
+ }
22896
+ } catch (error) {
22897
+ debugLogger.error(
22898
+ "Error observing Google Generative AI result:",
22899
+ error
22900
+ );
22901
+ finish(() => {
22902
+ });
22903
+ }
22904
+ },
22905
+ (error) => finish(() => span.log({ error }))
22906
+ );
22907
+ return result;
22908
+ });
22909
+ }
22910
+ function normalizeContent(message) {
22911
+ const parts = (typeof message === "string" ? [message] : message).map(
22912
+ (part) => typeof part === "string" ? { text: part } : part
22913
+ );
22914
+ return {
22915
+ role: parts.some((part) => part.functionResponse) ? "function" : "user",
22916
+ parts
22917
+ };
22918
+ }
22919
+ function extractInput(self, request, operation) {
22920
+ const model = self.model.replace(/^models\//, "");
22921
+ if (operation === "embedContent" || operation === "batchEmbedContents") {
22922
+ const requests = operation === "batchEmbedContents" ? request.requests : [
22923
+ typeof request === "string" || Array.isArray(request) ? { content: normalizeContent(request) } : request
22924
+ ];
22925
+ const dimensions = requests[0]?.outputDimensionality;
22926
+ return {
22927
+ input: {
22928
+ inputs: convertAttachments(requests).map((item) => ({
22929
+ content: item.content.parts.length === 1 && item.content.parts[0].text !== void 0 ? item.content.parts[0].text : item.content.parts.map((part) => {
22930
+ if (part.text !== void 0)
22931
+ return { type: "text", text: part.text };
22932
+ const mimeType = part.inlineData?.mimeType ?? part.fileData?.mimeType;
22933
+ const data = part.inlineData ? typeof part.inlineData.data === "string" ? `data:${mimeType};base64,${part.inlineData.data}` : part.inlineData.data : part.fileData?.fileUri;
22934
+ return mimeType?.startsWith("image/") ? { type: "image_url", image_url: { url: data } } : { type: "file", file: { file_data: data } };
22935
+ })
22936
+ })),
22937
+ ...dimensions !== void 0 && requests.every((item) => item.outputDimensionality === dimensions) ? { output_dimensions: dimensions } : {}
22938
+ },
22939
+ metadata: { model, provider: "google" }
22940
+ };
22941
+ }
22942
+ const chat = operation.startsWith("sendMessage");
22943
+ const config = chat ? self.params ?? {} : self;
22944
+ const params = typeof request === "string" || Array.isArray(request) ? { contents: [normalizeContent(request)] } : request;
22945
+ const system = params.systemInstruction ?? config.systemInstruction;
22946
+ const systemContent = typeof system === "string" ? { role: "system", parts: [{ text: system }] } : system && "parts" in system ? { ...system, role: "system" } : system ? { role: "system", parts: [system] } : void 0;
22947
+ const contents = [
22948
+ ...systemContent ? [systemContent] : [],
22949
+ ...chat ? self._history : [],
22950
+ ...params.contents
22951
+ ];
22952
+ const metadata = { model, provider: "google" };
22953
+ const generation = params.generationConfig ?? config.generationConfig;
22954
+ for (const key of GENERATION_CONFIG_KEYS) {
22955
+ if (generation && Object.hasOwn(generation, key))
22956
+ metadata[key] = generation[key];
22957
+ }
22958
+ for (const key of ["tools", "toolConfig", "safetySettings"]) {
22959
+ const value = params[key] ?? config[key];
22960
+ if (value !== void 0) metadata[key] = value;
22961
+ }
22962
+ const cached = params.cachedContent ?? config.cachedContent;
22963
+ if (cached)
22964
+ metadata.cachedContent = typeof cached === "string" ? cached : cached.name;
22965
+ return { input: convertAttachments({ model, contents }), metadata };
22966
+ }
22967
+ function convertAttachments(value) {
22968
+ const convert = (node) => {
22969
+ if (Array.isArray(node)) return node.map(convert);
22970
+ if (!isObject(node)) return node;
22971
+ if (isObject(node.inlineData)) {
22972
+ const { data, mimeType } = node.inlineData;
22973
+ const processed = processInputAttachments({
22974
+ type: "file",
22975
+ file: { file_data: `data:${mimeType};base64,${data}` }
22976
+ });
22977
+ if (typeof processed.file.file_data === "string")
22978
+ throw new Error("Unable to convert Google inline data");
22979
+ return {
22980
+ ...node,
22981
+ inlineData: { ...node.inlineData, data: processed.file.file_data }
22982
+ };
22983
+ }
22984
+ return Object.fromEntries(
22985
+ Object.entries(node).map(([key, item]) => [key, convert(item)])
22986
+ );
22987
+ };
22988
+ try {
22989
+ return convert(value);
22990
+ } catch (error) {
22991
+ debugLogger.error(
22992
+ "Error converting Google Generative AI attachments:",
22993
+ error
22994
+ );
22995
+ return value;
22996
+ }
22997
+ }
22998
+ function logResponse(span, response) {
22999
+ const usage = response.usageMetadata;
23000
+ const metrics = {};
23001
+ if (usage) {
23002
+ if (usage.promptTokenCount !== void 0)
23003
+ metrics.prompt_tokens = usage.promptTokenCount;
23004
+ if (usage.candidatesTokenCount !== void 0 || usage.thoughtsTokenCount !== void 0)
23005
+ metrics.completion_tokens = (usage.candidatesTokenCount ?? 0) + (usage.thoughtsTokenCount ?? 0);
23006
+ if (usage.totalTokenCount !== void 0)
23007
+ metrics.tokens = usage.totalTokenCount;
23008
+ if (usage.cachedContentTokenCount !== void 0)
23009
+ metrics.prompt_cached_tokens = usage.cachedContentTokenCount;
23010
+ if (usage.thoughtsTokenCount !== void 0)
23011
+ metrics.completion_reasoning_tokens = usage.thoughtsTokenCount;
23012
+ }
23013
+ span.log({
23014
+ output: convertAttachments({
23015
+ candidates: response.candidates,
23016
+ promptFeedback: response.promptFeedback
23017
+ }),
23018
+ metrics,
23019
+ ...response.modelVersion ? { metadata: { model: response.modelVersion } } : {}
23020
+ });
23021
+ }
23022
+
22658
23023
  // src/instrumentation/plugins/google-genai-channels.ts
22659
23024
  var googleGenAIChannels = defineChannels(
22660
23025
  "@google/genai",
@@ -24298,7 +24663,7 @@ var HuggingFaceTransformersPlugin = class extends BasePlugin {
24298
24663
  getTask(event)
24299
24664
  ),
24300
24665
  extractInput: (args, event) => ({
24301
- input: extractInput(
24666
+ input: extractInput2(
24302
24667
  getTask(event),
24303
24668
  args
24304
24669
  ),
@@ -24388,7 +24753,7 @@ function modelIdentifier(pipeline) {
24388
24753
  }
24389
24754
  return void 0;
24390
24755
  }
24391
- function extractInput(task, args) {
24756
+ function extractInput2(task, args) {
24392
24757
  switch (task) {
24393
24758
  case "feature-extraction":
24394
24759
  return args[0];
@@ -32373,14 +32738,17 @@ function getMetricsFromResponse(response) {
32373
32738
  if (!isRecord(usageMetadata)) {
32374
32739
  continue;
32375
32740
  }
32376
- const inputTokenDetails = usageMetadata.input_token_details;
32741
+ const inputTokenDetails = isRecord(usageMetadata.input_token_details) ? usageMetadata.input_token_details : {};
32377
32742
  const outputTokenDetails = usageMetadata.output_token_details;
32378
32743
  return normalizeTokenMetrics({
32379
32744
  total_tokens: usageMetadata.total_tokens,
32380
32745
  prompt_tokens: usageMetadata.input_tokens,
32381
32746
  completion_tokens: usageMetadata.output_tokens,
32382
- prompt_cache_creation_tokens: isRecord(inputTokenDetails) ? inputTokenDetails.cache_creation : void 0,
32383
- prompt_cached_tokens: isRecord(inputTokenDetails) ? inputTokenDetails.cache_read : void 0,
32747
+ // Prefer TTL-specific cache writes over the aggregate when available.
32748
+ prompt_cache_creation_tokens: inputTokenDetails.ephemeral_5m_input_tokens == null && inputTokenDetails.ephemeral_1h_input_tokens == null ? inputTokenDetails.cache_creation : void 0,
32749
+ prompt_cache_creation_5m_tokens: inputTokenDetails.ephemeral_5m_input_tokens,
32750
+ prompt_cache_creation_1h_tokens: inputTokenDetails.ephemeral_1h_input_tokens,
32751
+ prompt_cached_tokens: inputTokenDetails.cache_read,
32384
32752
  completion_reasoning_tokens: isRecord(outputTokenDetails) ? outputTokenDetails.reasoning : void 0
32385
32753
  });
32386
32754
  }
@@ -34739,6 +35107,477 @@ function logInstrumentationError5(context, error) {
34739
35107
  debugLogger.debug(`${context}:`, error);
34740
35108
  }
34741
35109
 
35110
+ // src/instrumentation/plugins/elevenlabs-channels.ts
35111
+ var elevenLabsChannels = defineChannels(
35112
+ "@elevenlabs/elevenlabs-js",
35113
+ {
35114
+ convert: channel({
35115
+ channelName: "textToSpeech.convert",
35116
+ kind: "async"
35117
+ }),
35118
+ stream: channel({
35119
+ channelName: "textToSpeech.stream",
35120
+ kind: "async"
35121
+ }),
35122
+ convertWithTimestamps: channel({ channelName: "textToSpeech.convertWithTimestamps", kind: "async" }),
35123
+ streamWithTimestamps: channel({ channelName: "textToSpeech.streamWithTimestamps", kind: "async" }),
35124
+ transcribe: channel({ channelName: "speechToText.convert", kind: "async" })
35125
+ },
35126
+ { instrumentationName: INSTRUMENTATION_NAMES.ELEVENLABS }
35127
+ );
35128
+
35129
+ // src/instrumentation/plugins/elevenlabs-plugin.ts
35130
+ var ElevenLabsPlugin = class extends BasePlugin {
35131
+ onEnable() {
35132
+ for (const method of [
35133
+ "convert",
35134
+ "stream",
35135
+ "convertWithTimestamps",
35136
+ "streamWithTimestamps"
35137
+ ]) {
35138
+ this.unsubscribers.push(
35139
+ interceptCall2(
35140
+ elevenLabsChannels[method],
35141
+ `elevenlabs.textToSpeech.${method}`,
35142
+ ([voice, request]) => ({
35143
+ input: {
35144
+ operation: "speech",
35145
+ prompt: request.text,
35146
+ parameters: {
35147
+ voice,
35148
+ format: request.outputFormat,
35149
+ language: request.languageCode,
35150
+ speed: request.voiceSettings?.speed
35151
+ }
35152
+ },
35153
+ metadata: {
35154
+ provider: "elevenlabs",
35155
+ model: request.modelId ?? "eleven_multilingual_v2"
35156
+ }
35157
+ }),
35158
+ (value, args, span, finish, headers, started) => captureSpeech(
35159
+ value,
35160
+ args[1],
35161
+ method,
35162
+ span,
35163
+ finish,
35164
+ started,
35165
+ headers
35166
+ )
35167
+ )
35168
+ );
35169
+ }
35170
+ this.unsubscribers.push(
35171
+ interceptCall2(
35172
+ elevenLabsChannels.transcribe,
35173
+ "elevenlabs.speechToText.convert",
35174
+ ([request]) => {
35175
+ if (request.webhook) return void 0;
35176
+ const file = request.file;
35177
+ const filename = typeof File !== "undefined" && file instanceof File ? file.name : "audio";
35178
+ const contentType = file instanceof Blob ? file.type || "application/octet-stream" : "application/octet-stream";
35179
+ const blob = file instanceof Blob ? file : file instanceof Uint8Array ? new Blob([new Uint8Array(file)], { type: contentType }) : file instanceof ArrayBuffer ? new Blob([file.slice(0)], { type: contentType }) : void 0;
35180
+ const fileData = blob ? new Attachment({ data: blob, filename, contentType }) : request.cloudStorageUrl;
35181
+ return {
35182
+ input: {
35183
+ operation: "transcribe",
35184
+ content: fileData ? [{ type: "file", file: { filename, file_data: fileData } }] : [],
35185
+ parameters: {
35186
+ language: request.languageCode,
35187
+ timestamp_granularities: request.timestampsGranularity
35188
+ }
35189
+ },
35190
+ metadata: { provider: "elevenlabs", model: request.modelId }
35191
+ };
35192
+ },
35193
+ (value, _args, span, finish) => {
35194
+ const result = value;
35195
+ const transcripts = result.transcripts ?? [result];
35196
+ span.log({
35197
+ output: {
35198
+ content: transcripts.flatMap(
35199
+ (transcript) => typeof transcript.text === "string" ? [{ type: "text", text: transcript.text }] : []
35200
+ ),
35201
+ annotations: {
35202
+ language: result.languageCode,
35203
+ words: result.words ?? (result.transcripts ? result.transcripts.flatMap(
35204
+ (transcript) => transcript.words ?? []
35205
+ ) : void 0)
35206
+ }
35207
+ }
35208
+ });
35209
+ finish();
35210
+ },
35211
+ ([request], span) => {
35212
+ const file = request.file;
35213
+ if (!isAsyncIterable(file)) return;
35214
+ const chunks = [];
35215
+ const filename = isObject(file) && typeof file.path === "string" ? file.path.split(/[\\/]/).pop() || "audio" : "audio";
35216
+ observeAudioStream(
35217
+ file,
35218
+ (chunk) => chunks.push(new Uint8Array(chunk)),
35219
+ () => {
35220
+ const contentType = "application/octet-stream";
35221
+ const data = new Blob(chunks, {
35222
+ type: contentType
35223
+ });
35224
+ chunks.length = 0;
35225
+ span.log({
35226
+ input: {
35227
+ content: [
35228
+ {
35229
+ type: "file",
35230
+ file: {
35231
+ filename,
35232
+ file_data: new Attachment({
35233
+ data,
35234
+ filename,
35235
+ contentType
35236
+ })
35237
+ }
35238
+ }
35239
+ ]
35240
+ }
35241
+ });
35242
+ },
35243
+ () => {
35244
+ chunks.length = 0;
35245
+ },
35246
+ span
35247
+ );
35248
+ }
35249
+ )
35250
+ );
35251
+ }
35252
+ onDisable() {
35253
+ this.unsubscribers = unsubscribeAll(this.unsubscribers);
35254
+ }
35255
+ };
35256
+ function interceptCall2(channel2, name, input, output, beforeInvoke) {
35257
+ return channel2.intercept((target, self, args) => {
35258
+ const invoke = () => Reflect.apply(target, self, args);
35259
+ if (isAutoInstrumentationSuppressed()) return invoke();
35260
+ const started = Date.now() / 1e3;
35261
+ let span;
35262
+ try {
35263
+ const event = input(args);
35264
+ if (event !== void 0)
35265
+ span = startSpan(
35266
+ withSpanInstrumentationName(
35267
+ {
35268
+ name,
35269
+ spanAttributes: { type: "llm" /* LLM */ },
35270
+ event
35271
+ },
35272
+ INSTRUMENTATION_NAMES.ELEVENLABS
35273
+ )
35274
+ );
35275
+ } catch (error) {
35276
+ debugLogger.error("Error starting ElevenLabs span", error);
35277
+ return invoke();
35278
+ }
35279
+ if (!span) return invoke();
35280
+ const activeSpan = span;
35281
+ let ended = false;
35282
+ const finish = (error) => {
35283
+ if (ended) return;
35284
+ ended = true;
35285
+ try {
35286
+ if (error !== void 0) activeSpan.log({ error });
35287
+ activeSpan.end();
35288
+ } catch (loggingError) {
35289
+ debugLogger.error("Error ending ElevenLabs span", loggingError);
35290
+ }
35291
+ };
35292
+ try {
35293
+ beforeInvoke?.(args, span);
35294
+ } catch (error) {
35295
+ debugLogger.error("Error observing ElevenLabs input", error);
35296
+ }
35297
+ let result;
35298
+ try {
35299
+ result = withCurrent(
35300
+ span,
35301
+ () => runWithAutoInstrumentationSuppressed(invoke)
35302
+ );
35303
+ } catch (error) {
35304
+ finish(error);
35305
+ throw error;
35306
+ }
35307
+ const capture = (value, headers) => {
35308
+ try {
35309
+ output(value, args, span, finish, headers, started);
35310
+ } catch (error) {
35311
+ debugLogger.error("Error capturing ElevenLabs output", error);
35312
+ finish();
35313
+ }
35314
+ };
35315
+ try {
35316
+ if (isObject(result) && typeof result.withRawResponse === "function") {
35317
+ void result.withRawResponse().then(
35318
+ ({
35319
+ data,
35320
+ rawResponse
35321
+ }) => capture(data, rawResponse?.headers),
35322
+ finish
35323
+ );
35324
+ } else {
35325
+ void Promise.resolve(result).then((value) => capture(value), finish);
35326
+ }
35327
+ } catch (error) {
35328
+ debugLogger.error("Error observing ElevenLabs result", error);
35329
+ finish();
35330
+ }
35331
+ return result;
35332
+ });
35333
+ }
35334
+ function captureSpeech(value, request, method, span, finish, started, headers) {
35335
+ const format = request.outputFormat ?? "mp3_44100_128";
35336
+ const formatType = format.startsWith("mp3_") ? "audio/mpeg" : format.startsWith("pcm_") ? "audio/pcm" : format.startsWith("opus_") ? "audio/ogg" : format.startsWith("ulaw_") ? "audio/basic" : format.startsWith("alaw_") ? "audio/x-alaw" : void 0;
35337
+ const headerType = headers?.get("content-type")?.split(";")[0];
35338
+ const contentType = headerType?.startsWith("audio/") ? headerType : formatType;
35339
+ const disposition = headers?.get("content-disposition");
35340
+ const headerFilename = disposition?.match(
35341
+ /filename="([^"]+)"|filename=([^;]+)/i
35342
+ );
35343
+ const filename = headerFilename?.[1] ?? headerFilename?.[2]?.trim() ?? `speech.${contentType ? getExtensionFromMediaType(contentType) : "bin"}`;
35344
+ const chunks = [];
35345
+ const alignments = [];
35346
+ let bytes = 0;
35347
+ let first = true;
35348
+ let stopped = false;
35349
+ const observe = (chunk) => {
35350
+ if (stopped || chunk.byteLength === 0) return;
35351
+ if (first && method.startsWith("stream")) {
35352
+ span.log({
35353
+ metrics: { time_to_first_token: Date.now() / 1e3 - started }
35354
+ });
35355
+ }
35356
+ first = false;
35357
+ chunks.push(new Uint8Array(chunk));
35358
+ bytes += chunk.byteLength;
35359
+ };
35360
+ const complete = () => {
35361
+ if (stopped) return;
35362
+ stopped = true;
35363
+ try {
35364
+ const content = [];
35365
+ if (contentType && bytes) {
35366
+ const data = new Uint8Array(bytes);
35367
+ let offset = 0;
35368
+ for (const chunk of chunks) {
35369
+ data.set(chunk, offset);
35370
+ offset += chunk.length;
35371
+ }
35372
+ content.push({
35373
+ type: "file",
35374
+ file: {
35375
+ filename,
35376
+ byte_size: bytes,
35377
+ file_data: new Attachment({
35378
+ data: new Blob([data], { type: contentType }),
35379
+ filename,
35380
+ contentType
35381
+ })
35382
+ }
35383
+ });
35384
+ }
35385
+ span.log({
35386
+ output: {
35387
+ content,
35388
+ ...alignments.length ? { annotations: alignments } : {}
35389
+ }
35390
+ });
35391
+ } finally {
35392
+ chunks.length = 0;
35393
+ finish();
35394
+ }
35395
+ };
35396
+ const cancel = (error) => {
35397
+ stopped = true;
35398
+ chunks.length = 0;
35399
+ finish(error);
35400
+ };
35401
+ const timestampChunk = (chunk) => {
35402
+ const binary = atob(chunk.audioBase64);
35403
+ observe(Uint8Array.from(binary, (character) => character.charCodeAt(0)));
35404
+ if (chunk.alignment || chunk.normalizedAlignment)
35405
+ alignments.push({
35406
+ alignment: chunk.alignment,
35407
+ normalized_alignment: chunk.normalizedAlignment
35408
+ });
35409
+ };
35410
+ if (method === "convertWithTimestamps") {
35411
+ timestampChunk(value);
35412
+ complete();
35413
+ } else if (method === "streamWithTimestamps") {
35414
+ patchStreamIfNeeded(value, {
35415
+ shouldCollect: (chunk) => {
35416
+ try {
35417
+ timestampChunk(chunk);
35418
+ } catch (error) {
35419
+ debugLogger.error("Error collecting ElevenLabs timestamps", error);
35420
+ cancel();
35421
+ }
35422
+ return false;
35423
+ },
35424
+ onComplete: complete,
35425
+ onCancel: () => cancel(),
35426
+ onError: cancel,
35427
+ aroundNext: (next) => withCurrent(span, next)
35428
+ });
35429
+ } else {
35430
+ observeAudioStream(value, observe, complete, cancel, span);
35431
+ }
35432
+ }
35433
+ function observeAudioStream(value, observe, complete, cancel, span) {
35434
+ let ended = false;
35435
+ const safeObserve = (chunk) => {
35436
+ if (ended) return;
35437
+ try {
35438
+ observe(chunk);
35439
+ } catch (error) {
35440
+ debugLogger.error("Error collecting ElevenLabs audio", error);
35441
+ end(false);
35442
+ }
35443
+ };
35444
+ const end = (success, error) => {
35445
+ if (ended) return;
35446
+ ended = true;
35447
+ try {
35448
+ if (success) complete();
35449
+ else cancel(error);
35450
+ } catch (loggingError) {
35451
+ debugLogger.error("Error logging ElevenLabs audio", loggingError);
35452
+ cancel();
35453
+ }
35454
+ };
35455
+ if (!isObject(value) || !Object.isExtensible(value)) {
35456
+ end(false);
35457
+ return;
35458
+ }
35459
+ if (typeof value.read === "function" && typeof value.on === "function") {
35460
+ value.on("end", () => end(true));
35461
+ value.on("close", () => end(false));
35462
+ const emit2 = value.emit;
35463
+ if (typeof emit2 === "function")
35464
+ value.emit = function(event, ...args) {
35465
+ if (event === "data" && args[0] instanceof Uint8Array)
35466
+ safeObserve(args[0]);
35467
+ if (event === "error") end(false, args[0]);
35468
+ return Reflect.apply(emit2, this, [event, ...args]);
35469
+ };
35470
+ return;
35471
+ }
35472
+ if (typeof value.getReader === "function") {
35473
+ const webStream = value;
35474
+ const pipeTo = webStream.pipeTo;
35475
+ const pipeThrough = webStream.pipeThrough;
35476
+ webStream.pipeTo = function(destination, options) {
35477
+ if (!isObject(destination) || this.locked || destination.locked)
35478
+ return pipeTo.call(this, destination, options);
35479
+ const tap = new TransformStream({
35480
+ transform(chunk, controller) {
35481
+ safeObserve(chunk);
35482
+ controller.enqueue(chunk);
35483
+ },
35484
+ flush() {
35485
+ end(true);
35486
+ }
35487
+ });
35488
+ const observed = pipeThrough.call(
35489
+ this,
35490
+ tap,
35491
+ options
35492
+ );
35493
+ return observed.pipeTo(destination, options).catch((error) => {
35494
+ end(false, error);
35495
+ throw error;
35496
+ });
35497
+ };
35498
+ webStream.pipeThrough = function(transform, options) {
35499
+ if (this.locked || transform.writable.locked || transform.readable.locked)
35500
+ return pipeThrough.call(this, transform, options);
35501
+ const result = webStream.pipeTo.call(this, transform.writable, options);
35502
+ void result.catch(() => {
35503
+ });
35504
+ return transform.readable;
35505
+ };
35506
+ const getReader = value.getReader;
35507
+ value.getReader = function(...args) {
35508
+ const reader = Reflect.apply(getReader, this, args);
35509
+ const read2 = reader.read;
35510
+ reader.read = function(...readArgs) {
35511
+ return Promise.resolve(
35512
+ withCurrent(span, () => Reflect.apply(read2, this, readArgs))
35513
+ ).then(
35514
+ (result) => {
35515
+ if (result.value) safeObserve(result.value);
35516
+ if (result.done) end(true);
35517
+ return result;
35518
+ },
35519
+ (error) => {
35520
+ end(false, error);
35521
+ throw error;
35522
+ }
35523
+ );
35524
+ };
35525
+ const readerCancel = reader.cancel;
35526
+ reader.cancel = function(...cancelArgs) {
35527
+ const result = Reflect.apply(readerCancel, this, cancelArgs);
35528
+ end(false);
35529
+ return result;
35530
+ };
35531
+ return reader;
35532
+ };
35533
+ const streamCancel = value.cancel;
35534
+ if (typeof streamCancel === "function")
35535
+ value.cancel = function(...args) {
35536
+ const result = Reflect.apply(streamCancel, this, args);
35537
+ void Promise.resolve(result).then(
35538
+ () => end(false),
35539
+ () => {
35540
+ }
35541
+ );
35542
+ return result;
35543
+ };
35544
+ }
35545
+ if (typeof value.getReader === "function" && typeof value.values === "function") {
35546
+ const values = value.values;
35547
+ const iterate = function(...args) {
35548
+ const iterator = Reflect.apply(values, this, args);
35549
+ patchStreamIfNeeded(iterator, {
35550
+ shouldCollect(chunk) {
35551
+ safeObserve(chunk);
35552
+ return false;
35553
+ },
35554
+ onComplete: () => end(true),
35555
+ onCancel: () => end(false),
35556
+ onError: (error) => end(false, error),
35557
+ aroundNext: (next) => withCurrent(span, next)
35558
+ });
35559
+ return iterator;
35560
+ };
35561
+ value.values = iterate;
35562
+ Object.defineProperty(value, Symbol.asyncIterator, {
35563
+ configurable: true,
35564
+ writable: true,
35565
+ value: iterate
35566
+ });
35567
+ } else if (isAsyncIterable(value)) {
35568
+ patchStreamIfNeeded(value, {
35569
+ shouldCollect: (chunk) => {
35570
+ safeObserve(chunk);
35571
+ return false;
35572
+ },
35573
+ onComplete: () => end(true),
35574
+ onCancel: () => end(false),
35575
+ onError: (error) => end(false, error),
35576
+ aroundNext: (next) => withCurrent(span, next)
35577
+ });
35578
+ } else if (typeof value.getReader !== "function") end(false);
35579
+ }
35580
+
34742
35581
  // src/instrumentation/plugins/voyageai-channels.ts
34743
35582
  var voyageAIChannels = defineChannels(
34744
35583
  "voyageai",
@@ -34806,7 +35645,7 @@ var VoyageAIPlugin = class extends BasePlugin {
34806
35645
  this.unsubscribers = unsubscribeAll(this.unsubscribers);
34807
35646
  }
34808
35647
  };
34809
- function interceptVoyageAICall(channel2, name, extractInput2, extractOutput2, extractMetrics2 = extractUsageMetrics3) {
35648
+ function interceptVoyageAICall(channel2, name, extractInput3, extractOutput2, extractMetrics2 = extractUsageMetrics3) {
34810
35649
  return channel2.intercept((target, thisArg, args) => {
34811
35650
  const invokeTarget = () => Reflect.apply(target, thisArg, args);
34812
35651
  if (isAutoInstrumentationSuppressed()) {
@@ -34814,7 +35653,7 @@ function interceptVoyageAICall(channel2, name, extractInput2, extractOutput2, ex
34814
35653
  }
34815
35654
  let span;
34816
35655
  try {
34817
- const { input, metadata } = extractInput2(args);
35656
+ const { input, metadata } = extractInput3(args);
34818
35657
  span = startSpan(
34819
35658
  withSpanInstrumentationName(
34820
35659
  {
@@ -35590,6 +36429,7 @@ var BraintrustPlugin = class extends BasePlugin {
35590
36429
  cloudflareThinkPlugin = null;
35591
36430
  cursorSDKPlugin = null;
35592
36431
  openAIAgentsPlugin = null;
36432
+ googleGenerativeAIPlugin = null;
35593
36433
  googleGenAIPlugin = null;
35594
36434
  huggingFacePlugin = null;
35595
36435
  huggingFaceTransformersPlugin = null;
@@ -35608,6 +36448,7 @@ var BraintrustPlugin = class extends BasePlugin {
35608
36448
  langSmithPlugin = null;
35609
36449
  piCodingAgentPlugin = null;
35610
36450
  strandsAgentSDKPlugin = null;
36451
+ elevenLabsPlugin = null;
35611
36452
  voyageAIPlugin = null;
35612
36453
  cloudflareAIChatPlugin = null;
35613
36454
  cloudflareAgentsPlugin = null;
@@ -35649,6 +36490,10 @@ var BraintrustPlugin = class extends BasePlugin {
35649
36490
  this.openAIAgentsPlugin = new OpenAIAgentsPlugin();
35650
36491
  this.openAIAgentsPlugin.enable();
35651
36492
  }
36493
+ if (integrations.googleGenerativeAI !== false) {
36494
+ this.googleGenerativeAIPlugin = new GoogleGenerativeAIPlugin();
36495
+ this.googleGenerativeAIPlugin.enable();
36496
+ }
35652
36497
  if (integrations.googleGenAI !== false && integrations.google !== false) {
35653
36498
  this.googleGenAIPlugin = new GoogleGenAIPlugin();
35654
36499
  this.googleGenAIPlugin.enable();
@@ -35683,6 +36528,10 @@ var BraintrustPlugin = class extends BasePlugin {
35683
36528
  this.coherePlugin = new CoherePlugin();
35684
36529
  this.coherePlugin.enable();
35685
36530
  }
36531
+ if (integrations.elevenlabs !== false) {
36532
+ this.elevenLabsPlugin = new ElevenLabsPlugin();
36533
+ this.elevenLabsPlugin.enable();
36534
+ }
35686
36535
  if (integrations.voyageai !== false) {
35687
36536
  this.voyageAIPlugin = new VoyageAIPlugin();
35688
36537
  this.voyageAIPlugin.enable();
@@ -35767,6 +36616,10 @@ var BraintrustPlugin = class extends BasePlugin {
35767
36616
  this.openAIAgentsPlugin.disable();
35768
36617
  this.openAIAgentsPlugin = null;
35769
36618
  }
36619
+ if (this.googleGenerativeAIPlugin) {
36620
+ this.googleGenerativeAIPlugin.disable();
36621
+ this.googleGenerativeAIPlugin = null;
36622
+ }
35770
36623
  if (this.googleGenAIPlugin) {
35771
36624
  this.googleGenAIPlugin.disable();
35772
36625
  this.googleGenAIPlugin = null;
@@ -35803,6 +36656,10 @@ var BraintrustPlugin = class extends BasePlugin {
35803
36656
  this.coherePlugin.disable();
35804
36657
  this.coherePlugin = null;
35805
36658
  }
36659
+ if (this.elevenLabsPlugin) {
36660
+ this.elevenLabsPlugin.disable();
36661
+ this.elevenLabsPlugin = null;
36662
+ }
35806
36663
  if (this.voyageAIPlugin) {
35807
36664
  this.voyageAIPlugin.disable();
35808
36665
  this.voyageAIPlugin = null;
@@ -38015,6 +38872,8 @@ var envIntegrationAliases = {
38015
38872
  "openai-agents-core": "openAIAgents",
38016
38873
  openaiagentscore: "openAIAgents",
38017
38874
  google: "google",
38875
+ "google-generative-ai": "googleGenerativeAI",
38876
+ googlegenerativeai: "googleGenerativeAI",
38018
38877
  "google-genai": "googleGenAI",
38019
38878
  googlegenai: "googleGenAI",
38020
38879
  huggingface: "huggingface",
@@ -38048,7 +38907,9 @@ var envIntegrationAliases = {
38048
38907
  langsmith: "langsmith",
38049
38908
  voyage: "voyageai",
38050
38909
  "voyage-ai": "voyageai",
38051
- voyageai: "voyageai"
38910
+ voyageai: "voyageai",
38911
+ elevenlabs: "elevenlabs",
38912
+ "@elevenlabs/elevenlabs-js": "elevenlabs"
38052
38913
  };
38053
38914
  function getDefaultInstrumentationIntegrations() {
38054
38915
  return {
@@ -38059,6 +38920,7 @@ function getDefaultInstrumentationIntegrations() {
38059
38920
  aisdk: true,
38060
38921
  google: true,
38061
38922
  googleGenAI: true,
38923
+ googleGenerativeAI: true,
38062
38924
  googleADK: true,
38063
38925
  huggingface: true,
38064
38926
  claudeAgentSDK: true,
@@ -38084,6 +38946,7 @@ function getDefaultInstrumentationIntegrations() {
38084
38946
  langgraph: true,
38085
38947
  langsmith: true,
38086
38948
  voyageai: true,
38949
+ elevenlabs: true,
38087
38950
  piCodingAgent: true,
38088
38951
  strandsAgentSDK: true,
38089
38952
  cloudflareAgents: true