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.
Files changed (55) hide show
  1. package/dev/dist/index.d.mts +736 -0
  2. package/dev/dist/index.d.ts +736 -0
  3. package/dev/dist/index.js +1280 -428
  4. package/dev/dist/index.mjs +859 -7
  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 +104 -2
  10. package/dist/auto-instrumentations/bundler/next.mjs +3 -3
  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 +124 -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 +2124 -2
  27. package/dist/browser.d.ts +2124 -2
  28. package/dist/browser.js +994 -10
  29. package/dist/browser.mjs +994 -10
  30. package/dist/{chunk-AJT4FR25.mjs → chunk-4QSAHP7D.mjs} +818 -5
  31. package/dist/{chunk-4AQGZS6X.js → chunk-AW4QECG5.js} +47 -4
  32. package/dist/{chunk-V32LW47Z.js → chunk-BTRLPQG5.js} +1663 -850
  33. package/dist/{chunk-CE3BLB2L.mjs → chunk-WV6QZI2W.mjs} +46 -3
  34. package/dist/cli.js +923 -8
  35. package/dist/edge-light.d.mts +1 -1
  36. package/dist/edge-light.d.ts +1 -1
  37. package/dist/edge-light.js +994 -10
  38. package/dist/edge-light.mjs +994 -10
  39. package/dist/index.d.mts +2124 -2
  40. package/dist/index.d.ts +2124 -2
  41. package/dist/index.js +581 -447
  42. package/dist/index.mjs +136 -2
  43. package/dist/instrumentation/index.d.mts +434 -0
  44. package/dist/instrumentation/index.d.ts +434 -0
  45. package/dist/instrumentation/index.js +859 -7
  46. package/dist/instrumentation/index.mjs +859 -7
  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 +994 -10
  52. package/dist/workerd.mjs +994 -10
  53. package/package.json +1 -1
  54. package/util/dist/index.d.mts +326 -0
  55. package/util/dist/index.d.ts +326 -0
@@ -54,6 +54,8 @@ var envIntegrationAliases = {
54
54
  "openai-agents-core": "openAIAgents",
55
55
  openaiagentscore: "openAIAgents",
56
56
  google: "google",
57
+ "google-generative-ai": "googleGenerativeAI",
58
+ googlegenerativeai: "googleGenerativeAI",
57
59
  "google-genai": "googleGenAI",
58
60
  googlegenai: "googleGenAI",
59
61
  huggingface: "huggingface",
@@ -87,7 +89,9 @@ var envIntegrationAliases = {
87
89
  langsmith: "langsmith",
88
90
  voyage: "voyageai",
89
91
  "voyage-ai": "voyageai",
90
- voyageai: "voyageai"
92
+ voyageai: "voyageai",
93
+ elevenlabs: "elevenlabs",
94
+ "@elevenlabs/elevenlabs-js": "elevenlabs"
91
95
  };
92
96
  function readDisabledInstrumentationEnvConfig(disabledList) {
93
97
  const integrations = {};
@@ -2117,6 +2121,14 @@ var ChatCompletionContentPartImageWithTitle = z6.object({
2117
2121
  ttl: z6.enum(["5m", "1h"]).optional()
2118
2122
  }).optional()
2119
2123
  });
2124
+ var ChatCompletionContentPartInputAudioWithTitle = z6.object({
2125
+ input_audio: z6.object({ data: z6.string(), format: z6.enum(["wav", "mp3"]) }),
2126
+ type: z6.literal("input_audio"),
2127
+ cache_control: z6.object({
2128
+ type: z6.literal("ephemeral"),
2129
+ ttl: z6.enum(["5m", "1h"]).optional()
2130
+ }).optional()
2131
+ });
2120
2132
  var ChatCompletionContentPartFileFile = z6.object({ file_data: z6.string(), filename: z6.string(), file_id: z6.string() }).partial();
