braintrust 0.2.6 → 0.3.7

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/dist/index.d.ts CHANGED
@@ -1,6 +1,295 @@
1
- import { TRANSACTION_ID_FIELD, TransactionId, ExperimentEvent, DEFAULT_IS_LEGACY_DATASET, DatasetRecord, ExperimentLogFullArgs, ExperimentLogPartialArgs, LogFeedbackFullArgs, SpanType, IdField, BackgroundLogEvent, SpanComponentsV3, SpanObjectTypeV3, Score } from '@braintrust/core';
2
- export { CommentEvent, DatasetRecord, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, InputField, LogCommentFullArgs, LogFeedbackFullArgs, OtherExperimentLogFields, ParentExperimentIds, ParentProjectLogIds } from '@braintrust/core';
3
- import { z } from 'zod';
1
+ import { z } from 'zod/v3';
2
+ import { z as z$1 } from 'zod';
3
+
4
+ declare const TRANSACTION_ID_FIELD = "_xact_id";
5
+ declare const IS_MERGE_FIELD = "_is_merge";
6
+ declare const MERGE_PATHS_FIELD = "_merge_paths";
7
+ declare const AUDIT_SOURCE_FIELD = "_audit_source";
8
+ declare const AUDIT_METADATA_FIELD = "_audit_metadata";
9
+ declare const VALID_SOURCES: readonly ["app", "api", "external"];
10
+ type Source = (typeof VALID_SOURCES)[number];
11
+ declare const ASYNC_SCORING_CONTROL_FIELD = "_async_scoring_control";
12
+ declare const SKIP_ASYNC_SCORING_FIELD = "_skip_async_scoring";
13
+ type TransactionId = string;
14
+
15
+ declare const AsyncScoringControl: z.ZodUnion<[z.ZodObject<{
16
+ kind: z.ZodLiteral<"score_update">;
17
+ token: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ token: string;
20
+ kind: "score_update";
21
+ }, {
22
+ token: string;
23
+ kind: "score_update";
24
+ }>, z.ZodObject<{
25
+ kind: z.ZodLiteral<"state_override">;
26
+ state: z.ZodUnion<[z.ZodObject<{
27
+ status: z.ZodLiteral<"enabled">;
28
+ token: z.ZodString;
29
+ function_ids: z.ZodArray<z.ZodUnknown, "many">;
30
+ skip_logging: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ status: "enabled";
33
+ token: string;
34
+ function_ids: unknown[];
35
+ skip_logging?: boolean | null | undefined;
36
+ }, {
37
+ status: "enabled";
38
+ token: string;
39
+ function_ids: unknown[];
40
+ skip_logging?: boolean | null | undefined;
41
+ }>, z.ZodObject<{
42
+ status: z.ZodLiteral<"disabled">;
43
+ }, "strip", z.ZodTypeAny, {
44
+ status: "disabled";
45
+ }, {
46
+ status: "disabled";
47
+ }>, z.ZodNull, z.ZodNull]>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ kind: "state_override";
50
+ state: {
51
+ status: "enabled";
52
+ token: string;
53
+ function_ids: unknown[];
54
+ skip_logging?: boolean | null | undefined;
55
+ } | {
56
+ status: "disabled";
57
+ } | null;
58
+ }, {
59
+ kind: "state_override";
60
+ state: {
61
+ status: "enabled";
62
+ token: string;
63
+ function_ids: unknown[];
64
+ skip_logging?: boolean | null | undefined;
65
+ } | {
66
+ status: "disabled";
67
+ } | null;
68
+ }>, z.ZodObject<{
69
+ kind: z.ZodLiteral<"state_force_reselect">;
70
+ }, "strip", z.ZodTypeAny, {
71
+ kind: "state_force_reselect";
72
+ }, {
73
+ kind: "state_force_reselect";
74
+ }>, z.ZodObject<{
75
+ kind: z.ZodLiteral<"state_enabled_force_rescore">;
76
+ }, "strip", z.ZodTypeAny, {
77
+ kind: "state_enabled_force_rescore";
78
+ }, {
79
+ kind: "state_enabled_force_rescore";
80
+ }>]>;
81
+ type AsyncScoringControlType = z.infer<typeof AsyncScoringControl>;
82
+ declare const ObjectReference$1: z.ZodObject<{
83
+ object_type: z.ZodEnum<["project_logs", "experiment", "dataset", "prompt", "function", "prompt_session"]>;
84
+ object_id: z.ZodString;
85
+ id: z.ZodString;
86
+ _xact_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
87
+ created: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ id: string;
90
+ object_type: "function" | "experiment" | "dataset" | "prompt" | "prompt_session" | "project_logs";
91
+ object_id: string;
92
+ created?: string | null | undefined;
93
+ _xact_id?: string | null | undefined;
94
+ }, {
95
+ id: string;
96
+ object_type: "function" | "experiment" | "dataset" | "prompt" | "prompt_session" | "project_logs";
97
+ object_id: string;
98
+ created?: string | null | undefined;
99
+ _xact_id?: string | null | undefined;
100
+ }>;
101
+
102
+ type IdField = {
103
+ id: string;
104
+ };
105
+ type InputField = {
106
+ input: unknown;
107
+ };
108
+ type OtherExperimentLogFields = {
109
+ output: unknown;
110
+ expected: unknown;
111
+ error: unknown;
112
+ tags: string[];
113
+ scores: Record<string, number | null>;
114
+ metadata: Record<string, unknown>;
115
+ metrics: Record<string, unknown>;
116
+ datasetRecordId: string;
117
+ origin: z.infer<typeof ObjectReference$1>;
118
+ span_attributes: Record<string, unknown>;
119
+ [ASYNC_SCORING_CONTROL_FIELD]: AsyncScoringControlType;
120
+ [MERGE_PATHS_FIELD]: string[][];
121
+ [SKIP_ASYNC_SCORING_FIELD]: boolean;
122
+ };
123
+ type ExperimentLogPartialArgs = Partial<OtherExperimentLogFields> & Partial<InputField>;
124
+ type ExperimentLogFullArgs = Partial<Omit<OtherExperimentLogFields, "output" | "scores">> & Required<Pick<OtherExperimentLogFields, "output" | "scores">> & Partial<InputField> & Partial<IdField>;
125
+ type LogFeedbackFullArgs = IdField & Partial<Omit<OtherExperimentLogFields, "output" | "metrics" | "datasetRecordId"> & {
126
+ comment: string;
127
+ source: Source;
128
+ }>;
129
+ interface ParentExperimentIds {
130
+ experiment_id: string;
131
+ }
132
+ interface ParentProjectLogIds {
133
+ project_id: string;
134
+ log_id: "g";
135
+ }
136
+ interface ParentPlaygroundLogIds {
137
+ prompt_session_id: string;
138
+ log_id: "x";
139
+ }
140
+ type LogCommentFullArgs = IdField & {
141
+ created: string;
142
+ origin: {
143
+ id: string;
144
+ };
145
+ comment: {
146
+ text: string;
147
+ };
148
+ [AUDIT_SOURCE_FIELD]: Source;
149
+ [AUDIT_METADATA_FIELD]?: Record<string, unknown>;
150
+ } & (ParentExperimentIds | ParentProjectLogIds);
151
+ type ExperimentEvent = Partial<InputField> & Partial<OtherExperimentLogFields> & {
152
+ id: string;
153
+ span_id?: string;
154
+ root_span_id?: string;
155
+ experiment_id: string;
156
+ [IS_MERGE_FIELD]: boolean;
157
+ } & Partial<{
158
+ created: string;
159
+ span_parents: string[];
160
+ span_attributes: Record<string, unknown>;
161
+ context: Record<string, unknown>;
162
+ [AUDIT_SOURCE_FIELD]: Source;
163
+ [AUDIT_METADATA_FIELD]?: Record<string, unknown>;
164
+ }>;
165
+ type DatasetEvent = {
166
+ input?: unknown;
167
+ tags?: string[];
168
+ metadata?: unknown;
169
+ created?: string;
170
+ id: string;
171
+ dataset_id: string;
172
+ } & ({
173
+ expected?: unknown;
174
+ } | {
175
+ output?: unknown;
176
+ });
177
+ type LoggingEvent = Omit<ExperimentEvent, "experiment_id"> & {
178
+ project_id: string;
179
+ log_id: "g";
180
+ };
181
+ type PlaygroundLogEvent = Omit<ExperimentEvent, "experiment_id"> & {
182
+ prompt_session_id: string;
183
+ log_id: "x";
184
+ };
185
+ type CommentEvent = IdField & {
186
+ created: string;
187
+ origin: {
188
+ id: string;
189
+ };
190
+ comment: {
191
+ text: string;
192
+ };
193
+ [AUDIT_SOURCE_FIELD]: Source;
194
+ [AUDIT_METADATA_FIELD]?: Record<string, unknown>;
195
+ } & (ParentExperimentIds | ParentProjectLogIds | ParentPlaygroundLogIds);
196
+ type BackgroundLogEvent = ExperimentEvent | DatasetEvent | LoggingEvent | PlaygroundLogEvent | CommentEvent;
197
+ declare const DEFAULT_IS_LEGACY_DATASET = false;
198
+ interface LegacyDatasetRecord {
199
+ id: string;
200
+ input: any;
201
+ output: any;
202
+ metadata: any;
203
+ }
204
+ interface NewDatasetRecord {
205
+ id: string;
206
+ input: any;
207
+ expected: any;
208
+ tags: any;
209
+ metadata: any;
210
+ }
211
+ type DatasetRecord<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> = IsLegacyDataset extends true ? LegacyDatasetRecord : NewDatasetRecord;
212
+
213
+ declare enum SpanObjectTypeV3 {
214
+ EXPERIMENT = 1,
215
+ PROJECT_LOGS = 2,
216
+ PLAYGROUND_LOGS = 3
217
+ }
218
+ declare const spanComponentsV3Schema: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
219
+ object_type: z.ZodNativeEnum<typeof SpanObjectTypeV3>;
220
+ propagated_event: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
221
+ }, "strip", z.ZodTypeAny, {
222
+ object_type: SpanObjectTypeV3;
223
+ propagated_event?: Record<string, unknown> | null | undefined;
224
+ }, {
225
+ object_type: SpanObjectTypeV3;
226
+ propagated_event?: Record<string, unknown> | null | undefined;
227
+ }>, z.ZodUnion<[z.ZodObject<{
228
+ object_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
229
+ compute_object_metadata_args: z.ZodOptional<z.ZodNull>;
230
+ }, "strip", z.ZodTypeAny, {
231
+ object_id?: string | null | undefined;
232
+ compute_object_metadata_args?: null | undefined;
233
+ }, {
234
+ object_id?: string | null | undefined;
235
+ compute_object_metadata_args?: null | undefined;
236
+ }>, z.ZodObject<{
237
+ object_id: z.ZodOptional<z.ZodNull>;
238
+ compute_object_metadata_args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
239
+ }, "strip", z.ZodTypeAny, {
240
+ compute_object_metadata_args: Record<string, unknown>;
241
+ object_id?: null | undefined;
242
+ }, {
243
+ compute_object_metadata_args: Record<string, unknown>;
244
+ object_id?: null | undefined;
245
+ }>]>>, z.ZodUnion<[z.ZodObject<{
246
+ row_id: z.ZodString;
247
+ span_id: z.ZodString;
248
+ root_span_id: z.ZodString;
249
+ }, "strip", z.ZodTypeAny, {
250
+ span_id: string;
251
+ root_span_id: string;
252
+ row_id: string;
253
+ }, {
254
+ span_id: string;
255
+ root_span_id: string;
256
+ row_id: string;
257
+ }>, z.ZodObject<{
258
+ row_id: z.ZodOptional<z.ZodNull>;
259
+ span_id: z.ZodOptional<z.ZodNull>;
260
+ root_span_id: z.ZodOptional<z.ZodNull>;
261
+ }, "strip", z.ZodTypeAny, {
262
+ span_id?: null | undefined;
263
+ root_span_id?: null | undefined;
264
+ row_id?: null | undefined;
265
+ }, {
266
+ span_id?: null | undefined;
267
+ root_span_id?: null | undefined;
268
+ row_id?: null | undefined;
269
+ }>]>>;
270
+ type SpanComponentsV3Data = z.infer<typeof spanComponentsV3Schema>;
271
+ declare class SpanComponentsV3 {
272
+ data: SpanComponentsV3Data;
273
+ constructor(data: SpanComponentsV3Data);
274
+ toStr(): string;
275
+ static fromStr(s: string): SpanComponentsV3;
276
+ objectIdFields(): ParentExperimentIds | ParentProjectLogIds | ParentPlaygroundLogIds;
277
+ export(): Promise<string>;
278
+ private static fromJsonObj;
279
+ }
280
+
281
+ interface Score {
282
+ name: string;
283
+ score: number | null;
284
+ metadata?: Record<string, unknown>;
285
+ /**
286
+ * @deprecated
287
+ */
288
+ error?: unknown;
289
+ }
290
+
291
+ declare const spanTypeAttributeValues: readonly ["llm", "score", "function", "eval", "task", "tool"];
292
+ type SpanType = (typeof spanTypeAttributeValues)[number];
4
293
 
