braintrust 3.17.0 → 3.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dev/dist/index.d.mts +13 -0
  2. package/dev/dist/index.d.ts +13 -0
  3. package/dev/dist/index.js +4300 -2199
  4. package/dev/dist/index.mjs +2211 -110
  5. package/dist/apply-auto-instrumentation.js +238 -186
  6. package/dist/apply-auto-instrumentation.mjs +68 -16
  7. package/dist/auto-instrumentations/bundler/esbuild.cjs +90 -15
  8. package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
  9. package/dist/auto-instrumentations/bundler/next.cjs +90 -15
  10. package/dist/auto-instrumentations/bundler/next.mjs +3 -3
  11. package/dist/auto-instrumentations/bundler/rollup.cjs +90 -15
  12. package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
  13. package/dist/auto-instrumentations/bundler/vite.cjs +90 -15
  14. package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
  15. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +89 -14
  16. package/dist/auto-instrumentations/bundler/webpack.cjs +90 -15
  17. package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
  18. package/dist/auto-instrumentations/{chunk-VXJONZVX.mjs → chunk-GNUEZ2PE.mjs} +13 -3
  19. package/dist/auto-instrumentations/{chunk-CNQ7BUKN.mjs → chunk-MYCHHXOE.mjs} +1 -1
  20. package/dist/auto-instrumentations/{chunk-E5DUYJWK.mjs → chunk-ZYKZEMRT.mjs} +82 -15
  21. package/dist/auto-instrumentations/hook.mjs +102 -15
  22. package/dist/auto-instrumentations/index.cjs +84 -16
  23. package/dist/auto-instrumentations/index.d.mts +3 -1
  24. package/dist/auto-instrumentations/index.d.ts +3 -1
  25. package/dist/auto-instrumentations/index.mjs +5 -3
  26. package/dist/auto-instrumentations/loader/cjs-patch.cjs +1 -1
  27. package/dist/auto-instrumentations/loader/cjs-patch.mjs +1 -1
  28. package/dist/auto-instrumentations/loader/esm-hook.mjs +1 -1
  29. package/dist/browser.d.mts +177 -11
  30. package/dist/browser.d.ts +177 -11
  31. package/dist/browser.js +2296 -104
  32. package/dist/browser.mjs +2455 -263
  33. package/dist/{chunk-VMBQETG3.js → chunk-73IYIIOL.js} +28 -2
  34. package/dist/{chunk-O4ZIWXO3.mjs → chunk-BYFADLEZ.mjs} +27 -1
  35. package/dist/cli.js +2219 -118
  36. package/dist/edge-light.d.mts +1 -1
  37. package/dist/edge-light.d.ts +1 -1
  38. package/dist/edge-light.js +2296 -104
  39. package/dist/edge-light.mjs +2455 -263
  40. package/dist/index.d.mts +177 -11
  41. package/dist/index.d.ts +177 -11
  42. package/dist/index.js +3296 -1128
  43. package/dist/index.mjs +2272 -104
  44. package/dist/instrumentation/index.d.mts +3 -0
  45. package/dist/instrumentation/index.d.ts +3 -0
  46. package/dist/instrumentation/index.js +2171 -105
  47. package/dist/instrumentation/index.mjs +2171 -105
  48. package/dist/workerd.d.mts +1 -1
  49. package/dist/workerd.d.ts +1 -1
  50. package/dist/workerd.js +2296 -104
  51. package/dist/workerd.mjs +2455 -263
  52. package/package.json +10 -10
@@ -11497,12 +11497,14 @@ declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransaction
11497
11497
  }
11498
11498
  type BaseMetadata = Record<string, unknown> | void;
11499
11499
  type DefaultMetadataType = void;