2121
2133
  var ChatCompletionContentPartFileWithTitle = z6.object({
2122
2134
  file: ChatCompletionContentPartFileFile,
@@ -2129,6 +2141,7 @@ var ChatCompletionContentPartFileWithTitle = z6.object({
2129
2141
  var ChatCompletionContentPart = z6.union([
2130
2142
  ChatCompletionContentPartTextWithTitle,
2131
2143
  ChatCompletionContentPartImageWithTitle,
2144
+ ChatCompletionContentPartInputAudioWithTitle,
2132
2145
  ChatCompletionContentPartFileWithTitle
2133
2146
  ]);
2134
2147
  var ChatCompletionContentPartText = z6.object({
@@ -4956,6 +4969,7 @@ var INSTRUMENTATION_NAMES = {
4956
4969
  GENKIT: "genkit",
4957
4970
  GITHUB_COPILOT: "github-copilot",
4958
4971
  GOOGLE_ADK: "google-adk",
4972
+ GOOGLE_GENERATIVE_AI: "google-generative-ai",
4959
4973
  GOOGLE_GENAI: "google-genai",
4960
4974
  GROQ: "groq",
4961
4975
  HUGGINGFACE: "huggingface",
@@ -4971,12 +4985,13 @@ var INSTRUMENTATION_NAMES = {
4971
4985
  OPENROUTER_AGENT: "openrouter-agent",
4972
4986
  PI_CODING_AGENT: "pi-coding-agent",
4973
4987
  STRANDS_AGENT_SDK: "strands-agent-sdk",
4974
- VOYAGEAI: "voyageai"
4988
+ VOYAGEAI: "voyageai",
4989
+ ELEVENLABS: "elevenlabs"
4975
4990
  };
4976
4991
  var INTERNAL_SPAN_INSTRUMENTATION_NAME = /* @__PURE__ */ Symbol.for(
4977
4992
  "braintrust.spanInstrumentationName"
4978
4993
  );
4979
- var SDK_VERSION = true ? "3.31.0" : "0.0.0";
4994
+ var SDK_VERSION = true ? "3.32.0" : "0.0.0";
4980
4995
  function withSpanInstrumentationName(args, instrumentationName) {
4981
4996
  return {
4982
4997
  ...args,
@@ -9465,6 +9480,16 @@ function renderMessageImpl(render, message, variables) {
9465
9480
  }
9466
9481
  }
9467
9482
  ];
9483
+ case "input_audio":
9484
+ return [
9485
+ {
9486
+ ...c,
9487
+ input_audio: {
9488
+ ...c.input_audio,
9489
+ data: render(c.input_audio.data)
9490
+ }
9491
+ }
9492
+ ];
9468
9493
  case "file":
9469
9494
  return [
9470
9495
  {
@@ -12028,6 +12053,40 @@ var googleADKConfigs = [
12028
12053
  }
12029
12054
  ];
12030
12055
 
12056
+ // src/instrumentation/plugins/google-generative-ai-channels.ts
12057
+ var googleGenerativeAIChannels = defineChannels(
12058
+ "@google/generative-ai",
12059
+ {
12060
+ generateContent: channel({ channelName: "GenerativeModel.generateContent", kind: "async" }),
12061
+ generateContentStream: channel({ channelName: "GenerativeModel.generateContentStream", kind: "async" }),
12062
+ embedContent: channel({ channelName: "GenerativeModel.embedContent", kind: "async" }),
12063
+ batchEmbedContents: channel({ channelName: "GenerativeModel.batchEmbedContents", kind: "async" }),
12064
+ sendMessage: channel({ channelName: "ChatSession.sendMessage", kind: "async" }),
12065
+ sendMessageStream: channel({ channelName: "ChatSession.sendMessageStream", kind: "async" })
12066
+ },
12067
+ { instrumentationName: INSTRUMENTATION_NAMES.GOOGLE_GENERATIVE_AI }
12068
+ );
12069
+
12070
+ // src/auto-instrumentations/configs/google-generative-ai.ts
12071
+ var googleGenerativeAIConfigs = [
12072
+ "dist/index.js",
12073
+ "dist/index.mjs"
12074
+ ].flatMap(
12075
+ (filePath) => Object.entries(googleGenerativeAIChannels).map(([methodName, channel2]) => ({
12076
+ channelName: channel2.channelName,
12077
+ module: {
12078
+ name: "@google/generative-ai",
12079
+ versionRange: ">=0.24.0 <0.25.0",
12080
+ filePath
12081
+ },
12082
+ functionQuery: {
12083
+ className: methodName.startsWith("sendMessage") ? "ChatSession" : "GenerativeModel",
12084
+ methodName,
12085
+ kind: "Async"
12086
+ }
12087
+ }))
12088
+ );
12089
+
12031
12090
  // src/instrumentation/plugins/google-genai-channels.ts
12032
12091
  var googleGenAIChannels = defineChannels(
12033
12092
  "@google/genai",
@@ -13592,6 +13651,60 @@ var strandsAgentSDKConfigs = [
13592
13651
  }
13593
13652
  ];
13594
13653
 
13654
+ // src/instrumentation/plugins/elevenlabs-channels.ts
13655
+ var elevenLabsChannels = defineChannels(
13656
+ "@elevenlabs/elevenlabs-js",
13657
+ {
13658
+ convert: channel({
13659
+ channelName: "textToSpeech.convert",
13660
+ kind: "async"
13661
+ }),
13662
+ stream: channel({
13663
+ channelName: "textToSpeech.stream",
13664
+ kind: "async"
13665
+ }),
13666
+ convertWithTimestamps: channel({ channelName: "textToSpeech.convertWithTimestamps", kind: "async" }),
13667
+ streamWithTimestamps: channel({ channelName: "textToSpeech.streamWithTimestamps", kind: "async" }),
13668
+ transcribe: channel({ channelName: "speechToText.convert", kind: "async" })
13669
+ },
13670
+ { instrumentationName: INSTRUMENTATION_NAMES.ELEVENLABS }
13671
+ );
13672
+
13673
+ // src/auto-instrumentations/configs/elevenlabs.ts
13674
+ var elevenLabsConfigs = [
13675
+ ...[
13676
+ "convert",
13677
+ "stream",
13678
+ "convertWithTimestamps",
13679
+ "streamWithTimestamps"
13680
+ ].map((methodName) => ({
13681
+ channelName: elevenLabsChannels[methodName].channelName,
13682
+ module: {
13683
+ name: "@elevenlabs/elevenlabs-js",
13684
+ versionRange: ">=2.67.0 <3.0.0",
13685
+ filePath: "api/resources/textToSpeech/client/Client.js"
13686
+ },
13687
+ functionQuery: {
13688
+ className: "TextToSpeechClient",
13689
+ methodName,
13690
+ kind: "Async"
13691
+ }
13692
+ })),
13693
+ {
13694
+ channelName: elevenLabsChannels.transcribe.channelName,
13695
+ module: {
13696
+ name: "@elevenlabs/elevenlabs-js",
13697
+ versionRange: ">=2.67.0 <3.0.0",
13698
+ filePath: "api/resources/speechToText/client/Client.js"
13699
+ },
13700
+ functionQuery: {
13701
+ className: "SpeechToTextClient",
13702
+ methodName: "convert",
13703
+ kind: "Async"
13704
+ }
13705
+ }
13706
+ ];
13707
+
13595
13708
  // src/instrumentation/plugins/voyageai-channels.ts
13596
13709
  var voyageAIChannels = defineChannels(
13597
13710
  "voyageai",
@@ -13700,6 +13813,10 @@ var defaultInstrumentationConfigGroups = [
13700
13813
  integrations: ["openAIAgents"],
13701
13814
  configs: openAIAgentsCoreConfigs
13702
13815
  },
13816
+ {
13817
+ integrations: ["googleGenerativeAI"],
13818
+ configs: googleGenerativeAIConfigs
13819
+ },
13703
13820
  {
13704
13821
  integrations: ["google", "googleGenAI"],
13705
13822
  configs: googleGenAIConfigs
@@ -13743,6 +13860,10 @@ var defaultInstrumentationConfigGroups = [
13743
13860
  integrations: ["flue"],
13744
13861
  configs: flueConfigs
13745
13862
  },
13863
+ {
13864
+ integrations: ["elevenlabs"],
13865
+ configs: elevenLabsConfigs
13866
+ },
13746
13867
  {
13747
13868
  integrations: ["voyageai"],
13748
13869
  configs: voyageAIConfigs
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  gitHubCopilotConfigs: () => gitHubCopilotConfigs,
34
34
  googleADKConfigs: () => googleADKConfigs,
35
35
  googleGenAIConfigs: () => googleGenAIConfigs,
36
+ googleGenerativeAIConfigs: () => googleGenerativeAIConfigs,
36
37
  groqConfigs: () => groqConfigs,
37
38
  huggingFaceConfigs: () => huggingFaceConfigs,
38
39
  langSmithConfigs: () => langSmithConfigs,
@@ -807,6 +808,7 @@ var INSTRUMENTATION_NAMES = {
807
808
  GENKIT: "genkit",
808
809
  GITHUB_COPILOT: "github-copilot",
809
810
  GOOGLE_ADK: "google-adk",
811
+ GOOGLE_GENERATIVE_AI: "google-generative-ai",
810
812
  GOOGLE_GENAI: "google-genai",
811
813
  GROQ: "groq",
812
814
  HUGGINGFACE: "huggingface",
@@ -822,7 +824,8 @@ var INSTRUMENTATION_NAMES = {
822
824
  OPENROUTER_AGENT: "openrouter-agent",
823
825
  PI_CODING_AGENT: "pi-coding-agent",
824
826
  STRANDS_AGENT_SDK: "strands-agent-sdk",
825
- VOYAGEAI: "voyageai"
827
+ VOYAGEAI: "voyageai",
828
+ ELEVENLABS: "elevenlabs"
826
829
  };
827
830
 
828
831
  // src/instrumentation/plugins/openai-channels.ts
@@ -2111,6 +2114,40 @@ var openAIAgentsCoreConfigs = lifecycleMethods.flatMap(
2111
2114
  )
2112
2115
  );
2113
2116
 
2117
+ // src/instrumentation/plugins/google-generative-ai-channels.ts
2118
+ var googleGenerativeAIChannels = defineChannels(
2119
+ "@google/generative-ai",
2120
+ {
2121
+ generateContent: channel({ channelName: "GenerativeModel.generateContent", kind: "async" }),
2122
+ generateContentStream: channel({ channelName: "GenerativeModel.generateContentStream", kind: "async" }),
2123
+ embedContent: channel({ channelName: "GenerativeModel.embedContent", kind: "async" }),
2124
+ batchEmbedContents: channel({ channelName: "GenerativeModel.batchEmbedContents", kind: "async" }),
2125
+ sendMessage: channel({ channelName: "ChatSession.sendMessage", kind: "async" }),
2126
+ sendMessageStream: channel({ channelName: "ChatSession.sendMessageStream", kind: "async" })
2127
+ },
2128
+ { instrumentationName: INSTRUMENTATION_NAMES.GOOGLE_GENERATIVE_AI }
2129
+ );
2130
+
2131
+ // src/auto-instrumentations/configs/google-generative-ai.ts
2132
+ var googleGenerativeAIConfigs = [
2133
+ "dist/index.js",
2134
+ "dist/index.mjs"
2135
+ ].flatMap(
2136
+ (filePath) => Object.entries(googleGenerativeAIChannels).map(([methodName, channel2]) => ({
2137
+ channelName: channel2.channelName,
2138
+ module: {
2139
+ name: "@google/generative-ai",
2140
+ versionRange: ">=0.24.0 <0.25.0",
2141
+ filePath
2142
+ },
2143
+ functionQuery: {
2144
+ className: methodName.startsWith("sendMessage") ? "ChatSession" : "GenerativeModel",
2145
+ methodName,
2146
+ kind: "Async"
2147
+ }
2148
+ }))
2149
+ );
2150
+
2114
2151
  // src/instrumentation/plugins/google-genai-channels.ts
2115
2152
  var googleGenAIChannels = defineChannels(
2116
2153
  "@google/genai",
@@ -4100,6 +4137,7 @@ var piCodingAgentConfigs = [
4100
4137
  gitHubCopilotConfigs,
4101
4138
  googleADKConfigs,
4102
4139
  googleGenAIConfigs,
4140
+ googleGenerativeAIConfigs,
4103
4141
  groqConfigs,
4104
4142
  huggingFaceConfigs,
4105
4143
  langSmithConfigs,
@@ -64,6 +64,8 @@ declare const cursorSDKConfigs: InstrumentationConfig[];
64
64
 
65
65
  declare const openAIAgentsCoreConfigs: InstrumentationConfig[];
66
66
 
67
+ declare const googleGenerativeAIConfigs: InstrumentationConfig[];
68
+
67
69
  /**
68
70
  * Instrumentation configurations for the Google GenAI SDK.
69
71
  *
@@ -123,4 +125,4 @@ declare const langSmithConfigs: InstrumentationConfig[];
123
125
 
124
126
  declare const piCodingAgentConfigs: InstrumentationConfig[];
125
127
 
126
- export { InstrumentationConfig, aiSDKConfigs, anthropicConfigs, bedrockRuntimeConfigs, claudeAgentSDKConfigs, cloudflareAIChatConfigs, cloudflareAgentsConfigs, cloudflareThinkConfigs, cohereConfigs, cursorSDKConfigs, genkitConfigs, gitHubCopilotConfigs, googleADKConfigs, googleGenAIConfigs, groqConfigs, huggingFaceConfigs, langSmithConfigs, langchainConfigs, mistralConfigs, ollamaConfigs, openAIAgentsCoreConfigs, openAICodexConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs, piCodingAgentConfigs };
128
+ export { InstrumentationConfig, aiSDKConfigs, anthropicConfigs, bedrockRuntimeConfigs, claudeAgentSDKConfigs, cloudflareAIChatConfigs, cloudflareAgentsConfigs, cloudflareThinkConfigs, cohereConfigs, cursorSDKConfigs, genkitConfigs, gitHubCopilotConfigs, googleADKConfigs, googleGenAIConfigs, googleGenerativeAIConfigs, groqConfigs, huggingFaceConfigs, langSmithConfigs, langchainConfigs, mistralConfigs, ollamaConfigs, openAIAgentsCoreConfigs, openAICodexConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs, piCodingAgentConfigs };
@@ -64,6 +64,8 @@ declare const cursorSDKConfigs: InstrumentationConfig[];
64
64
 
65
65
  declare const openAIAgentsCoreConfigs: InstrumentationConfig[];
66
66
 
67
+ declare const googleGenerativeAIConfigs: InstrumentationConfig[];
68
+
67
69
  /**
68
70
  * Instrumentation configurations for the Google GenAI SDK.
69
71
  *
@@ -123,4 +125,4 @@ declare const langSmithConfigs: InstrumentationConfig[];
123
125
 
124
126
  declare const piCodingAgentConfigs: InstrumentationConfig[];
125
127
 
126
- export { InstrumentationConfig, aiSDKConfigs, anthropicConfigs, bedrockRuntimeConfigs, claudeAgentSDKConfigs, cloudflareAIChatConfigs, cloudflareAgentsConfigs, cloudflareThinkConfigs, cohereConfigs, cursorSDKConfigs, genkitConfigs, gitHubCopilotConfigs, googleADKConfigs, googleGenAIConfigs, groqConfigs, huggingFaceConfigs, langSmithConfigs, langchainConfigs, mistralConfigs, ollamaConfigs, openAIAgentsCoreConfigs, openAICodexConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs, piCodingAgentConfigs };
128
+ export { InstrumentationConfig, aiSDKConfigs, anthropicConfigs, bedrockRuntimeConfigs, claudeAgentSDKConfigs, cloudflareAIChatConfigs, cloudflareAgentsConfigs, cloudflareThinkConfigs, cohereConfigs, cursorSDKConfigs, genkitConfigs, gitHubCopilotConfigs, googleADKConfigs, googleGenAIConfigs, googleGenerativeAIConfigs, groqConfigs, huggingFaceConfigs, langSmithConfigs, langchainConfigs, mistralConfigs, ollamaConfigs, openAIAgentsCoreConfigs, openAICodexConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs, piCodingAgentConfigs };
@@ -12,6 +12,7 @@ import {
12
12
  gitHubCopilotConfigs,
13
13
  googleADKConfigs,
14
14
  googleGenAIConfigs,
15
+ googleGenerativeAIConfigs,
15
16
  groqConfigs,
16
17
  huggingFaceConfigs,
17
18
  langSmithConfigs,
@@ -24,7 +25,7 @@ import {
24
25
  openRouterConfigs,
25
26
  openaiConfigs,
26
27
  piCodingAgentConfigs
27
- } from "./chunk-U64OYU4Q.mjs";
28
+ } from "./chunk-AFND2U7E.mjs";
28
29
  import "./chunk-JPUFNW7X.mjs";
29
30
  export {
30
31
  aiSDKConfigs,
@@ -40,6 +41,7 @@ export {
40
41
  gitHubCopilotConfigs,
41
42
  googleADKConfigs,
42
43
  googleGenAIConfigs,
44
+ googleGenerativeAIConfigs,
43
45
  groqConfigs,
44
46
  huggingFaceConfigs,
45
47
  langSmithConfigs,