braintrust 3.1.0 → 3.2.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/README.md +73 -0
- package/dev/dist/index.d.mts +187 -903
- package/dev/dist/index.d.ts +187 -903
- package/dev/dist/index.js +2942 -323
- package/dev/dist/index.mjs +2704 -85
- package/dist/auto-instrumentations/bundler/esbuild.cjs +401 -0
- package/dist/auto-instrumentations/bundler/esbuild.d.mts +8 -0
- package/dist/auto-instrumentations/bundler/esbuild.d.ts +8 -0
- package/dist/auto-instrumentations/bundler/esbuild.mjs +10 -0
- package/dist/auto-instrumentations/bundler/rollup.cjs +401 -0
- package/dist/auto-instrumentations/bundler/rollup.d.mts +8 -0
- package/dist/auto-instrumentations/bundler/rollup.d.ts +8 -0
- package/dist/auto-instrumentations/bundler/rollup.mjs +10 -0
- package/dist/auto-instrumentations/bundler/vite.cjs +401 -0
- package/dist/auto-instrumentations/bundler/vite.d.mts +8 -0
- package/dist/auto-instrumentations/bundler/vite.d.ts +8 -0
- package/dist/auto-instrumentations/bundler/vite.mjs +10 -0
- package/dist/auto-instrumentations/bundler/webpack.cjs +401 -0
- package/dist/auto-instrumentations/bundler/webpack.d.mts +8 -0
- package/dist/auto-instrumentations/bundler/webpack.d.ts +8 -0
- package/dist/auto-instrumentations/bundler/webpack.mjs +10 -0
- package/dist/auto-instrumentations/chunk-KVX7OFPD.mjs +288 -0
- package/dist/auto-instrumentations/chunk-OLOPGWTJ.mjs +89 -0
- package/dist/auto-instrumentations/chunk-XDBPUTVE.mjs +22 -0
- package/dist/auto-instrumentations/chunk-ZEC7BCL4.mjs +22 -0
- package/dist/auto-instrumentations/hook.mjs +378 -0
- package/dist/auto-instrumentations/index.cjs +318 -0
- package/dist/auto-instrumentations/index.d.mts +69 -0
- package/dist/auto-instrumentations/index.d.ts +69 -0
- package/dist/auto-instrumentations/index.mjs +14 -0
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +116 -0
- package/dist/auto-instrumentations/loader/cjs-patch.d.mts +28 -0
- package/dist/auto-instrumentations/loader/cjs-patch.d.ts +28 -0
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +66 -0
- package/dist/auto-instrumentations/loader/esm-hook.mjs +72 -0
- package/dist/auto-instrumentations/loader/get-package-version.cjs +46 -0
- package/dist/auto-instrumentations/loader/get-package-version.d.mts +7 -0
- package/dist/auto-instrumentations/loader/get-package-version.d.ts +7 -0
- package/dist/auto-instrumentations/loader/get-package-version.mjs +6 -0
- package/dist/auto-instrumentations/plugin-Df3qKIl2.d.mts +22 -0
- package/dist/auto-instrumentations/plugin-Df3qKIl2.d.ts +22 -0
- package/dist/browser.d.mts +484 -980
- package/dist/browser.d.ts +484 -980
- package/dist/browser.js +3437 -386
- package/dist/browser.mjs +3437 -386
- package/dist/cli.js +2890 -228
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +3134 -86
- package/dist/edge-light.mjs +3134 -86
- package/dist/index.d.mts +484 -980
- package/dist/index.d.ts +484 -980
- package/dist/index.js +3754 -703
- package/dist/index.mjs +3615 -564
- package/dist/instrumentation/index.d.mts +323 -0
- package/dist/instrumentation/index.d.ts +323 -0
- package/dist/instrumentation/index.js +9942 -0
- package/dist/instrumentation/index.mjs +9902 -0
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +3134 -86
- package/dist/workerd.mjs +3134 -86
- package/package.json +46 -7
package/README.md
CHANGED
|
@@ -69,3 +69,76 @@ The `@braintrust/browser` package is optimized for browser environments and incl
|
|
|
69
69
|
See the [@braintrust/browser README](../integrations/browser-js/README.md) for more details.
|
|
70
70
|
|
|
71
71
|
**Breaking change in v3.0.0:** The `braintrust/browser` subpath export has been deprecated. Browser users should migrate to the `@braintrust/browser` package.
|
|
72
|
+
|
|
73
|
+
### Auto-Instrumentation
|
|
74
|
+
|
|
75
|
+
Braintrust provides automatic instrumentation for popular AI SDKs, eliminating the need for manual wrapping. This feature automatically logs all AI SDK calls (OpenAI, Anthropic, Vercel AI SDK, etc.) to Braintrust without any code changes.
|
|
76
|
+
|
|
77
|
+
#### Node.js Applications
|
|
78
|
+
|
|
79
|
+
For Node.js applications, use the `--import` flag to load the instrumentation hook:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
node --import braintrust/hook.mjs app.js
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
This works with both ESM and CommonJS modules automatically.
|
|
86
|
+
|
|
87
|
+
#### Browser/Bundled Applications
|
|
88
|
+
|
|
89
|
+
For browser applications or bundled Node.js applications, use the appropriate bundler plugin:
|
|
90
|
+
|
|
91
|
+
**Vite:**
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// vite.config.ts
|
|
95
|
+
import { vitePlugin } from "braintrust/vite";
|
|
96
|
+
|
|
97
|
+
export default {
|
|
98
|
+
plugins: [vitePlugin()],
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Webpack:**
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
// webpack.config.js
|
|
106
|
+
const { webpackPlugin } = require("braintrust/webpack");
|
|
107
|
+
|
|
108
|
+
module.exports = {
|
|
109
|
+
plugins: [webpackPlugin()],
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**esbuild:**
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
import { esbuildPlugin } from "braintrust/esbuild";
|
|
117
|
+
|
|
118
|
+
await esbuild.build({
|
|
119
|
+
plugins: [esbuildPlugin()],
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Rollup:**
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
import { rollupPlugin } from "braintrust/rollup";
|
|
127
|
+
|
|
128
|
+
export default {
|
|
129
|
+
plugins: [rollupPlugin()],
|
|
130
|
+
};
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Important:** If you're using TypeScript or other transpilation plugins, place the Braintrust plugin **after** them in the plugin array to ensure it instruments the transformed code:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
export default {
|
|
137
|
+
plugins: [
|
|
138
|
+
typescript(), // or other transpilation plugins
|
|
139
|
+
vitePlugin(), // Braintrust plugin should come after
|
|
140
|
+
],
|
|
141
|
+
};
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
For more information on auto-instrumentation, see the [internal architecture docs](src/auto-instrumentations/README.md).
|