braintrust 3.32.0 → 3.33.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 +0 -43
- package/dev/dist/index.d.mts +31 -0
- package/dev/dist/index.d.ts +31 -0
- package/dev/dist/index.js +2275 -920
- package/dev/dist/index.mjs +1610 -255
- package/dist/apply-auto-instrumentation.js +263 -224
- package/dist/apply-auto-instrumentation.mjs +45 -6
- package/dist/auto-instrumentations/bundler/esbuild.cjs +78 -5
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/next.cjs +78 -5
- package/dist/auto-instrumentations/bundler/next.mjs +3 -3
- package/dist/auto-instrumentations/bundler/rollup.cjs +78 -5
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +78 -5
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +78 -5
- package/dist/auto-instrumentations/bundler/webpack.cjs +78 -5
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
- package/dist/auto-instrumentations/{chunk-AFND2U7E.mjs → chunk-T2DMPWFI.mjs} +75 -5
- package/dist/auto-instrumentations/{chunk-RI4Y55ZF.mjs → chunk-UHJ2DNYJ.mjs} +6 -1
- package/dist/auto-instrumentations/{chunk-QEEPRBIS.mjs → chunk-W5QNG3PV.mjs} +1 -1
- package/dist/auto-instrumentations/hook.mjs +86 -7
- package/dist/auto-instrumentations/index.cjs +76 -5
- 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 +202 -342
- package/dist/browser.d.ts +202 -342
- package/dist/browser.js +2586 -623
- package/dist/browser.mjs +2586 -623
- package/dist/chunk-7P6ASYW6.mjs +9 -0
- package/dist/{chunk-BTRLPQG5.js → chunk-AXJTOUOC.js} +2250 -1172
- package/dist/{chunk-AW4QECG5.js → chunk-G3VHOHRC.js} +40 -9
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/{chunk-4QSAHP7D.mjs → chunk-MZLBAFVJ.mjs} +1236 -158
- package/dist/{chunk-WV6QZI2W.mjs → chunk-TZVZN2JJ.mjs} +39 -8
- package/dist/cli.js +1695 -293
- package/dist/custom-views.d.mts +112 -0
- package/dist/custom-views.d.ts +112 -0
- package/dist/custom-views.js +13 -0
- package/dist/custom-views.mjs +13 -0
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +2586 -623
- package/dist/edge-light.mjs +2586 -623
- package/dist/index.d.mts +202 -342
- package/dist/index.d.ts +202 -342
- package/dist/index.js +1842 -986
- package/dist/index.mjs +1310 -454
- package/dist/instrumentation/index.d.mts +5 -245
- package/dist/instrumentation/index.d.ts +5 -245
- package/dist/instrumentation/index.js +1694 -254
- package/dist/instrumentation/index.mjs +1694 -254
- package/dist/vitest-evals-reporter.js +17 -16
- package/dist/vitest-evals-reporter.mjs +3 -2
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +2586 -623
- package/dist/workerd.mjs +2586 -623
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -104,49 +104,6 @@ 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
|
-
|
|
150
107
|
## Migration Guides
|
|
151
108
|
|
|
152
109
|
### Upgrading from 2.x to 3.x
|
package/dev/dist/index.d.mts
CHANGED
|
@@ -14447,6 +14447,34 @@ interface DatasetSummary {
|
|
|
14447
14447
|
dataSummary: DataSummary | undefined;
|
|
14448
14448
|
}
|
|
14449
14449
|
|
|
14450
|
+
/** Inclusive span duration bounds, in seconds. */
|
|
14451
|
+
interface SpanDurationFilter {
|
|
14452
|
+
/** Minimum value of metrics.end - metrics.start. */
|
|
14453
|
+
min?: number;
|
|
14454
|
+
/** Maximum value of metrics.end - metrics.start. */
|
|
14455
|
+
max?: number;
|
|
14456
|
+
}
|
|
14457
|
+
/**
|
|
14458
|
+
* Filters supported by Trace.getSpans(). Different fields combine with AND.
|
|
14459
|
+
*
|
|
14460
|
+
* Empty name/spanType arrays match no spans. Empty metadata/duration objects
|
|
14461
|
+
* add no constraints. Omit a field to leave it unfiltered.
|
|
14462
|
+
*/
|
|
14463
|
+
interface SpanFilters {
|
|
14464
|
+
/** Match spans whose span_attributes.type equals any of these. */
|
|
14465
|
+
spanType?: string[];
|
|
14466
|
+
/** Match spans whose span_attributes.name equals any of these. */
|
|
14467
|
+
name?: string[];
|
|
14468
|
+
/** Match spans based on whether they recorded an error. */
|
|
14469
|
+
hasError?: boolean;
|
|
14470
|
+
/**
|
|
14471
|
+
* Match metadata keys at any depth without type coercion. `null` matches a
|
|
14472
|
+
* null or missing path.
|
|
14473
|
+
*/
|
|
14474
|
+
metadata?: Record<string, unknown>;
|
|
14475
|
+
/** Bound how long the span took. */
|
|
14476
|
+
duration?: SpanDurationFilter;
|
|
14477
|
+
}
|
|
14450
14478
|
/**
|
|
14451
14479
|
* Span data returned by getSpans().
|
|
14452
14480
|
*/
|
|
@@ -14475,7 +14503,10 @@ interface GetThreadOptions {
|
|
|
14475
14503
|
preprocessor?: string;
|
|
14476
14504
|
}
|
|
14477
14505
|
interface GetSpansOptions {
|
|
14506
|
+
/** Optional top-level span type filter. */
|
|
14478
14507
|
spanType?: string[];
|
|
14508
|
+
/** Filters for span type, name, error state, metadata, and duration. */
|
|
14509
|
+
filters?: SpanFilters;
|
|
14479
14510
|
includeScorers?: boolean;
|
|
14480
14511
|
}
|
|
14481
14512
|
/**
|
package/dev/dist/index.d.ts
CHANGED
|
@@ -14447,6 +14447,34 @@ interface DatasetSummary {
|
|
|
14447
14447
|
dataSummary: DataSummary | undefined;
|
|
14448
14448
|
}
|
|
14449
14449
|
|
|
14450
|
+
/** Inclusive span duration bounds, in seconds. */
|
|
14451
|
+
interface SpanDurationFilter {
|
|
14452
|
+
/** Minimum value of metrics.end - metrics.start. */
|
|
14453
|
+
min?: number;
|
|
14454
|
+
/** Maximum value of metrics.end - metrics.start. */
|
|
14455
|
+
max?: number;
|
|
14456
|
+
}
|
|
14457
|
+
/**
|
|
14458
|
+
* Filters supported by Trace.getSpans(). Different fields combine with AND.
|
|
14459
|
+
*
|
|
14460
|
+
* Empty name/spanType arrays match no spans. Empty metadata/duration objects
|
|
14461
|
+
* add no constraints. Omit a field to leave it unfiltered.
|
|
14462
|
+
*/
|
|
14463
|
+
interface SpanFilters {
|
|
14464
|
+
/** Match spans whose span_attributes.type equals any of these. */
|
|
14465
|
+
spanType?: string[];
|
|
14466
|
+
/** Match spans whose span_attributes.name equals any of these. */
|
|
14467
|
+
name?: string[];
|
|
14468
|
+
/** Match spans based on whether they recorded an error. */
|
|
14469
|
+
hasError?: boolean;
|
|
14470
|
+
/**
|
|
14471
|
+
* Match metadata keys at any depth without type coercion. `null` matches a
|
|
14472
|
+
* null or missing path.
|
|
14473
|
+
*/
|
|
14474
|
+
metadata?: Record<string, unknown>;
|
|
14475
|
+
/** Bound how long the span took. */
|
|
14476
|
+
duration?: SpanDurationFilter;
|
|
14477
|
+
}
|
|
14450
14478
|
/**
|
|
14451
14479
|
* Span data returned by getSpans().
|
|
14452
14480
|
*/
|
|
@@ -14475,7 +14503,10 @@ interface GetThreadOptions {
|
|
|
14475
14503
|
preprocessor?: string;
|
|
14476
14504
|
}
|
|
14477
14505
|
interface GetSpansOptions {
|
|
14506
|
+
/** Optional top-level span type filter. */
|
|
14478
14507
|
spanType?: string[];
|
|
14508
|
+
/** Filters for span type, name, error state, metadata, and duration. */
|
|
14509
|
+
filters?: SpanFilters;
|
|
14479
14510
|
includeScorers?: boolean;
|
|
14480
14511
|
}
|
|
14481
14512
|
/**
|