5
294
  declare const AnyModelParams: z.ZodObject<{
6
295
  temperature: z.ZodOptional<z.ZodNumber>;
@@ -14173,25 +14462,25 @@ declare const NOOP_SPAN_PERMALINK = "https://braintrust.dev/noop-span";
14173
14462
  declare global {
14174
14463
  var __inherited_braintrust_state: BraintrustState;
14175
14464
  }
14176
- declare const loginSchema: z.ZodObject<{
14177
- appUrl: z.ZodString;
14178
- appPublicUrl: z.ZodString;
14179
- orgName: z.ZodString;
14180
- apiUrl: z.ZodString;
14181
- proxyUrl: z.ZodString;
14182
- loginToken: z.ZodString;
14183
- orgId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14184
- gitMetadataSettings: z.ZodOptional<z.ZodNullable<z.ZodObject<{
14185
- collect: z.ZodEnum<["all", "none", "some"]>;
14186
- fields: z.ZodOptional<z.ZodArray<z.ZodEnum<["commit", "branch", "tag", "dirty", "author_name", "author_email", "commit_message", "commit_time", "git_diff"]>, "many">>;
14187
- }, "strip", z.ZodTypeAny, {
14465
+ declare const loginSchema: z$1.ZodObject<{
14466
+ appUrl: z$1.ZodString;
14467
+ appPublicUrl: z$1.ZodString;
14468
+ orgName: z$1.ZodString;
14469
+ apiUrl: z$1.ZodString;
14470
+ proxyUrl: z$1.ZodString;
14471
+ loginToken: z$1.ZodString;
14472
+ orgId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
14473
+ gitMetadataSettings: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
14474
+ collect: z$1.ZodEnum<["all", "none", "some"]>;
14475
+ fields: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<["commit", "branch", "tag", "dirty", "author_name", "author_email", "commit_message", "commit_time", "git_diff"]>, "many">>;
14476
+ }, "strip", z$1.ZodTypeAny, {
14188
14477
  collect: "some" | "none" | "all";
14189
14478
  fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
14190
14479
  }, {
14191
14480
  collect: "some" | "none" | "all";
14192
14481
  fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
14193
14482
  }>>>;
14194
- }, "strict", z.ZodTypeAny, {
14483
+ }, "strict", z$1.ZodTypeAny, {
14195
14484
  appUrl: string;
14196
14485
  appPublicUrl: string;
14197
14486
  orgName: string;
@@ -14216,7 +14505,7 @@ declare const loginSchema: z.ZodObject<{
14216
14505
  fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
14217
14506
  } | null | undefined;
14218
14507
  }>;
14219
- type SerializedBraintrustState = z.infer<typeof loginSchema>;
14508
+ type SerializedBraintrustState = z$1.infer<typeof loginSchema>;
14220
14509
  declare class BraintrustState {
14221
14510
  private loginParams;
14222
14511
  id: string;
@@ -14449,19 +14738,19 @@ declare class ExternalAttachment extends BaseAttachment {
14449
14738
  debugInfo(): Record<string, unknown>;
14450
14739
  private initData;
14451
14740
  }
14452
- declare const attachmentMetadataSchema: z.ZodObject<{
14453
- downloadUrl: z.ZodString;
14454
- status: z.ZodObject<{
14455
- upload_status: z.ZodEnum<["uploading", "done", "error"]>;
14456
- error_message: z.ZodOptional<z.ZodString>;
14457
- }, "strip", z.ZodTypeAny, {
14741
+ declare const attachmentMetadataSchema: z$1.ZodObject<{
14742
+ downloadUrl: z$1.ZodString;
14743
+ status: z$1.ZodObject<{
14744
+ upload_status: z$1.ZodEnum<["uploading", "done", "error"]>;
14745
+ error_message: z$1.ZodOptional<z$1.ZodString>;
14746
+ }, "strip", z$1.ZodTypeAny, {
14458
14747
  upload_status: "uploading" | "done" | "error";
14459
14748
  error_message?: string | undefined;
14460
14749
  }, {
14461
14750
  upload_status: "uploading" | "done" | "error";
14462
14751
  error_message?: string | undefined;
14463
14752
  }>;
14464
- }, "strip", z.ZodTypeAny, {
14753
+ }, "strip", z$1.ZodTypeAny, {
14465
14754
  status: {
14466
14755
  upload_status: "uploading" | "done" | "error";
14467
14756
  error_message?: string | undefined;
@@ -14474,7 +14763,7 @@ declare const attachmentMetadataSchema: z.ZodObject<{
14474
14763
  };
14475
14764
  downloadUrl: string;
14476
14765
  }>;
14477
- type AttachmentMetadata = z.infer<typeof attachmentMetadataSchema>;
14766
+ type AttachmentMetadata = z$1.infer<typeof attachmentMetadataSchema>;
14478
14767
  /**
14479
14768
  * A readonly alternative to `Attachment`, which can be used for fetching
14480
14769
  * already-uploaded Attachments.
@@ -14963,8 +15252,11 @@ declare function currentLogger<IsAsyncFlush extends boolean>(options?: AsyncFlus
14963
15252
  declare function currentSpan(options?: OptionalStateArg): Span$1;
14964
15253
  /**
14965
15254
  * Mainly for internal use. Return the parent object for starting a span in a global context.
15255
+ * Applies precedence: current span > propagated parent string > experiment > logger.
14966
15256
  */
14967
- declare function getSpanParentObject<IsAsyncFlush extends boolean>(options?: AsyncFlushArg<IsAsyncFlush> & OptionalStateArg): Span$1 | Experiment | Logger<IsAsyncFlush>;
15257
+ declare function getSpanParentObject<IsAsyncFlush extends boolean>(options?: AsyncFlushArg<IsAsyncFlush> & OptionalStateArg & {
15258
+ parent?: string;
15259
+ }): SpanComponentsV3 | Span$1 | Experiment | Logger<IsAsyncFlush>;
14968
15260
  declare function logError(span: Span$1, error: unknown): void;
14969
15261
  /**
14970
15262
  * Toplevel function for starting a span. It checks the following (in precedence order):
@@ -20909,6 +21201,41 @@ declare function BraintrustMiddleware(config?: MiddlewareConfig): LanguageModelV
20909
21201
  */
20910
21202
  declare function wrapAISDKModel<T extends object>(model: T): T;
20911
21203
 
21204
+ interface AISDKMethods {
21205
+ wrapLanguageModel: (options: any) => any;
21206
+ generateText: (params: any) => Promise<any>;
21207
+ streamText: (params: any) => any;
21208
+ generateObject: (params: any) => Promise<any>;
21209
+ streamObject: (params: any) => any;
21210
+ }
21211
+ /**
21212
+ * Wraps Vercel AI SDK methods with Braintrust tracing. Returns wrapped versions
21213
+ * of generateText, streamText, generateObject, and streamObject that automatically
21214
+ * create spans and log inputs, outputs, and metrics.
21215
+ *
21216
+ * @param ai - The AI SDK namespace (e.g., import * as ai from "ai")
21217
+ * @returns Object with AI SDK methods with Braintrust tracing
21218
+ *
21219
+ * @example
21220
+ * ```typescript
21221
+ * import { wrapAISDK } from "braintrust";
21222
+ * import * as ai from "ai";
21223
+ *
21224
+ * const { generateText, streamText, generateObject, streamObject } = wrapAISDK(ai);
21225
+ *
21226
+ * const result = await generateText({
21227
+ * model: openai("gpt-4"),
21228
+ * prompt: "Hello world"
21229
+ * });
21230
+ * ```
21231
+ */
21232
+ declare function wrapAISDK<T extends AISDKMethods>(ai: T): {
21233
+ generateText: T["generateText"];
21234
+ streamText: T["streamText"];
21235
+ generateObject: T["generateObject"];
21236
+ streamObject: T["streamObject"];
21237
+ };
21238
+
20912
21239
  /**
20913
21240
  * Wrap an `Anthropic` object (created with `new Anthropic(...)`) to add tracing. If Braintrust is
20914
21241
  * not configured, nothing will be traced. If this is not an `Anthropic` object, this function is
@@ -21316,13 +21643,14 @@ declare const braintrust_withDataset: typeof withDataset;
21316
21643
  declare const braintrust_withExperiment: typeof withExperiment;
21317
21644
  declare const braintrust_withLogger: typeof withLogger;
21318
21645
  declare const braintrust_withParent: typeof withParent;
21646
+ declare const braintrust_wrapAISDK: typeof wrapAISDK;
21319
21647
  declare const braintrust_wrapAISDKModel: typeof wrapAISDKModel;
21320
21648
  declare const braintrust_wrapAnthropic: typeof wrapAnthropic;
21321
21649
  declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
21322
21650
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
21323
21651
  declare const braintrust_wrapTraced: typeof wrapTraced;
21324
21652
  declare namespace braintrust {
21325
- export { braintrust_AISpanProcessor as AISpanProcessor, type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustExporter as BraintrustExporter, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustSpanProcessor as BraintrustSpanProcessor, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, type braintrust_CodeOpts as CodeOpts, braintrust_CodePrompt as CodePrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalHooks as EvalHooks, type braintrust_EvalResult as EvalResult, braintrust_EvalResultWithSummary as EvalResultWithSummary, type braintrust_EvalScorer as EvalScorer, type braintrust_EvalScorerArgs as EvalScorerArgs, type braintrust_EvalTask as EvalTask, type braintrust_Evaluator as Evaluator, type braintrust_EvaluatorDef as EvaluatorDef, type braintrust_EvaluatorFile as EvaluatorFile, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_FunctionEvent as FunctionEvent, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_Project as Project, braintrust_ProjectNameIdMap as ProjectNameIdMap, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptContents as PromptContents, type braintrust_PromptDefinition as PromptDefinition, type braintrust_PromptDefinitionWithTools as PromptDefinitionWithTools, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, braintrust_ScorerBuilder as ScorerBuilder, type braintrust_ScorerOpts as ScorerOpts, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type Span$1 as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_ToolBuilder as ToolBuilder, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_buildLocalSummary as buildLocalSummary, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_defaultErrorScoreHandler as defaultErrorScoreHandler, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_projects as projects, braintrust_promptContentsSchema as promptContentsSchema, braintrust_promptDefinitionSchema as promptDefinitionSchema, braintrust_promptDefinitionToPromptData as promptDefinitionToPromptData, braintrust_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_reportFailures as reportFailures, braintrust_runEvaluator as runEvaluator, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapAISDKModel as wrapAISDKModel, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
21653
+ export { braintrust_AISpanProcessor as AISpanProcessor, type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustExporter as BraintrustExporter, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustSpanProcessor as BraintrustSpanProcessor, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, type braintrust_CodeOpts as CodeOpts, braintrust_CodePrompt as CodePrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalHooks as EvalHooks, type braintrust_EvalResult as EvalResult, braintrust_EvalResultWithSummary as EvalResultWithSummary, type braintrust_EvalScorer as EvalScorer, type braintrust_EvalScorerArgs as EvalScorerArgs, type braintrust_EvalTask as EvalTask, type braintrust_Evaluator as Evaluator, type braintrust_EvaluatorDef as EvaluatorDef, type braintrust_EvaluatorFile as EvaluatorFile, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_FunctionEvent as FunctionEvent, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_Project as Project, braintrust_ProjectNameIdMap as ProjectNameIdMap, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptContents as PromptContents, type braintrust_PromptDefinition as PromptDefinition, type braintrust_PromptDefinitionWithTools as PromptDefinitionWithTools, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, braintrust_ScorerBuilder as ScorerBuilder, type braintrust_ScorerOpts as ScorerOpts, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type Span$1 as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_ToolBuilder as ToolBuilder, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_buildLocalSummary as buildLocalSummary, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_defaultErrorScoreHandler as defaultErrorScoreHandler, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_projects as projects, braintrust_promptContentsSchema as promptContentsSchema, braintrust_promptDefinitionSchema as promptDefinitionSchema, braintrust_promptDefinitionToPromptData as promptDefinitionToPromptData, braintrust_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_reportFailures as reportFailures, braintrust_runEvaluator as runEvaluator, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapAISDK as wrapAISDK, braintrust_wrapAISDKModel as wrapAISDKModel, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
21326
21654
  }
21327
21655
 
21328
21656
  type EvaluatorManifest = Record<string, EvaluatorDef<unknown, unknown, unknown, BaseMetadata>>;
@@ -28379,4 +28707,4 @@ type EvaluatorDefinitions = z.infer<typeof evaluatorDefinitionsSchema>;
28379
28707
  * @module braintrust
28380
28708
  */
28381
28709
 
28382
- export { AISpanProcessor, type AnyDataset, Attachment, type AttachmentParams, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustExporter, BraintrustMiddleware, BraintrustSpanProcessor, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type CreateProjectOpts, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type FunctionEvent, INTERNAL_BTQL_LIMIT, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span$1 as Span, type SpanContext, SpanImpl, type StartSpanArgs, TestBackgroundLogger, ToolBuilder, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDKModel, wrapAnthropic, wrapOpenAI, wrapOpenAIv4, wrapTraced };
28710
+ export { AISpanProcessor, type AnyDataset, Attachment, type AttachmentParams, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustExporter, BraintrustMiddleware, BraintrustSpanProcessor, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type CreateProjectOpts, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type FunctionEvent, INTERNAL_BTQL_LIMIT, type IdField, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span$1 as Span, type SpanContext, SpanImpl, type StartSpanArgs, TestBackgroundLogger, ToolBuilder, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAnthropic, wrapOpenAI, wrapOpenAIv4, wrapTraced };