braintrust 0.0.97 → 0.0.99

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,4 +1,4 @@
1
- import { GitMetadataSettings, RepoStatus } from "@braintrust/core";
1
+ import { GitMetadataSettings, RepoInfo } from "@braintrust/core";
2
2
  export interface CallerLocation {
3
3
  caller_functionname: string;
4
4
  caller_filename: string;
@@ -10,7 +10,7 @@ export interface IsoAsyncLocalStorage<T> {
10
10
  getStore(): T | undefined;
11
11
  }
12
12
  export interface Common {
13
- getRepoStatus: (settings?: GitMetadataSettings) => Promise<RepoStatus | undefined>;
13
+ getRepoInfo: (settings?: GitMetadataSettings) => Promise<RepoInfo | undefined>;
14
14
  getPastNAncestors: () => Promise<string[]>;
15
15
  getEnv: (name: string) => string | undefined;
16
16
  getCallerLocation: () => CallerLocation | undefined;
package/dist/logger.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  /// <reference lib="dom" />
2
- import { TRANSACTION_ID_FIELD, IS_MERGE_FIELD, PARENT_ID_FIELD, Source, AUDIT_SOURCE_FIELD, AUDIT_METADATA_FIELD, GitMetadataSettings, TransactionId } from "@braintrust/core";
2
+ import { TRANSACTION_ID_FIELD, GitMetadataSettings, RepoInfo, TransactionId, ParentExperimentIds, ParentProjectLogIds, IdField, ExperimentLogPartialArgs, ExperimentLogFullArgs, LogFeedbackFullArgs, ExperimentEvent, BackgroundLogEvent, DEFAULT_IS_LEGACY_DATASET, DatasetRecord } from "@braintrust/core";
3
3
  import { IsoAsyncLocalStorage } from "./isomorph";
4
4
  import { LazyValue } from "./util";
5
- export type Metadata = Record<string, unknown>;
6
5
  export type SetCurrentArg = {
7
6
  setCurrent?: boolean;
8
7
  };
@@ -100,7 +99,7 @@ export declare class NoopSpan implements Span {
100
99
  constructor();
101
100
  log(_: ExperimentLogPartialArgs): void;
102
101
  logFeedback(event: Omit<LogFeedbackFullArgs, "id">): void;
103
- traced<R>(callback: (span: Span) => R, _1: StartSpanArgs & SetCurrentArg): R;
102
+ traced<R>(callback: (span: Span) => R, _1?: StartSpanArgs & SetCurrentArg): R;
104
103
  startSpan(_1?: StartSpanArgs): this;
105
104
  end(args?: EndSpanArgs): number;
106
105
  close(args?: EndSpanArgs): number;
@@ -187,9 +186,13 @@ export declare class Logger<IsAsyncFlush extends boolean> {
187
186
  * @param event.metadata: (Optional) a dictionary with additional data about the test example, model outputs, or just about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys must be strings.
188
187
  * @param event.metrics: (Optional) a dictionary of metrics to log. The following keys are populated automatically: "start", "end".
189
188
  * @param event.id: (Optional) a unique identifier for the event. If you don't provide one, BrainTrust will generate one for you.
189
+ * @param options Additional logging options
190
+ * @param options.allowLogConcurrentWithActiveSpan in rare cases where you need to log at the top level separately from an active span on the logger, set this to true.
190
191
  * :returns: The `id` of the logged event.
191
192
  */
192
- log(event: Readonly<StartSpanEventArgs>): PromiseUnless<IsAsyncFlush, string>;
193
+ log(event: Readonly<StartSpanEventArgs>, options?: {
194
+ allowLogConcurrentWithActiveSpan?: boolean;
195
+ }): PromiseUnless<IsAsyncFlush, string>;
193
196
  /**
194
197
  * Create a new toplevel span underneath the logger. The name defaults to "root".
195
198
  *
@@ -220,87 +223,6 @@ export declare class Logger<IsAsyncFlush extends boolean> {
220
223
  flush(): Promise<void>;
221
224
  get asyncFlush(): IsAsyncFlush | undefined;
222
225
  }
223
- export type IdField = {
224
- id: string;
225
- };
226
- export type InputField = {
227
- input: unknown;
228
- };
229
- export type InputsField = {
230
- inputs: unknown;
231
- };
232
- export type OtherExperimentLogFields = {
233
- output: unknown;
234
- expected: unknown;
235
- scores: Record<string, number | null>;
236
- metadata: Record<string, unknown>;
237
- metrics: Record<string, unknown>;
238
- datasetRecordId: string;
239
- };
240
- export type ExperimentLogPartialArgs = Partial<OtherExperimentLogFields> & Partial<InputField | InputsField>;
241
- export type ExperimentLogFullArgs = Partial<Omit<OtherExperimentLogFields, "output" | "scores">> & Required<Pick<OtherExperimentLogFields, "output" | "scores">> & Partial<InputField | InputsField> & Partial<IdField>;
242
- export type LogFeedbackFullArgs = IdField & Partial<Omit<OtherExperimentLogFields, "output" | "metrics" | "datasetRecordId"> & {
243
- comment: string;
244
- source: Source;
245
- }>;
246
- export type LogCommentFullArgs = IdField & {
247
- created: string;
248
- origin: {
249
- id: string;
250
- };
251
- comment: {
252
- text: string;
253
- };
254
- [AUDIT_SOURCE_FIELD]: Source;
255
- [AUDIT_METADATA_FIELD]?: Record<string, unknown>;
256
- } & Omit<ParentExperimentIds | ParentProjectLogIds, "kind">;
257
- type ExperimentEvent = Partial<InputField> & Partial<OtherExperimentLogFields> & {
258
- id: string;
259
- span_id?: string;
260
- root_span_id?: string;
261
- project_id: string;
262
- experiment_id: string;
263
- [IS_MERGE_FIELD]: boolean;
264
- } & Partial<{
265
- created: string;
266
- span_parents: string[];
267
- span_attributes: Record<string, unknown>;
268
- context: Record<string, unknown>;
269
- [PARENT_ID_FIELD]: string;
270
- [AUDIT_SOURCE_FIELD]: Source;
271
- [AUDIT_METADATA_FIELD]?: Record<string, unknown>;
272
- }>;
273
- interface DatasetEvent {
274
- inputs?: unknown;
275
- output?: unknown;
276
- metadata?: unknown;
277
- id: string;
278
- project_id: string;
279
- dataset_id: string;
280
- created: string;
281
- }
282
- type LoggingEvent = Omit<ExperimentEvent, "experiment_id"> & {
283
- org_id: string;
284
- log_id: "g";
285
- };
286
- export type CommentEvent = IdField & {
287
- created: string;
288
- origin: {
289
- id: string;
290
- };
291
- comment: {
292
- text: string;
293
- };
294
- [AUDIT_SOURCE_FIELD]: Source;
295
- [AUDIT_METADATA_FIELD]?: Record<string, unknown>;
296
- } & Omit<ParentExperimentIds | ParentProjectLogIds, "kind">;
297
- type BackgroundLogEvent = ExperimentEvent | DatasetEvent | LoggingEvent | CommentEvent;
298
- export interface DatasetRecord {
299
- id: string;
300
- input: any;
301
- output: any;
302
- metadata: any;
303
- }
304
226
  declare class BackgroundLogger {
305
227
  private logConn;
306
228
  private items;
@@ -317,45 +239,61 @@ type InitOpenOption<IsOpen extends boolean> = {
317
239
  export type InitOptions<IsOpen extends boolean> = {
318
240
  experiment?: string;
319
241
  description?: string;
320
- dataset?: Dataset;
242
+ dataset?: AnyDataset;
321
243
  update?: boolean;
322
244
  baseExperiment?: string;
323
245
  isPublic?: boolean;
324
246
  appUrl?: string;
325
247
  apiKey?: string;
326
248
  orgName?: string;
327
- metadata?: Metadata;
249
+ metadata?: Record<string, unknown>;
328
250
  gitMetadataSettings?: GitMetadataSettings;
251
+ projectId?: string;
252
+ baseExperimentId?: string;
253
+ repoInfo?: RepoInfo;
329
254
  setCurrent?: boolean;
330
255
  } & InitOpenOption<IsOpen>;
256
+ export type FullInitOptions<IsOpen extends boolean> = {
257
+ project?: string;
258
+ } & InitOptions<IsOpen>;
331
259
  type InitializedExperiment<IsOpen extends boolean | undefined> = IsOpen extends true ? ReadonlyExperiment : Experiment;
332
260
  /**
333
261
  * Log in, and then initialize a new experiment in a specified project. If the project does not exist, it will be created.
334
262
  *
335
- * @param project The name of the project to create the experiment in.
336
- * @param options Additional options for configuring init().
263
+ * @param options Options for configuring init().
264
+ * @param options.project The name of the project to create the experiment in. Must specify at least one of `project` or `projectId`.
337
265
  * @param options.experiment The name of the experiment to create. If not specified, a name will be generated automatically.
338
266
  * @param options.description An optional description of the experiment.
339
- * @param options.dataset (Optional) A dataset to associate with the experiment. You can pass in the name of the dataset (in the same project) or a
340
- * dataset object (from any project).
267
+ * @param options.dataset (Optional) A dataset to associate with the experiment. You can pass in the name of the dataset (in the same project) or a dataset object (from any project).
341
268
  * @param options.update If the experiment already exists, continue logging to it.
342
- * @param options.baseExperiment An optional experiment name to use as a base. If specified, the new experiment will be summarized and compared to this
343
- * experiment. Otherwise, it will pick an experiment by finding the closest ancestor on the default (e.g. main) branch.
269
+ * @param options.baseExperiment An optional experiment name to use as a base. If specified, the new experiment will be summarized and compared to this experiment. Otherwise, it will pick an experiment by finding the closest ancestor on the default (e.g. main) branch.
344
270
  * @param options.isPublic An optional parameter to control whether the experiment is publicly visible to anybody with the link or privately visible to only members of the organization. Defaults to private.
345
271
  * @param options.appUrl The URL of the Braintrust App. Defaults to https://www.braintrustdata.com.
346
- * @param options.apiKey The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. If no API
347
- * key is specified, will prompt the user to login.
272
+ * @param options.apiKey The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. If no API key is specified, will prompt the user to login.
348
273
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
349
- * @param options.metadata (Optional) A dictionary with additional data about the test example, model outputs, or just
350
- * about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the
351
- * `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any
352
- * JSON-serializable type, but its keys must be strings.
274
+ * @param options.metadata (Optional) A dictionary with additional data about the test example, model outputs, or just about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys must be strings.
353
275
  * @param options.gitMetadataSettings (Optional) Settings for collecting git metadata. By default, will collect all git metadata fields allowed in org-level settings.
354
276
  * @param setCurrent If true (the default), set the global current-experiment to the newly-created one.
355
277
  * @param options.open If the experiment already exists, open it in read-only mode.
278
+ * @param options.projectId The id of the project to create the experiment in. This takes precedence over `project` if specified.
279
+ * @param options.baseExperimentId An optional experiment id to use as a base. If specified, the new experiment will be summarized and compared to this. This takes precedence over `baseExperiment` if specified.
280
+ * @param options.repoInfo (Optional) Explicitly specify the git metadata for this experiment. This takes precedence over `gitMetadataSettings` if specified.
356
281
  * @returns The newly created Experiment.
357
282
  */
283
+ export declare function init<IsOpen extends boolean = false>(options: Readonly<FullInitOptions<IsOpen>>): InitializedExperiment<IsOpen>;
284
+ /**
285
+ * Legacy form of `init` which accepts the project name as the first parameter,
286
+ * separately from the remaining options. See `init(options)` for full details.
287
+ */
358
288
  export declare function init<IsOpen extends boolean = false>(project: string, options?: Readonly<InitOptions<IsOpen>>): InitializedExperiment<IsOpen>;
289
+ /**
290
+ * Alias for init(options).
291
+ */
292
+ export declare function initExperiment<IsOpen extends boolean = false>(options: Readonly<InitOptions<IsOpen>>): InitializedExperiment<IsOpen>;
293
+ /**
294
+ * Alias for init(project, options).
295
+ */
296
+ export declare function initExperiment<IsOpen extends boolean = false>(project: string, options?: Readonly<InitOptions<IsOpen>>): InitializedExperiment<IsOpen>;
359
297
  /**
360
298
  * This function is deprecated. Use `init` instead.
361
299
  */
@@ -364,32 +302,46 @@ export declare function withExperiment<R>(project: string, callback: (experiment
364
302
  * This function is deprecated. Use `initLogger` instead.
365
303
  */
366
304
  export declare function withLogger<IsAsyncFlush extends boolean = false, R = void>(callback: (logger: Logger<IsAsyncFlush>) => R, options?: Readonly<InitLoggerOptions<IsAsyncFlush> & SetCurrentArg>): R;
367
- type InitDatasetOptions = {
305
+ type UseOutputOption<IsLegacyDataset extends boolean> = {
306
+ useOutput?: IsLegacyDataset;
307
+ };
308
+ type InitDatasetOptions<IsLegacyDataset extends boolean> = {
368
309
  dataset?: string;
369
310
  description?: string;
370
311
  version?: string;
371
312
  appUrl?: string;
372
313
  apiKey?: string;
373
314
  orgName?: string;
374
- };
315
+ projectId?: string;
316
+ } & UseOutputOption<IsLegacyDataset>;
317
+ type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
318
+ project?: string;
319
+ } & InitDatasetOptions<IsLegacyDataset>;
375
320
  /**
376
321
  * Create a new dataset in a specified project. If the project does not exist, it will be created.
377
322
  *
378
- * @param project The name of the project to create the dataset in.
379
- * @param options Additional options for configuring init().
323
+ * @param options Options for configuring initDataset().
324
+ * @param options.project The name of the project to create the dataset in. Must specify at least one of `project` or `projectId`.
380
325
  * @param options.dataset The name of the dataset to create. If not specified, a name will be generated automatically.
381
326
  * @param options.description An optional description of the dataset.
382
327
  * @param options.appUrl The URL of the Braintrust App. Defaults to https://www.braintrustdata.com.
383
- * @param options.apiKey The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. If no API
384
- * key is specified, will prompt the user to login.
328
+ * @param options.apiKey The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. If no API key is specified, will prompt the user to login.
385
329
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
330
+ * @param options.projectId The id of the project to create the dataset in. This takes precedence over `project` if specified.
331
+ * @param options.useOutput If true (the default), records will be fetched from this dataset in the legacy format, with the "expected" field renamed to "output". This will default to false in a future version of Braintrust.
386
332
  * @returns The newly created Dataset.
387
333
  */
388
- export declare function initDataset(project: string, options?: Readonly<InitDatasetOptions>): Dataset;
334
+ export declare function initDataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET>(options: Readonly<FullInitDatasetOptions<IsLegacyDataset>>): Dataset<IsLegacyDataset>;
335
+ /**
336
+ * Legacy form of `initDataset` which accepts the project name as the first
337
+ * parameter, separately from the remaining options. See
338
+ * `initDataset(options)` for full details.
339
+ */
340
+ export declare function initDataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET>(project: string, options?: Readonly<InitDatasetOptions<IsLegacyDataset>>): Dataset<IsLegacyDataset>;
389
341
  /**
390
342
  * This function is deprecated. Use `initDataset` instead.
391
343
  */
392
- export declare function withDataset<R>(project: string, callback: (dataset: Dataset) => R, options?: Readonly<InitDatasetOptions>): R;
344
+ export declare function withDataset<R, IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET>(project: string, callback: (dataset: Dataset<IsLegacyDataset>) => R, options?: Readonly<InitDatasetOptions<IsLegacyDataset>>): R;
393
345
  type AsyncFlushArg<IsAsyncFlush> = {
394
346
  asyncFlush?: IsAsyncFlush;
395
347
  };
@@ -494,11 +446,12 @@ export declare function startSpan<IsAsyncFlush extends boolean = false>(args?: S
494
446
  export type WithTransactionId<R> = R & {
495
447
  [TRANSACTION_ID_FIELD]: TransactionId;
496
448
  };
497
- declare class ObjectFetcher<RecordType> {
449
+ declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransactionId<RecordType>> {
498
450
  private objectType;
499
451
  private pinnedVersion;
452
+ private mutateRecord?;
500
453
  private _fetchedData;
501
- constructor(objectType: "dataset" | "experiment", pinnedVersion: string | undefined);
454
+ constructor(objectType: "dataset" | "experiment", pinnedVersion: string | undefined, mutateRecord?: ((r: any) => RecordType) | undefined);
502
455
  get id(): Promise<string>;
503
456
  protected getState(): Promise<BraintrustState>;
504
457
  fetch(): AsyncGenerator<WithTransactionId<RecordType>>;
@@ -507,11 +460,15 @@ declare class ObjectFetcher<RecordType> {
507
460
  clearCache(): void;
508
461
  version(): Promise<string | bigint | undefined>;
509
462
  }
510
- export interface EvalCase<Input, Expected> {
463
+ export type BaseMetadata = Record<string, unknown> | void;
464
+ export type DefaultMetadataType = void;
465
+ export type EvalCase<Input, Expected, Metadata> = {
511
466
  input: Input;
512
- expected?: Expected;
513
- metadata?: Metadata;
514
- }
467
+ } & (Expected extends void ? {} : {
468
+ expected: Expected;
469
+ }) & (Metadata extends void ? {} : {
470
+ metadata: Metadata;
471
+ });
515
472
  /**
516
473
  * An experiment is a collection of logged events, such as model inputs and outputs, which represent
517
474
  * a snapshot of your application at a particular point in time. An experiment is meant to capture more
@@ -526,11 +483,11 @@ export interface EvalCase<Input, Expected> {
526
483
  */
527
484
  export declare class Experiment extends ObjectFetcher<ExperimentEvent> {
528
485
  private readonly lazyMetadata;
529
- readonly dataset?: Dataset;
486
+ readonly dataset?: AnyDataset;
530
487
  private bgLogger;
531
488
  private lastStartTime;
532
489
  kind: "experiment";
533
- constructor(lazyMetadata: LazyValue<ProjectExperimentMetadata>, dataset?: Dataset);
490
+ constructor(lazyMetadata: LazyValue<ProjectExperimentMetadata>, dataset?: AnyDataset);
534
491
  get id(): Promise<string>;
535
492
  get name(): Promise<string>;
536
493
  get project(): Promise<ObjectMetadata>;
@@ -548,9 +505,13 @@ export declare class Experiment extends ObjectFetcher<ExperimentEvent> {
548
505
  * @param event.id: (Optional) a unique identifier for the event. If you don't provide one, BrainTrust will generate one for you.
549
506
  * @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.
550
507
  * @param event.inputs: (Deprecated) the same as `input` (will be removed in a future version).
508
+ * @param options Additional logging options
509
+ * @param options.allowLogConcurrentWithActiveSpan in rare cases where you need to log at the top level separately from an active span on the experiment, set this to true.
551
510
  * :returns: The `id` of the logged event.
552
511
  */
553
- log(event: Readonly<ExperimentLogFullArgs>): string;
512
+ log(event: Readonly<ExperimentLogFullArgs>, options?: {
513
+ allowLogConcurrentWithActiveSpan?: boolean;
514
+ }): string;
554
515
  /**
555
516
  * Create a new toplevel span underneath the experiment. The name defaults to "root".
556
517
  *
@@ -612,18 +573,7 @@ export declare class ReadonlyExperiment extends ObjectFetcher<ExperimentEvent> {
612
573
  get id(): Promise<string>;
613
574
  get name(): Promise<string>;
614
575
  protected getState(): Promise<BraintrustState>;
615
- asDataset<Input = unknown, Expected = unknown>(): AsyncGenerator<EvalCase<Input, Expected>>;
616
- }
617
- interface ParentExperimentIds {
618
- kind: "experiment";
619
- project_id: string;
620
- experiment_id: string;
621
- }
622
- interface ParentProjectLogIds {
623
- kind: "project_log";
624
- org_id: string;
625
- project_id: string;
626
- log_id: "g";
576
+ asDataset<Input, Expected>(): AsyncGenerator<EvalCase<Input, Expected, void>>;
627
577
  }
628
578
  /**
629
579
  * Primary implementation of the `Span` interface. See the `Span` interface for full details on each method.
@@ -635,10 +585,12 @@ export declare class SpanImpl implements Span {
635
585
  private internalData;
636
586
  private isMerge;
637
587
  private loggedEndTime;
588
+ parentObject: Experiment | Logger<any>;
638
589
  private parentIds;
639
590
  private readonly rowIds;
640
591
  kind: "span";
641
592
  constructor(args: {
593
+ parentObject: Experiment | Logger<any>;
642
594
  parentIds: LazyValue<ParentExperimentIds | ParentProjectLogIds>;
643
595
  bgLogger: BackgroundLogger;
644
596
  } & Omit<StartSpanArgs, "parentId"> & ({
@@ -660,16 +612,16 @@ export declare class SpanImpl implements Span {
660
612
  close(args?: EndSpanArgs): number;
661
613
  }
662
614
  /**
663
- * A dataset is a collection of records, such as model inputs and outputs, which represent
615
+ * A dataset is a collection of records, such as model inputs and expected outputs, which represent
664
616
  * data you can use to evaluate and fine-tune models. You can log production data to datasets,
665
617
  * curate them with interesting examples, edit/delete records, and run evaluations against them.
666
618
  *
667
619
  * You should not create `Dataset` objects directly. Instead, use the `braintrust.initDataset()` method.
668
620
  */
669
- export declare class Dataset extends ObjectFetcher<DatasetRecord> {
621
+ declare class Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> extends ObjectFetcher<DatasetRecord<IsLegacyDataset>> {
670
622
  private readonly lazyMetadata;
671
623
  private bgLogger;
672
- constructor(lazyMetadata: LazyValue<ProjectDatasetMetadata>, pinnedVersion?: string);
624
+ constructor(lazyMetadata: LazyValue<ProjectDatasetMetadata>, pinnedVersion?: string, legacy?: IsLegacyDataset);
673
625
  get id(): Promise<string>;
674
626
  get name(): Promise<string>;
675
627
  get project(): Promise<ObjectMetadata>;
@@ -680,19 +632,21 @@ export declare class Dataset extends ObjectFetcher<DatasetRecord> {
680
632
  *
681
633
  * @param event The event to log.
682
634
  * @param event.input The argument that uniquely define an input case (an arbitrary, JSON serializable object).
683
- * @param event.output The output of your application, including post-processing (an arbitrary, JSON serializable object).
635
+ * @param event.expected The output of your application, including post-processing (an arbitrary, JSON serializable object).
684
636
  * @param event.metadata (Optional) a dictionary with additional data about the test example, model outputs, or just
685
637
  * about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the
686
638
  * `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any
687
639
  * JSON-serializable type, but its keys must be strings.
688
640
  * @param event.id (Optional) a unique identifier for the event. If you don't provide one, Braintrust will generate one for you.
641
+ * @param event.output: (Deprecated) The output of your application. Use `expected` instead.
689
642
  * @returns The `id` of the logged record.
690
643
  */
691
- insert({ input, output, metadata, id, }: {
644
+ insert({ input, expected, metadata, id, output, }: {
692
645
  readonly input?: unknown;
693
- readonly output: unknown;
646
+ readonly expected?: unknown;
694
647
  readonly metadata?: Record<string, unknown>;
695
648
  readonly id?: string;
649
+ readonly output?: unknown;
696
650
  }): string;
697
651
  delete(id: string): string;
698
652
  /**
@@ -713,6 +667,7 @@ export declare class Dataset extends ObjectFetcher<DatasetRecord> {
713
667
  */
714
668
  close(): Promise<string>;
715
669
  }
670
+ export type AnyDataset = Dataset<boolean>;
716
671
  /**
717
672
  * Summary of a score's performance.
718
673
  * @property name Name of the score.