11500
+ type EvalCaseOrigin = ObjectReferenceType;
11500
11501
  type EvalCase<Input, Expected, Metadata> = {
11501
11502
  input: Input;
11502
11503
  tags?: string[];
11503
11504
  id?: string;
11504
11505
  _xact_id?: TransactionId;
11505
11506
  created?: string | null;
11507
+ origin?: EvalCaseOrigin;
11506
11508
  upsert_id?: string;
11507
11509
  trialCount?: number;
11508
11510
  } & (Expected extends void ? object : {
@@ -11541,6 +11543,7 @@ declare class Experiment extends ObjectFetcher<ExperimentEvent> implements Expor
11541
11543
  _waitForId(): Promise<void>;
11542
11544
  get name(): Promise<string>;
11543
11545
  get project(): Promise<ObjectMetadata>;
11546
+ _getBaseExperimentId(): Promise<string | undefined>;
11544
11547
  private parentObjectType;
11545
11548
  protected getState(): Promise<BraintrustState>;
11546
11549
  /**
@@ -13201,6 +13204,7 @@ declare class Project {
13201
13204
  prompts: PromptBuilder;
13202
13205
  parameters: ParametersBuilder;
13203
13206
  scorers: ScorerBuilder;
13207
+ classifiers: ClassifierBuilder;
13204
13208
  private _publishableCodeFunctions;
13205
13209
  private _publishablePrompts;
13206
13210
  private _publishableParameters;
@@ -13239,6 +13243,12 @@ declare class ScorerBuilder {
13239
13243
  constructor(project: Project);
13240
13244
  create<Output, Input, Params, Returns, Fn extends GenericFunction<Exact<Params, ScorerArgs<Output, Input>>, Returns>>(opts: ScorerOpts<Output, Input, Params, Returns, Fn>): void;
13241
13245
  }
13246
+ declare class ClassifierBuilder {
13247
+ private readonly project;
13248
+ private taskCounter;
13249
+ constructor(project: Project);
13250
+ create<Output, Input, Params, Returns, Fn extends GenericFunction<Exact<Params, ScorerArgs<Output, Input>>, Returns>>(opts: ClassifierOpts<Output, Input, Params, Returns, Fn>): CodeFunction<Exact<Params, ScorerArgs<Output, Input>>, Returns, Fn>;
13251
+ }
13242
13252
  type Schema<Input, Output> = Partial<{
13243
13253
  parameters: z.ZodSchema<Input>;
13244
13254
  returns: z.ZodSchema<Output>;
@@ -13264,6 +13274,9 @@ type ScorerOptsUnion<Output, Input, Params, Returns, Fn extends GenericFunction<
13264
13274
  type ScorerOpts<Output, Input, Params, Returns, Fn extends GenericFunction<Exact<Params, ScorerArgs<Output, Input>>, Returns>> = ScorerOptsUnion<Output, Input, Params, Returns, Fn> & {
13265
13275
  metadata?: Record<string, unknown>;
13266
13276
  };
13277
+ type ClassifierOpts<Output, Input, Params, Returns, Fn extends GenericFunction<Exact<Params, ScorerArgs<Output, Input>>, Returns>> = CodeOpts<Exact<Params, ScorerArgs<Output, Input>>, Returns, Fn> & {
13278
+ metadata?: Record<string, unknown>;
13279
+ };
13267
13280
  declare class CodeFunction<Input, Output, Fn extends GenericFunction<Input, Output>> {
13268
13281
  readonly project: Project;
13269
13282
  readonly handler: Fn;
@@ -11497,12 +11497,14 @@ declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransaction
11497
11497
  }
11498
11498
  type BaseMetadata = Record<string, unknown> | void;
11499
11499
  type DefaultMetadataType = void;
11500
+ type EvalCaseOrigin = ObjectReferenceType;
11500
11501
  type EvalCase<Input, Expected, Metadata> = {
11501
11502
  input: Input;
11502
11503
  tags?: string[];
11503
11504
  id?: string;
11504
11505
  _xact_id?: TransactionId;
11505
11506
  created?: string | null;
11507
+ origin?: EvalCaseOrigin;
11506
11508
  upsert_id?: string;
11507
11509
  trialCount?: number;
11508
11510
  } & (Expected extends void ? object : {
@@ -11541,6 +11543,7 @@ declare class Experiment extends ObjectFetcher<ExperimentEvent> implements Expor
11541
11543
  _waitForId(): Promise<void>;
11542
11544
  get name(): Promise<string>;
11543
11545
  get project(): Promise<ObjectMetadata>;
11546
+ _getBaseExperimentId(): Promise<string | undefined>;
11544
11547
  private parentObjectType;
11545
11548
  protected getState(): Promise<BraintrustState>;
11546
11549
  /**
@@ -13201,6 +13204,7 @@ declare class Project {
13201
13204
  prompts: PromptBuilder;
13202
13205
  parameters: ParametersBuilder;
13203
13206
  scorers: ScorerBuilder;
13207
+ classifiers: ClassifierBuilder;
13204
13208
  private _publishableCodeFunctions;
13205
13209
  private _publishablePrompts;
13206
13210
  private _publishableParameters;
@@ -13239,6 +13243,12 @@ declare class ScorerBuilder {
13239
13243
  constructor(project: Project);
13240
13244
  create<Output, Input, Params, Returns, Fn extends GenericFunction<Exact<Params, ScorerArgs<Output, Input>>, Returns>>(opts: ScorerOpts<Output, Input, Params, Returns, Fn>): void;
13241
13245
  }
13246
+ declare class ClassifierBuilder {
13247
+ private readonly project;
13248
+ private taskCounter;
13249
+ constructor(project: Project);
13250
+ create<Output, Input, Params, Returns, Fn extends GenericFunction<Exact<Params, ScorerArgs<Output, Input>>, Returns>>(opts: ClassifierOpts<Output, Input, Params, Returns, Fn>): CodeFunction<Exact<Params, ScorerArgs<Output, Input>>, Returns, Fn>;
13251
+ }
13242
13252
  type Schema<Input, Output> = Partial<{
13243
13253
  parameters: z.ZodSchema<Input>;
13244
13254
  returns: z.ZodSchema<Output>;
@@ -13264,6 +13274,9 @@ type ScorerOptsUnion<Output, Input, Params, Returns, Fn extends GenericFunction<
13264
13274
  type ScorerOpts<Output, Input, Params, Returns, Fn extends GenericFunction<Exact<Params, ScorerArgs<Output, Input>>, Returns>> = ScorerOptsUnion<Output, Input, Params, Returns, Fn> & {
13265
13275
  metadata?: Record<string, unknown>;
13266
13276
  };
13277
+ type ClassifierOpts<Output, Input, Params, Returns, Fn extends GenericFunction<Exact<Params, ScorerArgs<Output, Input>>, Returns>> = CodeOpts<Exact<Params, ScorerArgs<Output, Input>>, Returns, Fn> & {
13278
+ metadata?: Record<string, unknown>;
13279
+ };
13267
13280
  declare class CodeFunction<Input, Output, Fn extends GenericFunction<Input, Output>> {
13268
13281
  readonly project: Project;
13269
13282
  readonly handler: Fn;