braintrust 3.22.0 → 3.23.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 +43 -0
- package/dev/dist/index.d.mts +1 -1
- package/dev/dist/index.d.ts +1 -1
- package/dev/dist/index.js +1354 -652
- package/dev/dist/index.mjs +736 -34
- package/dist/apply-auto-instrumentation.js +222 -186
- package/dist/apply-auto-instrumentation.mjs +37 -1
- package/dist/auto-instrumentations/bundler/esbuild.cjs +53 -1
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/next.cjs +53 -1
- package/dist/auto-instrumentations/bundler/next.mjs +3 -3
- package/dist/auto-instrumentations/bundler/rollup.cjs +53 -1
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +53 -1
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +53 -1
- package/dist/auto-instrumentations/bundler/webpack.cjs +53 -1
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
- package/dist/auto-instrumentations/{chunk-TKRPRPGD.mjs → chunk-EXY7QCJD.mjs} +5 -2
- package/dist/auto-instrumentations/{chunk-T6J4C7LX.mjs → chunk-KIMLYPRW.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-BRQX23KL.mjs → chunk-YXLNSAMJ.mjs} +51 -0
- package/dist/auto-instrumentations/hook.mjs +149 -20
- package/dist/auto-instrumentations/index.cjs +52 -0
- 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 +11 -13
- package/dist/browser.d.ts +11 -13
- package/dist/browser.js +1098 -203
- package/dist/browser.mjs +1098 -203
- package/dist/{chunk-KMGUTPB7.mjs → chunk-36IPYKMG.mjs} +20 -1
- package/dist/{chunk-BFGIH2ZJ.js → chunk-CDIKAHDZ.js} +21 -2
- package/dist/{chunk-MWVVR5LR.js → chunk-FZWPFCVE.js} +1506 -820
- package/dist/{chunk-ZG2O3XVF.mjs → chunk-IXL4PMY4.mjs} +719 -33
- package/dist/cli.js +737 -35
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +1098 -203
- package/dist/edge-light.mjs +1098 -203
- package/dist/index.d.mts +11 -13
- package/dist/index.d.ts +11 -13
- package/dist/index.js +786 -593
- package/dist/index.mjs +346 -153
- package/dist/instrumentation/index.d.mts +3 -11
- package/dist/instrumentation/index.d.ts +3 -11
- package/dist/instrumentation/index.js +788 -181
- package/dist/instrumentation/index.mjs +788 -181
- 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 +1098 -203
- package/dist/workerd.mjs +1098 -203
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,6 +104,49 @@ If you use TypeScript or other transpilation plugins, place the Braintrust plugi
|
|
|
104
104
|
|
|
105
105
|
For deeper details, see the [auto-instrumentation architecture docs](src/auto-instrumentations/README.md).
|
|
106
106
|
|
|
107
|
+
### LangSmith tracing
|
|
108
|
+
|
|
109
|
+
Braintrust supports LangSmith `>=0.3.30 <1.0.0`. LangSmith tracing remains authoritative: LangSmith must be enabled, and it continues exporting traces to LangSmith while Braintrust mirrors the same run lifecycle. This integration covers tracing only; LangSmith eval, Jest, and Vitest APIs are not instrumented.
|
|
110
|
+
|
|
111
|
+
For automatic Node.js instrumentation, use the standard hook before importing LangSmith:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
node --import braintrust/hook.mjs app.js
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The Vite, Webpack, esbuild, and Rollup plugins shown above apply the same automatic instrumentation in bundled applications. To instrument explicit namespaces instead, wrap the three LangSmith entrypoints you use:
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import {
|
|
121
|
+
wrapLangSmithClient,
|
|
122
|
+
wrapLangSmithRunTrees,
|
|
123
|
+
wrapLangSmithTraceable,
|
|
124
|
+
} from "braintrust";
|
|
125
|
+
import * as clientNamespace from "langsmith/client";
|
|
126
|
+
import * as runTreesNamespace from "langsmith/run_trees";
|
|
127
|
+
import * as traceableNamespace from "langsmith/traceable";
|
|
128
|
+
|
|
129
|
+
const { Client } = wrapLangSmithClient(clientNamespace);
|
|
130
|
+
const { RunTree } = wrapLangSmithRunTrees(runTreesNamespace);
|
|
131
|
+
const { traceable } = wrapLangSmithTraceable(traceableNamespace);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The wrappers are composable and idempotent. They preserve LangSmith behavior, including its network export and `on_end` callbacks. Automatic and explicit instrumentation can safely be used together.
|
|
135
|
+
|
|
136
|
+
Disable LangSmith instrumentation in code or through the environment:
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
import { configureInstrumentation } from "braintrust";
|
|
140
|
+
|
|
141
|
+
configureInstrumentation({ integrations: { langsmith: false } });
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
BRAINTRUST_DISABLE_INSTRUMENTATION=langsmith node --import braintrust/hook.mjs app.js
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
When Braintrust LangChain/LangGraph instrumentation is enabled, LangSmith runs serialized by LangChain are ignored to avoid duplicate spans. Set `langchain: false` (and use LangSmith instrumentation) when LangSmith should be the source for those runs instead.
|
|
149
|
+
|
|
107
150
|
## Migration Guides
|
|
108
151
|
|
|
109
152
|
### Upgrading from 2.x to 3.x
|
package/dev/dist/index.d.mts
CHANGED
|
@@ -12185,7 +12185,7 @@ declare class HTTPConnection {
|
|
|
12185
12185
|
set_token(token: string): void;
|
|
12186
12186
|
_reset(): void;
|
|
12187
12187
|
get(path: string, params?: Record<string, string | string[] | undefined> | undefined, config?: RequestInit): Promise<Response>;
|
|
12188
|
-
post(path: string, params?: Record<string, unknown> | string, config?: RequestInit): Promise<Response>;
|
|
12188
|
+
post(path: string, params?: Record<string, unknown> | string, config?: RequestInit, retries?: number): Promise<Response>;
|
|
12189
12189
|
get_json(object_type: string, args?: Record<string, string | string[] | undefined> | undefined, retries?: number): Promise<any>;
|
|
12190
12190
|
post_json(object_type: string, args?: Record<string, unknown> | string | undefined): Promise<any>;
|
|
12191
12191
|
toString(): string;
|
package/dev/dist/index.d.ts
CHANGED
|
@@ -12185,7 +12185,7 @@ declare class HTTPConnection {
|
|
|
12185
12185
|
set_token(token: string): void;
|
|
12186
12186
|
_reset(): void;
|
|
12187
12187
|
get(path: string, params?: Record<string, string | string[] | undefined> | undefined, config?: RequestInit): Promise<Response>;
|
|
12188
|
-
post(path: string, params?: Record<string, unknown> | string, config?: RequestInit): Promise<Response>;
|
|
12188
|
+
post(path: string, params?: Record<string, unknown> | string, config?: RequestInit, retries?: number): Promise<Response>;
|
|
12189
12189
|
get_json(object_type: string, args?: Record<string, string | string[] | undefined> | undefined, retries?: number): Promise<any>;
|
|
12190
12190
|
post_json(object_type: string, args?: Record<string, unknown> | string | undefined): Promise<any>;
|
|
12191
12191
|
toString(): string;
|