braintrust 0.0.93 → 0.0.95

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,13 +1,26 @@
1
1
  import chalk from "chalk";
2
- import { Experiment, ExperimentSummary, Metadata, Span } from "./logger";
2
+ import { Experiment, ExperimentSummary, Metadata, Span, EvalCase } from "./logger";
3
3
  import { Score } from "@braintrust/core";
4
4
  import { ProgressReporter } from "./progress";
5
- export interface EvalCase<Input, Expected> {
6
- input: Input;
7
- expected?: Expected;
8
- metadata?: Metadata;
9
- }
10
- export type EvalData<Input, Expected> = (() => EvalCase<Input, Expected>[]) | (() => Promise<EvalCase<Input, Expected>[]>);
5
+ export type BaseExperiment<Input, Expected> = {
6
+ _type: "BaseExperiment";
7
+ _phantom?: [Input, Expected];
8
+ name?: string;
9
+ };
10
+ /**
11
+ * Use this to specify that the dataset should actually be the data from a previous (base) experiment.
12
+ * If you do not specify a name, Braintrust will automatically figure out the best base experiment to
13
+ * use based on your git history (or fall back to timestamps).
14
+ *
15
+ * @param options
16
+ * @param options.name The name of the base experiment to use. If unspecified, Braintrust will automatically figure out the best base
17
+ * using your git history (or fall back to timestamps).
18
+ * @returns
19
+ */
20
+ export declare function BaseExperiment<Input = unknown, Expected = unknown>(options?: {
21
+ name?: string;
22
+ }): BaseExperiment<Input, Expected>;
23
+ export type EvalData<Input, Expected> = EvalCase<Input, Expected>[] | (() => EvalCase<Input, Expected>[]) | (() => Promise<EvalCase<Input, Expected>[]>) | AsyncGenerator<EvalCase<Input, Expected>> | BaseExperiment<Input, Expected> | (() => BaseExperiment<Input, Expected>);
11
24
  export type EvalTask<Input, Output> = ((input: Input, hooks: EvalHooks) => Promise<Output>) | ((input: Input, hooks: EvalHooks) => Output);
12
25
  export interface EvalHooks {
13
26
  meta: (info: Record<string, unknown>) => void;
@@ -60,7 +73,7 @@ declare global {
60
73
  var _evals: EvaluatorFile;
61
74
  var _lazy_load: boolean;
62
75
  }
63
- export declare function Eval<Input, Output, Expected>(name: string, evaluator: Evaluator<Input, Output, Expected>): Promise<void | ExperimentSummary>;
76
+ export declare function Eval<Input, Output, Expected>(name: string, evaluator: Evaluator<Input, Output, Expected>): Promise<ExperimentSummary>;
64
77
  export declare function getLoadedEvals(): EvaluatorFile;
65
78
  export interface Filter {
66
79
  path: string[];
package/dist/index.d.ts CHANGED
@@ -43,5 +43,5 @@
43
43
  * @module braintrust
44
44
  */
45
45
  export * from "./logger";
46
- export { Evaluator, EvalTask, Eval, EvalScorerArgs } from "./framework";
46
+ export { BaseExperiment, Evaluator, EvalTask, Eval, EvalScorerArgs, } from "./framework";
47
47
  export * from "./oai";