braintrust 0.0.166 → 0.0.167

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.
@@ -1,5 +1,5 @@
1
1
  import { LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, SpanType, SpanComponentsV3, DEFAULT_IS_LEGACY_DATASET, TRANSACTION_ID_FIELD, TransactionId, SpanObjectTypeV3, DatasetRecord } from '@braintrust/core';
2
- import { GitMetadataSettings, RepoInfo, PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode } from '@braintrust/core/typespecs';
2
+ import { GitMetadataSettings, AttachmentReference, RepoInfo, PromptData, OpenAIMessage, Tools, AnyModelParam, Message, Prompt as Prompt$1, PromptSessionEvent, StreamingMode } from '@braintrust/core/typespecs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  interface IsoAsyncLocalStorage<T> {
@@ -34,16 +34,14 @@ type EndSpanArgs = {
34
34
  };
35
35
  interface Exportable {
36
36
  /**
37
- * Return a serialized representation of the object that can be used to start subspans in other places. See `Span.traced` for more details.
37
+ * Return a serialized representation of the object that can be used to start subspans in other places. See {@link Span.traced} for more details.
38
38
  */
39
39
  export(): Promise<string>;
40
40
  }
41
41
  /**
42
42
  * A Span encapsulates logged data and metrics for a unit of work. This interface is shared by all span implementations.
43
43
  *
44
- * We suggest using one of the various `traced` methods, instead of creating Spans directly.
45
- *
46
- * See `Span.traced` for full details.
44
+ * We suggest using one of the various `traced` methods, instead of creating Spans directly. See {@link Span.traced} for full details.
47
45
  */
