braintrust 3.20.0 → 3.21.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/NOTICE +20 -0
- package/README.md +2 -0
- package/dev/dist/index.d.mts +309 -199
- package/dev/dist/index.d.ts +309 -199
- package/dev/dist/index.js +2826 -983
- package/dev/dist/index.mjs +2286 -443
- package/dist/apply-auto-instrumentation.js +781 -199
- package/dist/apply-auto-instrumentation.mjs +588 -6
- package/dist/auto-instrumentations/bundler/esbuild.cjs +594 -2
- package/dist/auto-instrumentations/bundler/esbuild.d.mts +2 -2
- package/dist/auto-instrumentations/bundler/esbuild.d.ts +2 -2
- package/dist/auto-instrumentations/bundler/esbuild.mjs +3 -3
- package/dist/auto-instrumentations/bundler/next.cjs +594 -2
- package/dist/auto-instrumentations/bundler/next.mjs +4 -4
- package/dist/auto-instrumentations/bundler/rollup.cjs +594 -2
- package/dist/auto-instrumentations/bundler/rollup.d.mts +2 -2
- package/dist/auto-instrumentations/bundler/rollup.d.ts +2 -2
- package/dist/auto-instrumentations/bundler/rollup.mjs +3 -3
- package/dist/auto-instrumentations/bundler/vite.cjs +594 -2
- package/dist/auto-instrumentations/bundler/vite.d.mts +2 -2
- package/dist/auto-instrumentations/bundler/vite.d.ts +2 -2
- package/dist/auto-instrumentations/bundler/vite.mjs +3 -3
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +593 -9
- package/dist/auto-instrumentations/bundler/webpack-loader.d.ts +68 -1
- package/dist/auto-instrumentations/bundler/webpack.cjs +594 -2
- package/dist/auto-instrumentations/bundler/webpack.d.mts +2 -2
- package/dist/auto-instrumentations/bundler/webpack.d.ts +2 -2
- package/dist/auto-instrumentations/bundler/webpack.mjs +4 -4
- package/dist/auto-instrumentations/{chunk-W4E36GIW.mjs → chunk-BRQX23KL.mjs} +16 -0
- package/dist/auto-instrumentations/chunk-M6DLIJ2Z.mjs +784 -0
- package/dist/auto-instrumentations/{chunk-K74TZGGM.mjs → chunk-T6J4C7LX.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-S4374IP6.mjs → chunk-TKRPRPGD.mjs} +4 -6
- package/dist/auto-instrumentations/chunk-VT6DDNKM.mjs +856 -0
- package/dist/auto-instrumentations/hook.mjs +749 -45
- package/dist/auto-instrumentations/index.cjs +16 -0
- package/dist/auto-instrumentations/index.d.mts +2 -3
- package/dist/auto-instrumentations/index.d.ts +2 -3
- package/dist/auto-instrumentations/index.mjs +1 -1
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +578 -4
- package/dist/auto-instrumentations/loader/cjs-patch.d.mts +1 -1
- package/dist/auto-instrumentations/loader/cjs-patch.d.ts +1 -1
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +3 -7
- package/dist/auto-instrumentations/loader/esm-hook.mjs +2 -6
- package/dist/auto-instrumentations/{plugin-D7nDswtC.d.mts → plugin-D0KHwSJv.d.mts} +1 -1
- package/dist/auto-instrumentations/{plugin-D7nDswtC.d.ts → plugin-G6fgxk1b.d.ts} +1 -1
- package/dist/auto-instrumentations/types-RNPaKi9o.d.mts +70 -0
- package/dist/auto-instrumentations/types-RNPaKi9o.d.ts +70 -0
- package/dist/browser.d.mts +1357 -847
- package/dist/browser.d.ts +1357 -847
- package/dist/browser.js +2726 -469
- package/dist/browser.mjs +2726 -469
- package/dist/{chunk-LPC4W2WX.js → chunk-BFGIH2ZJ.js} +4 -0
- package/dist/{chunk-POCCIJAL.js → chunk-FY7DAKA5.js} +3141 -1269
- package/dist/{chunk-Y7W7WP6H.mjs → chunk-KMGUTPB7.mjs} +4 -0
- package/dist/{chunk-F73OMF66.mjs → chunk-O2P765XK.mjs} +2391 -519
- package/dist/cli.js +2260 -408
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +2726 -469
- package/dist/edge-light.mjs +2726 -469
- package/dist/index.d.mts +1837 -1327
- package/dist/index.d.ts +1837 -1327
- package/dist/index.js +752 -353
- package/dist/index.mjs +445 -46
- package/dist/instrumentation/index.d.mts +107 -19
- package/dist/instrumentation/index.d.ts +107 -19
- package/dist/instrumentation/index.js +2337 -509
- package/dist/instrumentation/index.mjs +2337 -509
- 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 +2726 -469
- package/dist/workerd.mjs +2726 -469
- package/licenses/import-in-the-middle/LICENSE +201 -0
- package/licenses/import-in-the-middle/LICENSE-3rdparty.csv +4 -0
- package/licenses/import-in-the-middle/NOTICE +34 -0
- package/licenses/orchestrion-js/LICENSE +202 -0
- package/licenses/orchestrion-js/LICENSE-3rdparty.csv +8 -0
- package/licenses/orchestrion-js/NOTICE +3 -0
- package/licenses/require-in-the-middle/LICENSE +23 -0
- package/package.json +13 -4
- package/util/dist/index.d.mts +1 -0
- package/util/dist/index.d.ts +1 -0
- package/util/dist/index.js +4 -4
- package/util/dist/index.mjs +2 -2
- package/dist/auto-instrumentations/chunk-J57YF7WS.mjs +0 -208
- package/dist/auto-instrumentations/chunk-QFMACSOL.mjs +0 -280
|
@@ -2891,18 +2891,21 @@ declare const PromptData: z.ZodObject<{
|
|
|
2891
2891
|
choice_scores: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
2892
2892
|
choice: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2893
2893
|
allow_no_match: z.ZodOptional<z.ZodBoolean>;
|
|
2894
|
+
allow_skip: z.ZodOptional<z.ZodBoolean>;
|
|
2894
2895
|
}, "strip", z.ZodTypeAny, {
|
|
2895
2896
|
type: "llm_classifier";
|
|
2896
2897
|
use_cot: boolean;
|
|
2897
2898
|
choice_scores?: Record<string, number> | undefined;
|
|
2898
2899
|
choice?: string[] | undefined;
|
|
2899
2900
|
allow_no_match?: boolean | undefined;
|
|
2901
|
+
allow_skip?: boolean | undefined;
|
|
2900
2902
|
}, {
|
|
2901
2903
|
type: "llm_classifier";
|
|
2902
2904
|
use_cot: boolean;
|
|
2903
2905
|
choice_scores?: Record<string, number> | undefined;
|
|
2904
2906
|
choice?: string[] | undefined;
|
|
2905
2907
|
allow_no_match?: boolean | undefined;
|
|
2908
|
+
allow_skip?: boolean | undefined;
|
|
2906
2909
|
}>, z.ZodNull]>>;
|
|
2907
2910
|
tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
2908
2911
|
type: z.ZodLiteral<"function">;
|
|
@@ -3202,6 +3205,7 @@ declare const PromptData: z.ZodObject<{
|
|
|
3202
3205
|
choice_scores?: Record<string, number> | undefined;
|
|
3203
3206
|
choice?: string[] | undefined;
|
|
3204
3207
|
allow_no_match?: boolean | undefined;
|
|
3208
|
+
allow_skip?: boolean | undefined;
|
|
3205
3209
|
} | null | undefined;
|
|
3206
3210
|
tool_functions?: ({
|
|
3207
3211
|
type: "function";
|
|
@@ -3452,6 +3456,7 @@ declare const PromptData: z.ZodObject<{
|
|
|
3452
3456
|
choice_scores?: Record<string, number> | undefined;
|
|
3453
3457
|
choice?: string[] | undefined;
|
|
3454
3458
|
allow_no_match?: boolean | undefined;
|
|
3459
|
+
allow_skip?: boolean | undefined;
|
|
3455
3460
|
} | null | undefined;
|
|
3456
3461
|
tool_functions?: ({
|
|
3457
3462
|
type: "function";
|
|
@@ -4726,18 +4731,21 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
4726
4731
|
choice_scores: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
4727
4732
|
choice: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
4728
4733
|
allow_no_match: z.ZodOptional<z.ZodBoolean>;
|
|
4734
|
+
allow_skip: z.ZodOptional<z.ZodBoolean>;
|
|
4729
4735
|
}, "strip", z.ZodTypeAny, {
|
|
4730
4736
|
type: "llm_classifier";
|
|
4731
4737
|
use_cot: boolean;
|
|
4732
4738
|
choice_scores?: Record<string, number> | undefined;
|
|
4733
4739
|
choice?: string[] | undefined;
|
|
4734
4740
|
allow_no_match?: boolean | undefined;
|
|
4741
|
+
allow_skip?: boolean | undefined;
|
|
4735
4742
|
}, {
|
|
4736
4743
|
type: "llm_classifier";
|
|
4737
4744
|
use_cot: boolean;
|
|
4738
4745
|
choice_scores?: Record<string, number> | undefined;
|
|
4739
4746
|
choice?: string[] | undefined;
|
|
4740
4747
|
allow_no_match?: boolean | undefined;
|
|
4748
|
+
allow_skip?: boolean | undefined;
|
|
4741
4749
|
}>, z.ZodNull]>>;
|
|
4742
4750
|
tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
4743
4751
|
type: z.ZodLiteral<"function">;
|
|
@@ -5037,6 +5045,7 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5037
5045
|
choice_scores?: Record<string, number> | undefined;
|
|
5038
5046
|
choice?: string[] | undefined;
|
|
5039
5047
|
allow_no_match?: boolean | undefined;
|
|
5048
|
+
allow_skip?: boolean | undefined;
|
|
5040
5049
|
} | null | undefined;
|
|
5041
5050
|
tool_functions?: ({
|
|
5042
5051
|
type: "function";
|
|
@@ -5287,6 +5296,7 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5287
5296
|
choice_scores?: Record<string, number> | undefined;
|
|
5288
5297
|
choice?: string[] | undefined;
|
|
5289
5298
|
allow_no_match?: boolean | undefined;
|
|
5299
|
+
allow_skip?: boolean | undefined;
|
|
5290
5300
|
} | null | undefined;
|
|
5291
5301
|
tool_functions?: ({
|
|
5292
5302
|
type: "function";
|
|
@@ -5315,15 +5325,15 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5315
5325
|
function_type: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["llm", "scorer", "task", "tool", "custom_view", "preprocessor", "facet", "classifier", "tag", "parameters", "sandbox"]>, z.ZodNull]>>;
|
|
5316
5326
|
}, "strip", z.ZodTypeAny, {
|
|
5317
5327
|
id: string;
|
|
5318
|
-
org_id: string;
|
|
5319
|
-
name: string;
|
|
5320
5328
|
project_id: string;
|
|
5321
|
-
|
|
5329
|
+
name: string;
|
|
5322
5330
|
slug: string;
|
|
5331
|
+
org_id: string;
|
|
5332
|
+
_xact_id: string;
|
|
5323
5333
|
log_id: "p";
|
|
5324
5334
|
created?: string | null | undefined;
|
|
5325
|
-
metadata?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
5326
5335
|
description?: string | null | undefined;
|
|
5336
|
+
metadata?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
5327
5337
|
function_type?: "llm" | "scorer" | "task" | "tool" | "custom_view" | "preprocessor" | "facet" | "classifier" | "tag" | "parameters" | "sandbox" | null | undefined;
|
|
5328
5338
|
tags?: string[] | null | undefined;
|
|
5329
5339
|
prompt_data?: {
|
|
@@ -5554,6 +5564,7 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5554
5564
|
choice_scores?: Record<string, number> | undefined;
|
|
5555
5565
|
choice?: string[] | undefined;
|
|
5556
5566
|
allow_no_match?: boolean | undefined;
|
|
5567
|
+
allow_skip?: boolean | undefined;
|
|
5557
5568
|
} | null | undefined;
|
|
5558
5569
|
tool_functions?: ({
|
|
5559
5570
|
type: "function";
|
|
@@ -5579,15 +5590,15 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5579
5590
|
} | null | undefined;
|
|
5580
5591
|
}, {
|
|
5581
5592
|
id: string;
|
|
5582
|
-
org_id: string;
|
|
5583
|
-
name: string;
|
|
5584
5593
|
project_id: string;
|
|
5585
|
-
|
|
5594
|
+
name: string;
|
|
5586
5595
|
slug: string;
|
|
5596
|
+
org_id: string;
|
|
5597
|
+
_xact_id: string;
|
|
5587
5598
|
log_id: "p";
|
|
5588
5599
|
created?: string | null | undefined;
|
|
5589
|
-
metadata?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
5590
5600
|
description?: string | null | undefined;
|
|
5601
|
+
metadata?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
5591
5602
|
function_type?: "llm" | "scorer" | "task" | "tool" | "custom_view" | "preprocessor" | "facet" | "classifier" | "tag" | "parameters" | "sandbox" | null | undefined;
|
|
5592
5603
|
tags?: string[] | null | undefined;
|
|
5593
5604
|
prompt_data?: {
|
|
@@ -5818,6 +5829,7 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5818
5829
|
choice_scores?: Record<string, number> | undefined;
|
|
5819
5830
|
choice?: string[] | undefined;
|
|
5820
5831
|
allow_no_match?: boolean | undefined;
|
|
5832
|
+
allow_skip?: boolean | undefined;
|
|
5821
5833
|
} | null | undefined;
|
|
5822
5834
|
tool_functions?: ({
|
|
5823
5835
|
type: "function";
|
|
@@ -6233,6 +6245,31 @@ declare abstract class IDGenerator {
|
|
|
6233
6245
|
abstract shareRootSpanId(): boolean;
|
|
6234
6246
|
}
|
|
6235
6247
|
|
|
6248
|
+
type TraceContextHeaderValue = string | number | readonly string[] | null | undefined;
|
|
6249
|
+
/**
|
|
6250
|
+
* Minimal structural interface for outbound HTTP header carriers.
|
|
6251
|
+
*
|
|
6252
|
+
* Supports plain objects, Web/Fetch-compatible `Headers`, Node/Fastify-style
|
|
6253
|
+
* response carriers, and mutable `HeadersInit` tuple arrays.
|
|
6254
|
+
*/
|
|
6255
|
+
type TraceContextCarrier = {
|
|
6256
|
+
[name: string]: TraceContextHeaderValue;
|
|
6257
|
+
} | {
|
|
6258
|
+
get(name: string): TraceContextHeaderValue;
|
|
6259
|
+
set(name: string, value: string): void;
|
|
6260
|
+
delete?(name: string): void;
|
|
6261
|
+
} | {
|
|
6262
|
+
getHeader(name: string): TraceContextHeaderValue;
|
|
6263
|
+
setHeader(name: string, value: string): void;
|
|
6264
|
+
removeHeader?(name: string): void;
|
|
6265
|
+
} | {
|
|
6266
|
+
get?(name: string): TraceContextHeaderValue;
|
|
6267
|
+
getHeader?(name: string): TraceContextHeaderValue;
|
|
6268
|
+
header(name: string, value: string): void;
|
|
6269
|
+
delete?(name: string): void;
|
|
6270
|
+
removeHeader?(name: string): void;
|
|
6271
|
+
} | [string, string][];
|
|
6272
|
+
|
|
6236
6273
|
declare const TRANSACTION_ID_FIELD = "_xact_id";
|
|
6237
6274
|
declare const IS_MERGE_FIELD = "_is_merge";
|
|
6238
6275
|
declare const MERGE_PATHS_FIELD = "_merge_paths";
|
|
@@ -6323,13 +6360,13 @@ declare const AsyncScoringControl: z.ZodUnion<[z.ZodObject<{
|
|
|
6323
6360
|
function_ids: z.ZodArray<z.ZodUnknown, "many">;
|
|
6324
6361
|
triggered_xact_id: z.ZodString;
|
|
6325
6362
|
}, "strip", z.ZodTypeAny, {
|
|
6363
|
+
kind: "complete_triggered_functions";
|
|
6326
6364
|
triggered_xact_id: string;
|
|
6327
6365
|
function_ids: unknown[];
|
|
6328
|
-
kind: "complete_triggered_functions";
|
|
6329
6366
|
}, {
|
|
6367
|
+
kind: "complete_triggered_functions";
|
|
6330
6368
|
triggered_xact_id: string;
|
|
6331
6369
|
function_ids: unknown[];
|
|
6332
|
-
kind: "complete_triggered_functions";
|
|
6333
6370
|
}>]>;
|
|
6334
6371
|
type AsyncScoringControlType = z.infer<typeof AsyncScoringControl>;
|
|
6335
6372
|
declare const ObjectReference: z.ZodObject<{
|
|
@@ -6406,6 +6443,7 @@ type ExperimentEvent = Partial<InputField> & Partial<OtherExperimentLogFields> &
|
|
|
6406
6443
|
span_parents: string[];
|
|
6407
6444
|
span_attributes: Record<string, unknown>;
|
|
6408
6445
|
context: Record<string, unknown>;
|
|
6446
|
+
is_root: boolean | null;
|
|
6409
6447
|
[AUDIT_SOURCE_FIELD]: Source;
|
|
6410
6448
|
[AUDIT_METADATA_FIELD]?: Record<string, unknown>;
|
|
6411
6449
|
}>;
|
|
@@ -6919,6 +6957,8 @@ declare class SpanCache {
|
|
|
6919
6957
|
dispose(): void;
|
|
6920
6958
|
}
|
|
6921
6959
|
|
|
6960
|
+
/// <reference lib="dom" />
|
|
6961
|
+
|
|
6922
6962
|
declare const RESET_CONTEXT_MANAGER_STATE: unique symbol;
|
|
6923
6963
|
declare const datasetRestorePreviewResultSchema: z.ZodObject<{
|
|
6924
6964
|
rows_to_restore: z.ZodNumber;
|
|
@@ -6969,32 +7009,32 @@ declare const parametersRowSchema: z.ZodObject<{
|
|
|
6969
7009
|
metadata: z.ZodOptional<z.ZodUnion<[z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, z.ZodNull]>>;
|
|
6970
7010
|
}, "strip", z.ZodTypeAny, {
|
|
6971
7011
|
id: string;
|
|
7012
|
+
project_id: string;
|
|
6972
7013
|
name: string;
|
|
7014
|
+
slug: string;
|
|
6973
7015
|
function_type: "parameters";
|
|
6974
|
-
project_id: string;
|
|
6975
7016
|
_xact_id: string;
|
|
6976
|
-
slug: string;
|
|
6977
7017
|
function_data: {
|
|
6978
7018
|
type: "parameters";
|
|
6979
7019
|
__schema: Record<string, unknown>;
|
|
6980
7020
|
data?: Record<string, unknown> | undefined;
|
|
6981
7021
|
};
|
|
6982
|
-
metadata?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
6983
7022
|
description?: string | null | undefined;
|
|
7023
|
+
metadata?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
6984
7024
|
}, {
|
|
6985
7025
|
id: string;
|
|
7026
|
+
project_id: string;
|
|
6986
7027
|
name: string;
|
|
7028
|
+
slug: string;
|
|
6987
7029
|
function_type: "parameters";
|
|
6988
|
-
project_id: string;
|
|
6989
7030
|
_xact_id: string;
|
|
6990
|
-
slug: string;
|
|
6991
7031
|
function_data: {
|
|
6992
7032
|
type: "parameters";
|
|
6993
7033
|
__schema: Record<string, unknown>;
|
|
6994
7034
|
data?: Record<string, unknown> | undefined;
|
|
6995
7035
|
};
|
|
6996
|
-
metadata?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
6997
7036
|
description?: string | null | undefined;
|
|
7037
|
+
metadata?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
6998
7038
|
}>;
|
|
6999
7039
|
type ParametersRow = z.infer<typeof parametersRowSchema>;
|
|
7000
7040
|
|
|
@@ -7011,7 +7051,12 @@ type StartSpanArgs = {
|
|
|
7011
7051
|
type?: SpanType;
|
|
7012
7052
|
spanAttributes?: Record<any, any>;
|
|
7013
7053
|
startTime?: number;
|
|
7014
|
-
|
|
7054
|
+
/**
|
|
7055
|
+
* The parent to start this span under. May be an exported span slug string
|
|
7056
|
+
* (from `span.export()`) or an opaque W3C trace-context (from
|
|
7057
|
+
* {@link extractTraceContextFromHeaders}).
|
|
7058
|
+
*/
|
|
7059
|
+
parent?: string | PropagationContext;
|
|
7015
7060
|
event?: StartSpanEventArgs;
|
|
7016
7061
|
propagatedEvent?: StartSpanEventArgs;
|
|
7017
7062
|
spanId?: string;
|
|
@@ -7113,6 +7158,24 @@ interface Span extends Exportable {
|
|
|
7113
7158
|
* @returns Serialized representation of this span's identifiers.
|
|
7114
7159
|
*/
|
|
7115
7160
|
export(): Promise<string>;
|
|
7161
|
+
/**
|
|
7162
|
+
* Inject W3C trace-context headers (`traceparent` and `baggage`) for this span
|
|
7163
|
+
* into a carrier, for distributed tracing across service boundaries.
|
|
7164
|
+
*
|
|
7165
|
+
* Adds `traceparent` (trace identity) and, when this span's Braintrust parent
|
|
7166
|
+
* is known, a `baggage` entry `braintrust.parent=<parent>` (merged with any
|
|
7167
|
+
* pre-existing baggage). Propagation is best-effort and never throws; if the
|
|
7168
|
+
* span's ids are not W3C-shaped hex (e.g. legacy UUID mode), `traceparent` is
|
|
7169
|
+
* omitted.
|
|
7170
|
+
*
|
|
7171
|
+
* @param carrier Optional existing carrier (e.g. outbound HTTP headers) to
|
|
7172
|
+
* mutate and return. Supports plain objects, Web `Headers`, Node-style
|
|
7173
|
+
* `setHeader` carriers, framework `header` carriers, and mutable
|
|
7174
|
+
* `HeadersInit` tuple arrays. A new object is created if not provided.
|
|
7175
|
+
* @returns The carrier with propagation headers injected.
|
|
7176
|
+
*/
|
|
7177
|
+
inject(): Record<string, string>;
|
|
7178
|
+
inject<T extends TraceContextCarrier>(carrier: T): T;
|
|
7116
7179
|
/**
|
|
7117
7180
|
* Format a permalink to the Braintrust application for viewing this span.
|
|
7118
7181
|
*
|
|
@@ -7234,7 +7297,7 @@ declare class BraintrustState {
|
|
|
7234
7297
|
id: string;
|
|
7235
7298
|
currentExperiment: Experiment | undefined;
|
|
7236
7299
|
currentLogger: Logger<false> | undefined;
|
|
7237
|
-
currentParent: IsoAsyncLocalStorage<string>;
|
|
7300
|
+
currentParent: IsoAsyncLocalStorage<string | PropagationContext>;
|
|
7238
7301
|
currentSpan: IsoAsyncLocalStorage<Span>;
|
|
7239
7302
|
private _bgLogger;
|
|
7240
7303
|
private _overrideBgLogger;
|
|
@@ -7352,6 +7415,15 @@ type DatasetPipelineDeferredJSONAttachmentHook = (data: unknown, options?: {
|
|
|
7352
7415
|
declare global {
|
|
7353
7416
|
var __BT_DATASET_PIPELINE_DEFER_JSON_ATTACHMENT__: DatasetPipelineDeferredJSONAttachmentHook | undefined;
|
|
7354
7417
|
}
|
|
7418
|
+
/**
|
|
7419
|
+
* An opaque W3C trace-context, as returned by
|
|
7420
|
+
* {@link extractTraceContextFromHeaders}.
|
|
7421
|
+
*
|
|
7422
|
+
* Carries the relevant W3C headers (`traceparent`, `baggage`, `tracestate`).
|
|
7423
|
+
* Callers MUST treat it as opaque and pass it straight to
|
|
7424
|
+
* `startSpan({ parent })`.
|
|
7425
|
+
*/
|
|
7426
|
+
type PropagationContext = Record<string, string>;
|
|
7355
7427
|
interface ParentSpanIds {
|
|
7356
7428
|
spanId: string;
|
|
7357
7429
|
rootSpanId: string;
|
|
@@ -7443,6 +7515,12 @@ declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
|
|
|
7443
7515
|
* Resolution order: state -> linkArgs -> env var
|
|
7444
7516
|
*/
|
|
7445
7517
|
_getLinkBaseUrl(): string | null;
|
|
7518
|
+
/**
|
|
7519
|
+
* Return this logger's Braintrust parent string (`project_id:<id>` or
|
|
7520
|
+
* `project_name:<name>`) for the `braintrust.parent` baggage entry, or
|
|
7521
|
+
* undefined when it cannot be determined synchronously.
|
|
7522
|
+
*/
|
|
7523
|
+
_getOtelParent(): string | undefined;
|
|
7446
7524
|
}
|
|
7447
7525
|
interface BackgroundLoggerOpts {
|
|
7448
7526
|
noExitFlush?: boolean;
|
|
@@ -7512,6 +7590,9 @@ type DatasetPinState = {
|
|
|
7512
7590
|
pinnedEnvironment?: string;
|
|
7513
7591
|
pinnedSnapshotName?: string;
|
|
7514
7592
|
};
|
|
7593
|
+
declare global {
|
|
7594
|
+
var __bt_eval_internal_btql: Record<string, unknown> | undefined;
|
|
7595
|
+
}
|
|
7515
7596
|
/**
|
|
7516
7597
|
* Options for logging in to Braintrust.
|
|
7517
7598
|
*/
|
|
@@ -7571,8 +7652,9 @@ declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransaction
|
|
|
7571
7652
|
private pinnedVersion;
|
|
7572
7653
|
private mutateRecord?;
|
|
7573
7654
|
private _internal_btql?;
|
|
7655
|
+
private _internalBrainstoreRealtime;
|
|
7574
7656
|
private _fetchedData;
|
|
7575
|
-
constructor(objectType: "dataset" | "experiment" | "project_logs" | "playground_logs", pinnedVersion: string | undefined, mutateRecord?: ((r: any) => WithTransactionId<RecordType>) | undefined, _internal_btql?: Record<string, unknown> | undefined);
|
|
7657
|
+
constructor(objectType: "dataset" | "experiment" | "project_logs" | "playground_logs", pinnedVersion: string | undefined, mutateRecord?: ((r: any) => WithTransactionId<RecordType>) | undefined, _internal_btql?: Record<string, unknown> | undefined, _internalBrainstoreRealtime?: boolean);
|
|
7576
7658
|
get id(): Promise<string>;
|
|
7577
7659
|
protected getState(): Promise<BraintrustState>;
|
|
7578
7660
|
protected getPinnedVersion(): string | undefined;
|
|
@@ -7708,6 +7790,12 @@ declare class Experiment extends ObjectFetcher<ExperimentEvent> implements Expor
|
|
|
7708
7790
|
* See {@link Span.startSpan} for more details.
|
|
7709
7791
|
*/
|
|
7710
7792
|
export(): Promise<string>;
|
|
7793
|
+
/**
|
|
7794
|
+
* Return this experiment's Braintrust parent string (`experiment_id:<id>`) for
|
|
7795
|
+
* the `braintrust.parent` baggage entry, or undefined when it cannot be
|
|
7796
|
+
* determined synchronously.
|
|
7797
|
+
*/
|
|
7798
|
+
_getOtelParent(): string | undefined;
|
|
7711
7799
|
/**
|
|
7712
7800
|
* Flush any pending rows to the server.
|
|
7713
7801
|
*/
|
|
@@ -2891,18 +2891,21 @@ declare const PromptData: z.ZodObject<{
|
|
|
2891
2891
|
choice_scores: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
2892
2892
|
choice: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2893
2893
|
allow_no_match: z.ZodOptional<z.ZodBoolean>;
|
|
2894
|
+
allow_skip: z.ZodOptional<z.ZodBoolean>;
|
|
2894
2895
|
}, "strip", z.ZodTypeAny, {
|
|
2895
2896
|
type: "llm_classifier";
|
|
2896
2897
|
use_cot: boolean;
|
|
2897
2898
|
choice_scores?: Record<string, number> | undefined;
|
|
2898
2899
|
choice?: string[] | undefined;
|
|
2899
2900
|
allow_no_match?: boolean | undefined;
|
|
2901
|
+
allow_skip?: boolean | undefined;
|
|
2900
2902
|
}, {
|
|
2901
2903
|
type: "llm_classifier";
|
|
2902
2904
|
use_cot: boolean;
|
|
2903
2905
|
choice_scores?: Record<string, number> | undefined;
|
|
2904
2906
|
choice?: string[] | undefined;
|
|
2905
2907
|
allow_no_match?: boolean | undefined;
|
|
2908
|
+
allow_skip?: boolean | undefined;
|
|
2906
2909
|
}>, z.ZodNull]>>;
|
|
2907
2910
|
tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
2908
2911
|
type: z.ZodLiteral<"function">;
|
|
@@ -3202,6 +3205,7 @@ declare const PromptData: z.ZodObject<{
|
|
|
3202
3205
|
choice_scores?: Record<string, number> | undefined;
|
|
3203
3206
|
choice?: string[] | undefined;
|
|
3204
3207
|
allow_no_match?: boolean | undefined;
|
|
3208
|
+
allow_skip?: boolean | undefined;
|
|
3205
3209
|
} | null | undefined;
|
|
3206
3210
|
tool_functions?: ({
|
|
3207
3211
|
type: "function";
|
|
@@ -3452,6 +3456,7 @@ declare const PromptData: z.ZodObject<{
|
|
|
3452
3456
|
choice_scores?: Record<string, number> | undefined;
|
|
3453
3457
|
choice?: string[] | undefined;
|
|
3454
3458
|
allow_no_match?: boolean | undefined;
|
|
3459
|
+
allow_skip?: boolean | undefined;
|
|
3455
3460
|
} | null | undefined;
|
|
3456
3461
|
tool_functions?: ({
|
|
3457
3462
|
type: "function";
|
|
@@ -4726,18 +4731,21 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
4726
4731
|
choice_scores: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
4727
4732
|
choice: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
4728
4733
|
allow_no_match: z.ZodOptional<z.ZodBoolean>;
|
|
4734
|
+
allow_skip: z.ZodOptional<z.ZodBoolean>;
|
|
4729
4735
|
}, "strip", z.ZodTypeAny, {
|
|
4730
4736
|
type: "llm_classifier";
|
|
4731
4737
|
use_cot: boolean;
|
|
4732
4738
|
choice_scores?: Record<string, number> | undefined;
|
|
4733
4739
|
choice?: string[] | undefined;
|
|
4734
4740
|
allow_no_match?: boolean | undefined;
|
|
4741
|
+
allow_skip?: boolean | undefined;
|
|
4735
4742
|
}, {
|
|
4736
4743
|
type: "llm_classifier";
|
|
4737
4744
|
use_cot: boolean;
|
|
4738
4745
|
choice_scores?: Record<string, number> | undefined;
|
|
4739
4746
|
choice?: string[] | undefined;
|
|
4740
4747
|
allow_no_match?: boolean | undefined;
|
|
4748
|
+
allow_skip?: boolean | undefined;
|
|
4741
4749
|
}>, z.ZodNull]>>;
|
|
4742
4750
|
tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
4743
4751
|
type: z.ZodLiteral<"function">;
|
|
@@ -5037,6 +5045,7 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5037
5045
|
choice_scores?: Record<string, number> | undefined;
|
|
5038
5046
|
choice?: string[] | undefined;
|
|
5039
5047
|
allow_no_match?: boolean | undefined;
|
|
5048
|
+
allow_skip?: boolean | undefined;
|
|
5040
5049
|
} | null | undefined;
|
|
5041
5050
|
tool_functions?: ({
|
|
5042
5051
|
type: "function";
|
|
@@ -5287,6 +5296,7 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5287
5296
|
choice_scores?: Record<string, number> | undefined;
|
|
5288
5297
|
choice?: string[] | undefined;
|
|
5289
5298
|
allow_no_match?: boolean | undefined;
|
|
5299
|
+
allow_skip?: boolean | undefined;
|
|
5290
5300
|
} | null | undefined;
|
|
5291
5301
|
tool_functions?: ({
|
|
5292
5302
|
type: "function";
|
|
@@ -5315,15 +5325,15 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5315
5325
|
function_type: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["llm", "scorer", "task", "tool", "custom_view", "preprocessor", "facet", "classifier", "tag", "parameters", "sandbox"]>, z.ZodNull]>>;
|
|
5316
5326
|
}, "strip", z.ZodTypeAny, {
|
|
5317
5327
|
id: string;
|
|
5318
|
-
org_id: string;
|
|
5319
|
-
name: string;
|
|
5320
5328
|
project_id: string;
|
|
5321
|
-
|
|
5329
|
+
name: string;
|
|
5322
5330
|
slug: string;
|
|
5331
|
+
org_id: string;
|
|
5332
|
+
_xact_id: string;
|
|
5323
5333
|
log_id: "p";
|
|
5324
5334
|
created?: string | null | undefined;
|
|
5325
|
-
metadata?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
5326
5335
|
description?: string | null | undefined;
|
|
5336
|
+
metadata?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
5327
5337
|
function_type?: "llm" | "scorer" | "task" | "tool" | "custom_view" | "preprocessor" | "facet" | "classifier" | "tag" | "parameters" | "sandbox" | null | undefined;
|
|
5328
5338
|
tags?: string[] | null | undefined;
|
|
5329
5339
|
prompt_data?: {
|
|
@@ -5554,6 +5564,7 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5554
5564
|
choice_scores?: Record<string, number> | undefined;
|
|
5555
5565
|
choice?: string[] | undefined;
|
|
5556
5566
|
allow_no_match?: boolean | undefined;
|
|
5567
|
+
allow_skip?: boolean | undefined;
|
|
5557
5568
|
} | null | undefined;
|
|
5558
5569
|
tool_functions?: ({
|
|
5559
5570
|
type: "function";
|
|
@@ -5579,15 +5590,15 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5579
5590
|
} | null | undefined;
|
|
5580
5591
|
}, {
|
|
5581
5592
|
id: string;
|
|
5582
|
-
org_id: string;
|
|
5583
|
-
name: string;
|
|
5584
5593
|
project_id: string;
|
|
5585
|
-
|
|
5594
|
+
name: string;
|
|
5586
5595
|
slug: string;
|
|
5596
|
+
org_id: string;
|
|
5597
|
+
_xact_id: string;
|
|
5587
5598
|
log_id: "p";
|
|
5588
5599
|
created?: string | null | undefined;
|
|
5589
|
-
metadata?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
5590
5600
|
description?: string | null | undefined;
|
|
5601
|
+
metadata?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
5591
5602
|
function_type?: "llm" | "scorer" | "task" | "tool" | "custom_view" | "preprocessor" | "facet" | "classifier" | "tag" | "parameters" | "sandbox" | null | undefined;
|
|
5592
5603
|
tags?: string[] | null | undefined;
|
|
5593
5604
|
prompt_data?: {
|
|
@@ -5818,6 +5829,7 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5818
5829
|
choice_scores?: Record<string, number> | undefined;
|
|
5819
5830
|
choice?: string[] | undefined;
|
|
5820
5831
|
allow_no_match?: boolean | undefined;
|
|
5832
|
+
allow_skip?: boolean | undefined;
|
|
5821
5833
|
} | null | undefined;
|
|
5822
5834
|
tool_functions?: ({
|
|
5823
5835
|
type: "function";
|
|
@@ -6233,6 +6245,31 @@ declare abstract class IDGenerator {
|
|
|
6233
6245
|
abstract shareRootSpanId(): boolean;
|
|
6234
6246
|
}
|
|
6235
6247
|
|
|
6248
|
+
type TraceContextHeaderValue = string | number | readonly string[] | null | undefined;
|
|
6249
|
+
/**
|
|
6250
|
+
* Minimal structural interface for outbound HTTP header carriers.
|
|
6251
|
+
*
|
|
6252
|
+
* Supports plain objects, Web/Fetch-compatible `Headers`, Node/Fastify-style
|
|
6253
|
+
* response carriers, and mutable `HeadersInit` tuple arrays.
|
|
6254
|
+
*/
|
|
6255
|
+
type TraceContextCarrier = {
|
|
6256
|
+
[name: string]: TraceContextHeaderValue;
|
|
6257
|
+
} | {
|
|
6258
|
+
get(name: string): TraceContextHeaderValue;
|
|
6259
|
+
set(name: string, value: string): void;
|
|
6260
|
+
delete?(name: string): void;
|
|
6261
|
+
} | {
|
|
6262
|
+
getHeader(name: string): TraceContextHeaderValue;
|
|
6263
|
+
setHeader(name: string, value: string): void;
|
|
6264
|
+
removeHeader?(name: string): void;
|
|
6265
|
+
} | {
|
|
6266
|
+
get?(name: string): TraceContextHeaderValue;
|
|
6267
|
+
getHeader?(name: string): TraceContextHeaderValue;
|
|
6268
|
+
header(name: string, value: string): void;
|
|
6269
|
+
delete?(name: string): void;
|
|
6270
|
+
removeHeader?(name: string): void;
|
|
6271
|
+
} | [string, string][];
|
|
6272
|
+
|
|
6236
6273
|
declare const TRANSACTION_ID_FIELD = "_xact_id";
|
|
6237
6274
|
declare const IS_MERGE_FIELD = "_is_merge";
|
|
6238
6275
|
declare const MERGE_PATHS_FIELD = "_merge_paths";
|
|
@@ -6323,13 +6360,13 @@ declare const AsyncScoringControl: z.ZodUnion<[z.ZodObject<{
|
|
|
6323
6360
|
function_ids: z.ZodArray<z.ZodUnknown, "many">;
|
|
6324
6361
|
triggered_xact_id: z.ZodString;
|
|
6325
6362
|
}, "strip", z.ZodTypeAny, {
|
|
6363
|
+
kind: "complete_triggered_functions";
|
|
6326
6364
|
triggered_xact_id: string;
|
|
6327
6365
|
function_ids: unknown[];
|
|
6328
|
-
kind: "complete_triggered_functions";
|
|
6329
6366
|
}, {
|
|
6367
|
+
kind: "complete_triggered_functions";
|
|
6330
6368
|
triggered_xact_id: string;
|
|
6331
6369
|
function_ids: unknown[];
|
|
6332
|
-
kind: "complete_triggered_functions";
|
|
6333
6370
|
}>]>;
|
|
6334
6371
|
type AsyncScoringControlType = z.infer<typeof AsyncScoringControl>;
|
|
6335
6372
|
declare const ObjectReference: z.ZodObject<{
|
|
@@ -6406,6 +6443,7 @@ type ExperimentEvent = Partial<InputField> & Partial<OtherExperimentLogFields> &
|
|
|
6406
6443
|
span_parents: string[];
|
|
6407
6444
|
span_attributes: Record<string, unknown>;
|
|
6408
6445
|
context: Record<string, unknown>;
|
|
6446
|
+
is_root: boolean | null;
|
|
6409
6447
|
[AUDIT_SOURCE_FIELD]: Source;
|
|
6410
6448
|
[AUDIT_METADATA_FIELD]?: Record<string, unknown>;
|
|
6411
6449
|
}>;
|
|
@@ -6919,6 +6957,8 @@ declare class SpanCache {
|
|
|
6919
6957
|
dispose(): void;
|
|
6920
6958
|
}
|
|
6921
6959
|
|
|
6960
|
+
/// <reference lib="dom" />
|
|
6961
|
+
|
|
6922
6962
|
declare const RESET_CONTEXT_MANAGER_STATE: unique symbol;
|
|
6923
6963
|
declare const datasetRestorePreviewResultSchema: z.ZodObject<{
|
|
6924
6964
|
rows_to_restore: z.ZodNumber;
|
|
@@ -6969,32 +7009,32 @@ declare const parametersRowSchema: z.ZodObject<{
|
|
|
6969
7009
|
metadata: z.ZodOptional<z.ZodUnion<[z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, z.ZodNull]>>;
|
|
6970
7010
|
}, "strip", z.ZodTypeAny, {
|
|
6971
7011
|
id: string;
|
|
7012
|
+
project_id: string;
|
|
6972
7013
|
name: string;
|
|
7014
|
+
slug: string;
|
|
6973
7015
|
function_type: "parameters";
|
|
6974
|
-
project_id: string;
|
|
6975
7016
|
_xact_id: string;
|
|
6976
|
-
slug: string;
|
|
6977
7017
|
function_data: {
|
|
6978
7018
|
type: "parameters";
|
|
6979
7019
|
__schema: Record<string, unknown>;
|
|
6980
7020
|
data?: Record<string, unknown> | undefined;
|
|
6981
7021
|
};
|
|
6982
|
-
metadata?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
6983
7022
|
description?: string | null | undefined;
|
|
7023
|
+
metadata?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
6984
7024
|
}, {
|
|
6985
7025
|
id: string;
|
|
7026
|
+
project_id: string;
|
|
6986
7027
|
name: string;
|
|
7028
|
+
slug: string;
|
|
6987
7029
|
function_type: "parameters";
|
|
6988
|
-
project_id: string;
|
|
6989
7030
|
_xact_id: string;
|
|
6990
|
-
slug: string;
|
|
6991
7031
|
function_data: {
|
|
6992
7032
|
type: "parameters";
|
|
6993
7033
|
__schema: Record<string, unknown>;
|
|
6994
7034
|
data?: Record<string, unknown> | undefined;
|
|
6995
7035
|
};
|
|
6996
|
-
metadata?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
6997
7036
|
description?: string | null | undefined;
|
|
7037
|
+
metadata?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
6998
7038
|
}>;
|
|
6999
7039
|
type ParametersRow = z.infer<typeof parametersRowSchema>;
|
|
7000
7040
|
|
|
@@ -7011,7 +7051,12 @@ type StartSpanArgs = {
|
|
|
7011
7051
|
type?: SpanType;
|
|
7012
7052
|
spanAttributes?: Record<any, any>;
|
|
7013
7053
|
startTime?: number;
|
|
7014
|
-
|
|
7054
|
+
/**
|
|
7055
|
+
* The parent to start this span under. May be an exported span slug string
|
|
7056
|
+
* (from `span.export()`) or an opaque W3C trace-context (from
|
|
7057
|
+
* {@link extractTraceContextFromHeaders}).
|
|
7058
|
+
*/
|
|
7059
|
+
parent?: string | PropagationContext;
|
|
7015
7060
|
event?: StartSpanEventArgs;
|
|
7016
7061
|
propagatedEvent?: StartSpanEventArgs;
|
|
7017
7062
|
spanId?: string;
|
|
@@ -7113,6 +7158,24 @@ interface Span extends Exportable {
|
|
|
7113
7158
|
* @returns Serialized representation of this span's identifiers.
|
|
7114
7159
|
*/
|
|
7115
7160
|
export(): Promise<string>;
|
|
7161
|
+
/**
|
|
7162
|
+
* Inject W3C trace-context headers (`traceparent` and `baggage`) for this span
|
|
7163
|
+
* into a carrier, for distributed tracing across service boundaries.
|
|
7164
|
+
*
|
|
7165
|
+
* Adds `traceparent` (trace identity) and, when this span's Braintrust parent
|
|
7166
|
+
* is known, a `baggage` entry `braintrust.parent=<parent>` (merged with any
|
|
7167
|
+
* pre-existing baggage). Propagation is best-effort and never throws; if the
|
|
7168
|
+
* span's ids are not W3C-shaped hex (e.g. legacy UUID mode), `traceparent` is
|
|
7169
|
+
* omitted.
|
|
7170
|
+
*
|
|
7171
|
+
* @param carrier Optional existing carrier (e.g. outbound HTTP headers) to
|
|
7172
|
+
* mutate and return. Supports plain objects, Web `Headers`, Node-style
|
|
7173
|
+
* `setHeader` carriers, framework `header` carriers, and mutable
|
|
7174
|
+
* `HeadersInit` tuple arrays. A new object is created if not provided.
|
|
7175
|
+
* @returns The carrier with propagation headers injected.
|
|
7176
|
+
*/
|
|
7177
|
+
inject(): Record<string, string>;
|
|
7178
|
+
inject<T extends TraceContextCarrier>(carrier: T): T;
|
|
7116
7179
|
/**
|
|
7117
7180
|
* Format a permalink to the Braintrust application for viewing this span.
|
|
7118
7181
|
*
|
|
@@ -7234,7 +7297,7 @@ declare class BraintrustState {
|
|
|
7234
7297
|
id: string;
|
|
7235
7298
|
currentExperiment: Experiment | undefined;
|
|
7236
7299
|
currentLogger: Logger<false> | undefined;
|
|
7237
|
-
currentParent: IsoAsyncLocalStorage<string>;
|
|
7300
|
+
currentParent: IsoAsyncLocalStorage<string | PropagationContext>;
|
|
7238
7301
|
currentSpan: IsoAsyncLocalStorage<Span>;
|
|
7239
7302
|
private _bgLogger;
|
|
7240
7303
|
private _overrideBgLogger;
|
|
@@ -7352,6 +7415,15 @@ type DatasetPipelineDeferredJSONAttachmentHook = (data: unknown, options?: {
|
|
|
7352
7415
|
declare global {
|
|
7353
7416
|
var __BT_DATASET_PIPELINE_DEFER_JSON_ATTACHMENT__: DatasetPipelineDeferredJSONAttachmentHook | undefined;
|
|
7354
7417
|
}
|
|
7418
|
+
/**
|
|
7419
|
+
* An opaque W3C trace-context, as returned by
|
|
7420
|
+
* {@link extractTraceContextFromHeaders}.
|
|
7421
|
+
*
|
|
7422
|
+
* Carries the relevant W3C headers (`traceparent`, `baggage`, `tracestate`).
|
|
7423
|
+
* Callers MUST treat it as opaque and pass it straight to
|
|
7424
|
+
* `startSpan({ parent })`.
|
|
7425
|
+
*/
|
|
7426
|
+
type PropagationContext = Record<string, string>;
|
|
7355
7427
|
interface ParentSpanIds {
|
|
7356
7428
|
spanId: string;
|
|
7357
7429
|
rootSpanId: string;
|
|
@@ -7443,6 +7515,12 @@ declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
|
|
|
7443
7515
|
* Resolution order: state -> linkArgs -> env var
|
|
7444
7516
|
*/
|
|
7445
7517
|
_getLinkBaseUrl(): string | null;
|
|
7518
|
+
/**
|
|
7519
|
+
* Return this logger's Braintrust parent string (`project_id:<id>` or
|
|
7520
|
+
* `project_name:<name>`) for the `braintrust.parent` baggage entry, or
|
|
7521
|
+
* undefined when it cannot be determined synchronously.
|
|
7522
|
+
*/
|
|
7523
|
+
_getOtelParent(): string | undefined;
|
|
7446
7524
|
}
|
|
7447
7525
|
interface BackgroundLoggerOpts {
|
|
7448
7526
|
noExitFlush?: boolean;
|
|
@@ -7512,6 +7590,9 @@ type DatasetPinState = {
|
|
|
7512
7590
|
pinnedEnvironment?: string;
|
|
7513
7591
|
pinnedSnapshotName?: string;
|
|
7514
7592
|
};
|
|
7593
|
+
declare global {
|
|
7594
|
+
var __bt_eval_internal_btql: Record<string, unknown> | undefined;
|
|
7595
|
+
}
|
|
7515
7596
|
/**
|
|
7516
7597
|
* Options for logging in to Braintrust.
|
|
7517
7598
|
*/
|
|
@@ -7571,8 +7652,9 @@ declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransaction
|
|
|
7571
7652
|
private pinnedVersion;
|
|
7572
7653
|
private mutateRecord?;
|
|
7573
7654
|
private _internal_btql?;
|
|
7655
|
+
private _internalBrainstoreRealtime;
|
|
7574
7656
|
private _fetchedData;
|
|
7575
|
-
constructor(objectType: "dataset" | "experiment" | "project_logs" | "playground_logs", pinnedVersion: string | undefined, mutateRecord?: ((r: any) => WithTransactionId<RecordType>) | undefined, _internal_btql?: Record<string, unknown> | undefined);
|
|
7657
|
+
constructor(objectType: "dataset" | "experiment" | "project_logs" | "playground_logs", pinnedVersion: string | undefined, mutateRecord?: ((r: any) => WithTransactionId<RecordType>) | undefined, _internal_btql?: Record<string, unknown> | undefined, _internalBrainstoreRealtime?: boolean);
|
|
7576
7658
|
get id(): Promise<string>;
|
|
7577
7659
|
protected getState(): Promise<BraintrustState>;
|
|
7578
7660
|
protected getPinnedVersion(): string | undefined;
|
|
@@ -7708,6 +7790,12 @@ declare class Experiment extends ObjectFetcher<ExperimentEvent> implements Expor
|
|
|
7708
7790
|
* See {@link Span.startSpan} for more details.
|
|
7709
7791
|
*/
|
|
7710
7792
|
export(): Promise<string>;
|
|
7793
|
+
/**
|
|
7794
|
+
* Return this experiment's Braintrust parent string (`experiment_id:<id>`) for
|
|
7795
|
+
* the `braintrust.parent` baggage entry, or undefined when it cannot be
|
|
7796
|
+
* determined synchronously.
|
|
7797
|
+
*/
|
|
7798
|
+
_getOtelParent(): string | undefined;
|
|
7711
7799
|
/**
|
|
7712
7800
|
* Flush any pending rows to the server.
|
|
7713
7801
|
*/
|