48
46
  interface Span extends Exportable {
49
47
  /**
@@ -53,13 +51,13 @@ interface Span extends Exportable {
53
51
  /**
54
52
  * Incrementally update the current span with new data. The event will be batched and uploaded behind the scenes.
55
53
  *
56
- * @param event: Data to be logged. See `Experiment.log` for full details.
54
+ * @param event: Data to be logged. See {@link Experiment.log} for full details.
57
55
  */
58
56
  log(event: ExperimentLogPartialArgs): void;
59
57
  /**
60
58
  * Add feedback to the current span. Unlike `Experiment.logFeedback` and `Logger.logFeedback`, this method does not accept an id parameter, because it logs feedback to the current span.
61
59
  *
62
- * @param event: Data to be logged. See `Experiment.logFeedback` for full details.
60
+ * @param event: Data to be logged. See {@link Experiment.logFeedback} for full details.
63
61
  */
64
62
  logFeedback(event: Omit<LogFeedbackFullArgs, "id">): void;
65
63
  /**
@@ -74,8 +72,8 @@ interface Span extends Exportable {
74
72
  * @param args.start_time Optional start time of the span, as a timestamp in seconds.
75
73
  * @param args.setCurrent If true (the default), the span will be marked as the currently-active span for the duration of the callback.
76
74
  * @param args.parent Optional parent info string for the span. The string can be generated from `[Span,Experiment,Logger].export`. If not provided, the current span will be used (depending on context). This is useful for adding spans to an existing trace.
77
- * @param args.event Data to be logged. See `Experiment.log` for full details.
78
- * @Returns The result of running `callback`.
75
+ * @param args.event Data to be logged. See {@link Experiment.log} for full details.
76
+ * @returns The result of running `callback`.
79
77
  */
80
78
  traced<R>(callback: (span: Span) => R, args?: StartSpanArgs & SetCurrentArg): R;
81
79
  /**
@@ -83,7 +81,7 @@ interface Span extends Exportable {
83
81
  * where you cannot use callbacks. However, spans started with `startSpan` will not be marked as the "current span",
84
82
  * so `currentSpan()` and `traced()` will be no-ops. If you want to mark a span as current, use `traced` instead.
85
83
  *
86
- * See `traced` for full details.
84
+ * See {@link Span.traced} for full details.
87
85
  *
88
86
  * @returns The newly-created `Span`
89
87
  */
@@ -211,7 +209,15 @@ declare class BraintrustState {
211
209
  bgLogger(): BackgroundLogger;
212
210
  loginReplaceApiConn(apiConn: HTTPConnection): void;
213
211
  }
212
+ /**
213
+ * This function should be invoked exactly once after configuring the `iso`
214
+ * object based on the platform. See js/src/node.ts for an example.
215
+ * @internal
216
+ */
214
217
  declare function _internalSetInitialState(): void;
218
+ /**
219
+ * @internal
220
+ */
215
221
  declare const _internalGetGlobalState: () => BraintrustState;
216
222
  declare class FailedHTTPResponse extends Error {
217
223
  status: number;
@@ -258,13 +264,72 @@ interface LogOptions<IsAsyncFlush> {
258
264
  computeMetadataArgs?: Record<string, any>;
259
265
  }
260
266
  type PromiseUnless<B, R> = B extends true ? R : Promise<Awaited<R>>;
267
+ interface AttachmentParams {
268
+ data: string | Blob | ArrayBuffer;
269
+ filename: string;
270
+ contentType: string;
271
+ state?: BraintrustState;
272
+ }
273
+ /**
274
+ * Represents an attachment to be uploaded and the associated metadata.
275
+ * `Attachment` objects can be inserted anywhere in an event, allowing you to
276
+ * log arbitrary file data. The SDK will asynchronously upload the file to
277
+ * object storage and replace the `Attachment` object with an
278
+ * `AttachmentReference`.
279
+ */
280
+ declare class Attachment {
281
+ /**
282
+ * The object that replaces this `Attachment` at upload time.
283
+ */
284
+ readonly reference: AttachmentReference;
285
+ private readonly uploader;
286
+ private readonly data;
287
+ private readonly state?;
288
+ private readonly dataDebugString;
289
+ /**
290
+ * Construct an attachment.
291
+ *
292
+ * @param data A string representing the path of the file on disk, or a
293
+ * `Blob`/`ArrayBuffer` with the file's contents. The caller is responsible
294
+ * for ensuring the file/blob/buffer is not modified until upload is complete.
295
+ *
296
+ * @param filename The desired name of the file in Braintrust after uploading.
297
+ * This parameter is for visualization purposes only and has no effect on
298
+ * attachment storage.
299
+ *
300
+ * @param contentType The MIME type of the file.
301
+ *
302
+ * @param state (Optional) For internal use.
303
+ */
304
+ constructor({ data, filename, contentType, state }: AttachmentParams);
305
+ /**
306
+ * On first access, (1) reads the attachment from disk if needed, (2)
307
+ * authenticates with the data plane to request a signed URL, (3) uploads to
308
+ * object store, and (4) updates the attachment.
309
+ *
310
+ * @returns The attachment status.
311
+ */
312
+ upload(): Promise<{
313
+ upload_status: "error" | "done" | "uploading";
314
+ error_message?: string | undefined;
315
+ }>;
316
+ /**
317
+ * A human-readable description for logging and debugging.
318
+ *
319
+ * @returns The debug object. The return type is not stable and may change in
320
+ * a future release.
321
+ */
322
+ debugInfo(): Record<string, unknown>;
323
+ private initUploader;
324
+ private initData;
325
+ }
261
326
  /**
262
327
  * Update a span using the output of `span.export()`. It is important that you only resume updating
263
328
  * to a span once the original span has been fully written and flushed, since otherwise updates to
264
329
  * the span may conflict with the original span.
265
330
  *
266
331
  * @param exported The output of `span.export()`.
267
- * @param event The event data to update the span with. See `Experiment.log` for a full list of valid fields.
332
+ * @param event The event data to update the span with. See {@link Experiment.log} for a full list of valid fields.
268
333
  * @param state (optional) Login state to use. If not provided, the global state will be used.
269
334
  */
270
335
  declare function updateSpan({ exported, state, ...event }: {
@@ -311,7 +376,7 @@ declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
311
376
  * @param event.id: (Optional) a unique identifier for the event. If you don't provide one, BrainTrust will generate one for you.
312
377
  * @param options Additional logging options
313
378
  * @param options.allowConcurrentWithSpans in rare cases where you need to log at the top level separately from spans on the logger elsewhere, set this to true.
314
- * :returns: The `id` of the logged event.
379
+ * @returns The `id` of the logged event.
315
380
  */
316
381
  log(event: Readonly<StartSpanEventArgs>, options?: {
317
382
  allowConcurrentWithSpans?: boolean;
@@ -319,7 +384,7 @@ declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
319
384
  /**
320
385
  * Create a new toplevel span underneath the logger. The name defaults to "root".
321
386
  *
322
- * See `Span.traced` for full details.
387
+ * See {@link Span.traced} for full details.
323
388
  */
324
389
  traced<R>(callback: (span: Span) => R, args?: StartSpanArgs & SetCurrentArg): PromiseUnless<IsAsyncFlush, R>;
325
390
  /**
@@ -327,7 +392,7 @@ declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
327
392
  * where you cannot use callbacks. However, spans started with `startSpan` will not be marked as the "current span",
328
393
  * so `currentSpan()` and `traced()` will be no-ops. If you want to mark a span as current, use `traced` instead.
329
394
  *
330
- * See `traced` for full details.
395
+ * See {@link traced} for full details.
331
396
  */
332
397
  startSpan(args?: StartSpanArgs): Span;
333
398
  private startSpanImpl;
@@ -347,11 +412,13 @@ declare class Logger<IsAsyncFlush extends boolean> implements Exportable {
347
412
  * Update a span in the experiment using its id. It is important that you only update a span once the original span has been fully written and flushed,
348
413
  * since otherwise updates to the span may conflict with the original span.
349
414
  *
350
- * @param event The event data to update the span with. Must include `id`. See `Experiment.log` for a full list of valid fields.
415
+ * @param event The event data to update the span with. Must include `id`. See {@link Experiment.log} for a full list of valid fields.
351
416
  */
352
417
  updateSpan(event: Omit<Partial<ExperimentEvent>, "id"> & Required<Pick<ExperimentEvent, "id">>): void;
353
418
  /**
354
- * Return a serialized representation of the logger that can be used to start subspans in other places. See `Span.start_span` for more details.
419
+ * Return a serialized representation of the logger that can be used to start subspans in other places.
420
+ *
421
+ * See {@link Span.startSpan} for more details.
355
422
  */
356
423
  export(): Promise<string>;
357
424
  flush(): Promise<void>;
@@ -448,11 +515,11 @@ declare function initExperiment<IsOpen extends boolean = false>(options: Readonl
448
515
  */
449
516
  declare function initExperiment<IsOpen extends boolean = false>(project: string, options?: Readonly<InitOptions<IsOpen>>): InitializedExperiment<IsOpen>;
450
517
  /**
451
- * This function is deprecated. Use `init` instead.
518
+ * @deprecated Use {@link init} instead.
452
519
  */
453
520
  declare function withExperiment<R>(project: string, callback: (experiment: Experiment) => R, options?: Readonly<InitOptions<false> & SetCurrentArg>): R;
454
521
  /**
455
- * This function is deprecated. Use `initLogger` instead.
522
+ * @deprecated Use {@link initLogger} instead.
456
523
  */
457
524
  declare function withLogger<IsAsyncFlush extends boolean = false, R = void>(callback: (logger: Logger<IsAsyncFlush>) => R, options?: Readonly<InitLoggerOptions<IsAsyncFlush> & SetCurrentArg>): R;
458
525
  type UseOutputOption<IsLegacyDataset extends boolean> = {
@@ -487,12 +554,13 @@ type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
487
554
  declare function initDataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET>(options: Readonly<FullInitDatasetOptions<IsLegacyDataset>>): Dataset<IsLegacyDataset>;
488
555
  /**
489
556
  * Legacy form of `initDataset` which accepts the project name as the first
490
- * parameter, separately from the remaining options. See
491
- * `initDataset(options)` for full details.
557
+ * parameter, separately from the remaining options.
558
+ *
559
+ * See `initDataset(options)` for full details.
492
560
  */
493
561
  declare function initDataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET>(project: string, options?: Readonly<InitDatasetOptions<IsLegacyDataset>>): Dataset<IsLegacyDataset>;
494
562
  /**
495
- * This function is deprecated. Use `initDataset` instead.
563
+ * @deprecated Use {@link initDataset} instead.
496
564
  */
497
565
  declare function withDataset<R, IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET>(project: string, callback: (dataset: Dataset<IsLegacyDataset>) => R, options?: Readonly<InitDatasetOptions<IsLegacyDataset>>): R;
498
566
  type AsyncFlushArg<IsAsyncFlush> = {
@@ -605,7 +673,7 @@ declare function loginToState(options?: LoginOptions): Promise<BraintrustState>;
605
673
  /**
606
674
  * Log a single event to the current experiment. The event will be batched and uploaded behind the scenes.
607
675
  *
608
- * @param event The event to log. See `Experiment.log` for full details.
676
+ * @param event The event to log. See {@link Experiment.log} for full details.
609
677
  * @returns The `id` of the logged event.
610
678
  */
611
679
  declare function log(event: ExperimentLogFullArgs): string;
@@ -625,17 +693,17 @@ type OptionalStateArg = {
625
693
  state?: BraintrustState;
626
694
  };
627
695
  /**
628
- * Returns the currently-active experiment (set by `braintrust.init`). Returns undefined if no current experiment has been set.
696
+ * Returns the currently-active experiment (set by {@link init}). Returns undefined if no current experiment has been set.
629
697
  */
630
698
  declare function currentExperiment(options?: OptionalStateArg): Experiment | undefined;
631
699
  /**
632
- * Returns the currently-active logger (set by `braintrust.initLogger`). Returns undefined if no current logger has been set.
700
+ * Returns the currently-active logger (set by {@link initLogger}). Returns undefined if no current logger has been set.
633
701
  */
634
702
  declare function currentLogger<IsAsyncFlush extends boolean>(options?: AsyncFlushArg<IsAsyncFlush> & OptionalStateArg): Logger<IsAsyncFlush> | undefined;
635
703
  /**
636
704
  * Return the currently-active span for logging (set by one of the `traced` methods). If there is no active span, returns a no-op span object, which supports the same interface as spans but does no logging.
637
705
  *
638
- * See `Span` for full details.
706
+ * See {@link Span} for full details.
639
707
  */
640
708
  declare function currentSpan(options?: OptionalStateArg): Span;
641
709
  /**
@@ -651,7 +719,7 @@ declare function logError(span: Span, error: unknown): void;
651
719
  *
652
720
  * and creates a span under the first one that is active. Alternatively, if `parent` is specified, it creates a span under the specified parent row. If none of these are active, it returns a no-op span object.
653
721
  *
654
- * See `Span.traced` for full details.
722
+ * See {@link Span.traced} for full details.
655
723
  */
656
724
  declare function traced<IsAsyncFlush extends boolean = false, R = void>(callback: (span: Span) => R, args?: StartSpanArgs & SetCurrentArg & AsyncFlushArg<IsAsyncFlush> & OptionalStateArg): PromiseUnless<IsAsyncFlush, R>;
657
725
  /**
@@ -687,7 +755,7 @@ declare const traceable: typeof wrapTraced;
687
755
  * where you cannot use callbacks. However, spans started with `startSpan` will not be marked as the "current span",
688
756
  * so `currentSpan()` and `traced()` will be no-ops. If you want to mark a span as current, use `traced` instead.
689
757
  *
690
- * See `traced` for full details.
758
+ * See {@link traced} for full details.
691
759
  */
692
760
  declare function startSpan<IsAsyncFlush extends boolean = false>(args?: StartSpanArgs & AsyncFlushArg<IsAsyncFlush> & OptionalStateArg): Span;
693
761
  /**
@@ -705,6 +773,20 @@ declare function setFetch(fetch: typeof globalThis.fetch): void;
705
773
  * Runs the provided callback with the span as the current span.
706
774
  */
707
775
  declare function withCurrent<R>(span: Span, callback: (span: Span) => R, state?: BraintrustState): R;
776
+ /**
777
+ * Creates a deep copy of the given event. Replaces references to user objects
778
+ * with placeholder strings to ensure serializability, except for
779
+ * {@link Attachment} objects, which are preserved and not deep-copied.
780
+ */
781
+ declare function deepCopyEvent<T extends Partial<BackgroundLogEvent>>(event: T): T;
782
+ /**
783
+ * Helper function for uploading attachments. Recursively extracts `Attachment`
784
+ * values and replaces them with their associated `AttachmentReference` objects.
785
+ *
786
+ * @param event The event to filter. Will be modified in-place.
787
+ * @param attachments Flat array of extracted attachments (output parameter).
788
+ */
789
+ declare function extractAttachments(event: Record<string, any>, attachments: Attachment[]): void;
708
790
  type WithTransactionId<R> = R & {
709
791
  [TRANSACTION_ID_FIELD]: TransactionId;
710
792
  };
@@ -771,10 +853,10 @@ declare class Experiment extends ObjectFetcher<ExperimentEvent> implements Expor
771
853
  * @param event.metrics: (Optional) a dictionary of metrics to log. The following keys are populated automatically: "start", "end".
772
854
  * @param event.id: (Optional) a unique identifier for the event. If you don't provide one, BrainTrust will generate one for you.
773
855
  * @param event.dataset_record_id: (Optional) the id of the dataset record that this event is associated with. This field is required if and only if the experiment is associated with a dataset.
774
- * @param event.inputs: (Deprecated) the same as `input` (will be removed in a future version).
856
+ * @deprecated @param event.inputs: (Deprecated) the same as `input` (will be removed in a future version).
775
857
  * @param options Additional logging options
776
858
  * @param options.allowConcurrentWithSpans in rare cases where you need to log at the top level separately from spans on the experiment elsewhere, set this to true.
777
- * :returns: The `id` of the logged event.
859
+ * @returns The `id` of the logged event.
778
860
  */
779
861
  log(event: Readonly<ExperimentLogFullArgs>, options?: {
780
862
  allowConcurrentWithSpans?: boolean;
@@ -782,7 +864,7 @@ declare class Experiment extends ObjectFetcher<ExperimentEvent> implements Expor
782
864
  /**
783
865
  * Create a new toplevel span underneath the experiment. The name defaults to "root".
784
866
  *
785
- * See `Span.traced` for full details.
867
+ * See {@link Span.traced} for full details.
786
868
  */
787
869
  traced<R>(callback: (span: Span) => R, args?: StartSpanArgs & SetCurrentArg): R;
788
870
  /**
@@ -790,7 +872,7 @@ declare class Experiment extends ObjectFetcher<ExperimentEvent> implements Expor
790
872
  * where you cannot use callbacks. However, spans started with `startSpan` will not be marked as the "current span",
791
873
  * so `currentSpan()` and `traced()` will be no-ops. If you want to mark a span as current, use `traced` instead.
792
874
  *
793
- * See `traced` for full details.
875
+ * See {@link traced} for full details.
794
876
  */
795
877
  startSpan(args?: StartSpanArgs): Span;
796
878
  private startSpanImpl;
@@ -826,11 +908,13 @@ declare class Experiment extends ObjectFetcher<ExperimentEvent> implements Expor
826
908
  * Update a span in the experiment using its id. It is important that you only update a span once the original span has been fully written and flushed,
827
909
  * since otherwise updates to the span may conflict with the original span.
828
910
  *
829
- * @param event The event data to update the span with. Must include `id`. See `Experiment.log` for a full list of valid fields.
911
+ * @param event The event data to update the span with. Must include `id`. See {@link Experiment.log} for a full list of valid fields.
830
912
  */
831
913
  updateSpan(event: Omit<Partial<ExperimentEvent>, "id"> & Required<Pick<ExperimentEvent, "id">>): void;
832
914
  /**
833
- * Return a serialized representation of the experiment that can be used to start subspans in other places. See `Span.start_span` for more details.
915
+ * Return a serialized representation of the experiment that can be used to start subspans in other places.
916
+ *
917
+ * See {@link Span.startSpan} for more details.
834
918
  */
835
919
  export(): Promise<string>;
836
920
  /**
@@ -838,7 +922,7 @@ declare class Experiment extends ObjectFetcher<ExperimentEvent> implements Expor
838
922
  */
839
923
  flush(): Promise<void>;
840
924
  /**
841
- * This function is deprecated. You can simply remove it from your code.
925
+ * @deprecated This function is deprecated. You can simply remove it from your code.
842
926
  */
843
927
  close(): Promise<string>;
844
928
  }
@@ -856,9 +940,9 @@ declare class ReadonlyExperiment extends ObjectFetcher<ExperimentEvent> {
856
940
  }
857
941
  declare function newId(): string;
858
942
  /**
859
- * Primary implementation of the `Span` interface. See the `Span` interface for full details on each method.
943
+ * Primary implementation of the `Span` interface. See {@link Span} for full details on each method.
860
944
  *
861
- * We suggest using one of the various `traced` methods, instead of creating Spans directly. See `Span.startSpan` for full details.
945
+ * We suggest using one of the various `traced` methods, instead of creating Spans directly. See {@link Span.startSpan} for full details.
862
946
  */
863
947
  declare class SpanImpl implements Span {
864
948
  private state;
@@ -969,7 +1053,7 @@ declare class Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY
969
1053
  */
970
1054
  flush(): Promise<void>;
971
1055
  /**
972
- * This function is deprecated. You can simply remove it from your code.
1056
+ * @deprecated This function is deprecated. You can simply remove it from your code.
973
1057
  */
974
1058
  close(): Promise<string>;
975
1059
  }
@@ -1108,6 +1192,14 @@ interface DatasetSummary {
1108
1192
  datasetUrl: string;
1109
1193
  dataSummary: DataSummary;
1110
1194
  }
1195
+ /**
1196
+ * Allows accessing helper functions for testing.
1197
+ * @internal
1198
+ */
1199
+ declare const _exportsForTestingOnly: {
1200
+ extractAttachments: typeof extractAttachments;
1201
+ deepCopyEvent: typeof deepCopyEvent;
1202
+ };
1111
1203
 
1112
1204
  declare const braintrustStreamChunkSchema: z.ZodUnion<[z.ZodObject<{
1113
1205
  type: z.ZodLiteral<"text_delta">;
@@ -1411,6 +1503,9 @@ declare const X_CACHED_HEADER = "x-bt-cached";
1411
1503
  declare function parseCachedHeader(value: string | null | undefined): number | undefined;
1412
1504
 
1413
1505
  type braintrust_AnyDataset = AnyDataset;
1506
+ type braintrust_Attachment = Attachment;
1507
+ declare const braintrust_Attachment: typeof Attachment;
1508
+ type braintrust_AttachmentParams = AttachmentParams;
1414
1509
  type braintrust_BackgroundLoggerOpts = BackgroundLoggerOpts;
1415
1510
  type braintrust_BaseMetadata = BaseMetadata;
1416
1511
  type braintrust_BraintrustState = BraintrustState;
@@ -1466,6 +1561,7 @@ declare const braintrust_SpanImpl: typeof SpanImpl;
1466
1561
  type braintrust_StartSpanArgs = StartSpanArgs;
1467
1562
  type braintrust_WithTransactionId<R> = WithTransactionId<R>;
1468
1563
  declare const braintrust_X_CACHED_HEADER: typeof X_CACHED_HEADER;
1564
+ declare const braintrust__exportsForTestingOnly: typeof _exportsForTestingOnly;
1469
1565
  declare const braintrust__internalGetGlobalState: typeof _internalGetGlobalState;
1470
1566
  declare const braintrust__internalSetInitialState: typeof _internalSetInitialState;
1471
1567
  declare const braintrust_braintrustStreamChunkSchema: typeof braintrustStreamChunkSchema;
@@ -1505,7 +1601,7 @@ declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
1505
1601
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
1506
1602
  declare const braintrust_wrapTraced: typeof wrapTraced;
1507
1603
  declare namespace braintrust {
1508
- export { type braintrust_AnyDataset as AnyDataset, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, 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_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_renderMessage as renderMessage, braintrust_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, 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_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
1604
+ export { type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, type braintrust_EndSpanArgs as EndSpanArgs, type braintrust_EvalCase as EvalCase, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, 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_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyExperiment as ReadonlyExperiment, type braintrust_ScoreSummary as ScoreSummary, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type braintrust_Span as Span, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, 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_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getSpanParentObject as getSpanParentObject, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, 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_renderMessage as renderMessage, braintrust_setFetch as setFetch, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, 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_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
1509
1605
  }
1510
1606
 
1511
- export { type AnyDataset, type BackgroundLoggerOpts, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, type EvalCase, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, type WithTransactionId, X_CACHED_HEADER, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, setFetch, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapOpenAI, wrapOpenAIv4, wrapTraced };
1607
+ export { type AnyDataset, Attachment, type AttachmentParams, type BackgroundLoggerOpts, type BaseMetadata, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type DataSummary, Dataset, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, type EndSpanArgs, type EvalCase, Experiment, type ExperimentSummary, type Exportable, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NoopSpan, type ObjectMetadata, type PromiseUnless, Prompt, type PromptRowWithId, ReadonlyExperiment, type ScoreSummary, type SerializedBraintrustState, type SetCurrentArg, type Span, SpanImpl, type StartSpanArgs, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, braintrust as default, devNullWritableStream, flush, getSpanParentObject, init, initDataset, initExperiment, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, renderMessage, setFetch, spanComponentsToObjectId, startSpan, summarize, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, wrapOpenAI, wrapOpenAIv4, wrapTraced };