braintrust 3.8.0 → 3.10.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.
- package/dev/dist/index.d.mts +191 -4
- package/dev/dist/index.d.ts +191 -4
- package/dev/dist/index.js +7269 -2590
- package/dev/dist/index.mjs +7281 -2602
- package/dist/auto-instrumentations/bundler/esbuild.cjs +741 -2
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/rollup.cjs +741 -2
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +741 -2
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +738 -2
- package/dist/auto-instrumentations/bundler/webpack.cjs +741 -2
- package/dist/auto-instrumentations/bundler/webpack.mjs +2 -2
- package/dist/auto-instrumentations/{chunk-OLBMPZXE.mjs → chunk-GZNXBBPU.mjs} +741 -3
- package/dist/auto-instrumentations/{chunk-MD7W27YH.mjs → chunk-XWEQQOQH.mjs} +12 -1
- package/dist/auto-instrumentations/hook.mjs +1193 -199
- package/dist/auto-instrumentations/index.cjs +1173 -187
- package/dist/auto-instrumentations/index.d.mts +22 -1
- package/dist/auto-instrumentations/index.d.ts +22 -1
- package/dist/auto-instrumentations/index.mjs +256 -1
- package/dist/auto-instrumentations/loader/esm-hook.mjs +2 -1
- package/dist/browser.d.mts +451 -11
- package/dist/browser.d.ts +451 -11
- package/dist/browser.js +7659 -2321
- package/dist/browser.mjs +7659 -2321
- package/dist/cli.js +7143 -2435
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +7659 -2321
- package/dist/edge-light.mjs +7659 -2321
- package/dist/index.d.mts +451 -11
- package/dist/index.d.ts +451 -11
- package/dist/index.js +8054 -2716
- package/dist/index.mjs +7659 -2321
- package/dist/instrumentation/index.d.mts +17 -0
- package/dist/instrumentation/index.d.ts +17 -0
- package/dist/instrumentation/index.js +6420 -2051
- package/dist/instrumentation/index.mjs +6420 -2051
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +7659 -2321
- package/dist/workerd.mjs +7659 -2321
- package/package.json +56 -51
- package/util/dist/index.d.mts +42 -1
- package/util/dist/index.d.ts +42 -1
- package/util/dist/index.js +5 -1
- package/util/dist/index.mjs +4 -0
- package/LICENSE +0 -201
package/dev/dist/index.d.mts
CHANGED
|
@@ -131,6 +131,10 @@ type OtherExperimentLogFields = {
|
|
|
131
131
|
error: unknown;
|
|
132
132
|
tags: string[];
|
|
133
133
|
scores: Record<string, number | null>;
|
|
134
|
+
classifications?: Record<string, {
|
|
135
|
+
id: string;
|
|
136
|
+
label?: string;
|
|
137
|
+
}[]>;
|
|
134
138
|
metadata: Record<string, unknown>;
|
|
135
139
|
metrics: Record<string, unknown>;
|
|
136
140
|
datasetRecordId: string;
|
|
@@ -287,6 +291,42 @@ declare class SpanComponentsV3 {
|
|
|
287
291
|
private static fromJsonObj;
|
|
288
292
|
}
|
|
289
293
|
|
|
294
|
+
/**
|
|
295
|
+
* The result returned by a classifier function. Unlike `Score`, `id` is
|
|
296
|
+
* required and the span will be recorded as a classifier span.
|
|
297
|
+
*/
|
|
298
|
+
interface Classification {
|
|
299
|
+
/**
|
|
300
|
+
* The name of this classification result. Used as the key in the
|
|
301
|
+
* `classifications` log record. If omitted, defaults to the classifier
|
|
302
|
+
* function's name.
|
|
303
|
+
*/
|
|
304
|
+
name: string;
|
|
305
|
+
/**
|
|
306
|
+
* A machine-readable identifier for the classification outcome
|
|
307
|
+
* (e.g. `"positive"`, `"negative"`, `"neutral"`). This value is stored
|
|
308
|
+
* in the log and used for programmatic analysis.
|
|
309
|
+
*/
|
|
310
|
+
id: string;
|
|
311
|
+
/**
|
|
312
|
+
* An optional human-readable display label for this outcome. If omitted,
|
|
313
|
+
* defaults to `id`. Use this when you want a friendlier label in the UI
|
|
314
|
+
* while keeping a stable `id` for programmatic use.
|
|
315
|
+
*/
|
|
316
|
+
label?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Optional arbitrary metadata to attach to this classification result.
|
|
319
|
+
*/
|
|
320
|
+
metadata?: Record<string, unknown>;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* The serialized form of a classification stored in the `classifications` log record.
|
|
324
|
+
*/
|
|
325
|
+
interface ClassificationItem {
|
|
326
|
+
id: string;
|
|
327
|
+
label: string;
|
|
328
|
+
metadata?: Record<string, unknown>;
|
|
329
|
+
}
|
|
290
330
|
interface Score {
|
|
291
331
|
name: string;
|
|
292
332
|
score: number | null;
|
|
@@ -1434,6 +1474,29 @@ declare const SavedFunctionId: z.ZodUnion<[z.ZodObject<{
|
|
|
1434
1474
|
function_type?: "llm" | "scorer" | "task" | "tool" | "custom_view" | "preprocessor" | "facet" | "classifier" | "tag" | "parameters" | "sandbox" | undefined;
|
|
1435
1475
|
}>]>;
|
|
1436
1476
|
type SavedFunctionIdType = z.infer<typeof SavedFunctionId>;
|
|
1477
|
+
declare const DatasetSnapshot: z.ZodObject<{
|
|
1478
|
+
id: z.ZodString;
|
|
1479
|
+
dataset_id: z.ZodString;
|
|
1480
|
+
name: z.ZodString;
|
|
1481
|
+
description: z.ZodUnion<[z.ZodString, z.ZodNull]>;
|
|
1482
|
+
xact_id: z.ZodString;
|
|
1483
|
+
created: z.ZodUnion<[z.ZodString, z.ZodNull]>;
|
|
1484
|
+
}, "strip", z.ZodTypeAny, {
|
|
1485
|
+
id: string;
|
|
1486
|
+
created: string | null;
|
|
1487
|
+
name: string;
|
|
1488
|
+
description: string | null;
|
|
1489
|
+
dataset_id: string;
|
|
1490
|
+
xact_id: string;
|
|
1491
|
+
}, {
|
|
1492
|
+
id: string;
|
|
1493
|
+
created: string | null;
|
|
1494
|
+
name: string;
|
|
1495
|
+
description: string | null;
|
|
1496
|
+
dataset_id: string;
|
|
1497
|
+
xact_id: string;
|
|
1498
|
+
}>;
|
|
1499
|
+
type DatasetSnapshotType = z.infer<typeof DatasetSnapshot>;
|
|
1437
1500
|
declare const RepoInfo: z.ZodUnion<[z.ZodObject<{
|
|
1438
1501
|
commit: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
1439
1502
|
branch: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
@@ -2114,6 +2177,15 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2114
2177
|
}, {
|
|
2115
2178
|
type: "scorer";
|
|
2116
2179
|
index: number;
|
|
2180
|
+
}>, z.ZodObject<{
|
|
2181
|
+
type: z.ZodLiteral<"classifier">;
|
|
2182
|
+
index: z.ZodNumber;
|
|
2183
|
+
}, "strip", z.ZodTypeAny, {
|
|
2184
|
+
type: "classifier";
|
|
2185
|
+
index: number;
|
|
2186
|
+
}, {
|
|
2187
|
+
type: "classifier";
|
|
2188
|
+
index: number;
|
|
2117
2189
|
}>]>;
|
|
2118
2190
|
}, "strip", z.ZodTypeAny, {
|
|
2119
2191
|
type: "experiment";
|
|
@@ -2123,6 +2195,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2123
2195
|
} | {
|
|
2124
2196
|
type: "scorer";
|
|
2125
2197
|
index: number;
|
|
2198
|
+
} | {
|
|
2199
|
+
type: "classifier";
|
|
2200
|
+
index: number;
|
|
2126
2201
|
};
|
|
2127
2202
|
}, {
|
|
2128
2203
|
type: "experiment";
|
|
@@ -2132,6 +2207,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2132
2207
|
} | {
|
|
2133
2208
|
type: "scorer";
|
|
2134
2209
|
index: number;
|
|
2210
|
+
} | {
|
|
2211
|
+
type: "classifier";
|
|
2212
|
+
index: number;
|
|
2135
2213
|
};
|
|
2136
2214
|
}>, z.ZodObject<{
|
|
2137
2215
|
type: z.ZodLiteral<"function">;
|
|
@@ -2204,6 +2282,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2204
2282
|
} | {
|
|
2205
2283
|
type: "scorer";
|
|
2206
2284
|
index: number;
|
|
2285
|
+
} | {
|
|
2286
|
+
type: "classifier";
|
|
2287
|
+
index: number;
|
|
2207
2288
|
};
|
|
2208
2289
|
} | {
|
|
2209
2290
|
type: "function";
|
|
@@ -2236,6 +2317,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2236
2317
|
} | {
|
|
2237
2318
|
type: "scorer";
|
|
2238
2319
|
index: number;
|
|
2320
|
+
} | {
|
|
2321
|
+
type: "classifier";
|
|
2322
|
+
index: number;
|
|
2239
2323
|
};
|
|
2240
2324
|
} | {
|
|
2241
2325
|
type: "function";
|
|
@@ -2303,6 +2387,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2303
2387
|
} | {
|
|
2304
2388
|
type: "scorer";
|
|
2305
2389
|
index: number;
|
|
2390
|
+
} | {
|
|
2391
|
+
type: "classifier";
|
|
2392
|
+
index: number;
|
|
2306
2393
|
};
|
|
2307
2394
|
} | {
|
|
2308
2395
|
type: "function";
|
|
@@ -2348,6 +2435,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2348
2435
|
} | {
|
|
2349
2436
|
type: "scorer";
|
|
2350
2437
|
index: number;
|
|
2438
|
+
} | {
|
|
2439
|
+
type: "classifier";
|
|
2440
|
+
index: number;
|
|
2351
2441
|
};
|
|
2352
2442
|
} | {
|
|
2353
2443
|
type: "function";
|
|
@@ -3968,6 +4058,7 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
3968
4058
|
hierarchy_threshold?: number | undefined;
|
|
3969
4059
|
naming_model?: string | undefined;
|
|
3970
4060
|
}>>;
|
|
4061
|
+
disable_reconciliation: z.ZodOptional<z.ZodBoolean>;
|
|
3971
4062
|
distance_threshold: z.ZodOptional<z.ZodNumber>;
|
|
3972
4063
|
}, "strip", z.ZodTypeAny, {
|
|
3973
4064
|
type: "topic_map";
|
|
@@ -3986,6 +4077,7 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
3986
4077
|
hierarchy_threshold?: number | undefined;
|
|
3987
4078
|
naming_model?: string | undefined;
|
|
3988
4079
|
} | undefined;
|
|
4080
|
+
disable_reconciliation?: boolean | undefined;
|
|
3989
4081
|
distance_threshold?: number | undefined;
|
|
3990
4082
|
}, {
|
|
3991
4083
|
type: "topic_map";
|
|
@@ -4004,6 +4096,7 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4004
4096
|
hierarchy_threshold?: number | undefined;
|
|
4005
4097
|
naming_model?: string | undefined;
|
|
4006
4098
|
} | undefined;
|
|
4099
|
+
disable_reconciliation?: boolean | undefined;
|
|
4007
4100
|
distance_threshold?: number | undefined;
|
|
4008
4101
|
}>;
|
|
4009
4102
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -4025,6 +4118,7 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4025
4118
|
hierarchy_threshold?: number | undefined;
|
|
4026
4119
|
naming_model?: string | undefined;
|
|
4027
4120
|
} | undefined;
|
|
4121
|
+
disable_reconciliation?: boolean | undefined;
|
|
4028
4122
|
distance_threshold?: number | undefined;
|
|
4029
4123
|
};
|
|
4030
4124
|
topic_map_id?: string | undefined;
|
|
@@ -4047,6 +4141,7 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4047
4141
|
hierarchy_threshold?: number | undefined;
|
|
4048
4142
|
naming_model?: string | undefined;
|
|
4049
4143
|
} | undefined;
|
|
4144
|
+
disable_reconciliation?: boolean | undefined;
|
|
4050
4145
|
distance_threshold?: number | undefined;
|
|
4051
4146
|
};
|
|
4052
4147
|
topic_map_id?: string | undefined;
|
|
@@ -4088,6 +4183,7 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4088
4183
|
hierarchy_threshold?: number | undefined;
|
|
4089
4184
|
naming_model?: string | undefined;
|
|
4090
4185
|
} | undefined;
|
|
4186
|
+
disable_reconciliation?: boolean | undefined;
|
|
4091
4187
|
distance_threshold?: number | undefined;
|
|
4092
4188
|
};
|
|
4093
4189
|
topic_map_id?: string | undefined;
|
|
@@ -4129,6 +4225,7 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4129
4225
|
hierarchy_threshold?: number | undefined;
|
|
4130
4226
|
naming_model?: string | undefined;
|
|
4131
4227
|
} | undefined;
|
|
4228
|
+
disable_reconciliation?: boolean | undefined;
|
|
4132
4229
|
distance_threshold?: number | undefined;
|
|
4133
4230
|
};
|
|
4134
4231
|
topic_map_id?: string | undefined;
|
|
@@ -4209,6 +4306,7 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4209
4306
|
hierarchy_threshold?: number | undefined;
|
|
4210
4307
|
naming_model?: string | undefined;
|
|
4211
4308
|
}>>;
|
|
4309
|
+
disable_reconciliation: z.ZodOptional<z.ZodBoolean>;
|
|
4212
4310
|
distance_threshold: z.ZodOptional<z.ZodNumber>;
|
|
4213
4311
|
}, "strip", z.ZodTypeAny, {
|
|
4214
4312
|
type: "topic_map";
|
|
@@ -4227,6 +4325,7 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4227
4325
|
hierarchy_threshold?: number | undefined;
|
|
4228
4326
|
naming_model?: string | undefined;
|
|
4229
4327
|
} | undefined;
|
|
4328
|
+
disable_reconciliation?: boolean | undefined;
|
|
4230
4329
|
distance_threshold?: number | undefined;
|
|
4231
4330
|
}, {
|
|
4232
4331
|
type: "topic_map";
|
|
@@ -4245,6 +4344,7 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4245
4344
|
hierarchy_threshold?: number | undefined;
|
|
4246
4345
|
naming_model?: string | undefined;
|
|
4247
4346
|
} | undefined;
|
|
4347
|
+
disable_reconciliation?: boolean | undefined;
|
|
4248
4348
|
distance_threshold?: number | undefined;
|
|
4249
4349
|
}>, z.ZodUnknown>]>;
|
|
4250
4350
|
declare const PromptData: z.ZodObject<{
|
|
@@ -10617,6 +10717,31 @@ type InferParameters<T extends EvalParameters> = {
|
|
|
10617
10717
|
};
|
|
10618
10718
|
|
|
10619
10719
|
declare const RESET_CONTEXT_MANAGER_STATE: unique symbol;
|
|
10720
|
+
declare const datasetRestorePreviewResultSchema: z.ZodObject<{
|
|
10721
|
+
rows_to_restore: z.ZodNumber;
|
|
10722
|
+
rows_to_delete: z.ZodNumber;
|
|
10723
|
+
}, "strip", z.ZodTypeAny, {
|
|
10724
|
+
rows_to_restore: number;
|
|
10725
|
+
rows_to_delete: number;
|
|
10726
|
+
}, {
|
|
10727
|
+
rows_to_restore: number;
|
|
10728
|
+
rows_to_delete: number;
|
|
10729
|
+
}>;
|
|
10730
|
+
type DatasetRestorePreviewResult = z.infer<typeof datasetRestorePreviewResultSchema>;
|
|
10731
|
+
declare const datasetRestoreResultSchema: z.ZodObject<{
|
|
10732
|
+
xact_id: z.ZodNullable<z.ZodString>;
|
|
10733
|
+
rows_restored: z.ZodNumber;
|
|
10734
|
+
rows_deleted: z.ZodNumber;
|
|
10735
|
+
}, "strip", z.ZodTypeAny, {
|
|
10736
|
+
xact_id: string | null;
|
|
10737
|
+
rows_restored: number;
|
|
10738
|
+
rows_deleted: number;
|
|
10739
|
+
}, {
|
|
10740
|
+
xact_id: string | null;
|
|
10741
|
+
rows_restored: number;
|
|
10742
|
+
rows_deleted: number;
|
|
10743
|
+
}>;
|
|
10744
|
+
type DatasetRestoreResult = z.infer<typeof datasetRestoreResultSchema>;
|
|
10620
10745
|
declare const parametersRowSchema: z.ZodObject<{
|
|
10621
10746
|
id: z.ZodString;
|
|
10622
10747
|
_xact_id: z.ZodString;
|
|
@@ -11190,6 +11315,20 @@ declare class HTTPBackgroundLogger implements BackgroundLogger {
|
|
|
11190
11315
|
disable(): void;
|
|
11191
11316
|
enforceQueueSizeLimit(enforce: boolean): void;
|
|
11192
11317
|
}
|
|
11318
|
+
type DatasetSnapshotNameLookup = {
|
|
11319
|
+
snapshotName: string;
|
|
11320
|
+
xactId?: never;
|
|
11321
|
+
};
|
|
11322
|
+
type DatasetSnapshotXactLookup = {
|
|
11323
|
+
snapshotName?: never;
|
|
11324
|
+
xactId: string;
|
|
11325
|
+
};
|
|
11326
|
+
type DatasetSnapshotLookup = DatasetSnapshotNameLookup | DatasetSnapshotXactLookup;
|
|
11327
|
+
type DatasetPinState = {
|
|
11328
|
+
lazyPinnedVersion?: LazyValue<string | undefined>;
|
|
11329
|
+
pinnedEnvironment?: string;
|
|
11330
|
+
pinnedSnapshotName?: string;
|
|
11331
|
+
};
|
|
11193
11332
|
type AsyncFlushArg<IsAsyncFlush> = {
|
|
11194
11333
|
asyncFlush?: IsAsyncFlush;
|
|
11195
11334
|
};
|
|
@@ -11277,6 +11416,9 @@ declare class ObjectFetcher<RecordType> implements AsyncIterable<WithTransaction
|
|
|
11277
11416
|
constructor(objectType: "dataset" | "experiment" | "project_logs" | "playground_logs", pinnedVersion: string | undefined, mutateRecord?: ((r: any) => WithTransactionId<RecordType>) | undefined, _internal_btql?: Record<string, unknown> | undefined);
|
|
11278
11417
|
get id(): Promise<string>;
|
|
11279
11418
|
protected getState(): Promise<BraintrustState>;
|
|
11419
|
+
protected getPinnedVersion(): string | undefined;
|
|
11420
|
+
protected setPinnedVersion(pinnedVersion: string | undefined): void;
|
|
11421
|
+
protected getInternalBtql(): Record<string, unknown> | undefined;
|
|
11280
11422
|
private fetchRecordsFromApi;
|
|
11281
11423
|
/**
|
|
11282
11424
|
* Fetch all records from the object.
|
|
@@ -11306,6 +11448,7 @@ type EvalCase<Input, Expected, Metadata> = {
|
|
|
11306
11448
|
_xact_id?: TransactionId;
|
|
11307
11449
|
created?: string | null;
|
|
11308
11450
|
upsert_id?: string;
|
|
11451
|
+
trialCount?: number;
|
|
11309
11452
|
} & (Expected extends void ? object : {
|
|
11310
11453
|
expected: Expected;
|
|
11311
11454
|
}) & (Metadata extends void ? object : {
|
|
@@ -11441,12 +11584,25 @@ declare class Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY
|
|
|
11441
11584
|
private readonly lazyMetadata;
|
|
11442
11585
|
private readonly __braintrust_dataset_marker;
|
|
11443
11586
|
private newRecords;
|
|
11444
|
-
|
|
11587
|
+
private lazyPinnedVersion?;
|
|
11588
|
+
private pinnedEnvironment?;
|
|
11589
|
+
private pinnedSnapshotName?;
|
|
11590
|
+
constructor(state: BraintrustState, lazyMetadata: LazyValue<ProjectDatasetMetadata>, pinnedVersion?: string, legacy?: IsLegacyDataset, _internal_btql?: Record<string, unknown>, pinState?: DatasetPinState);
|
|
11445
11591
|
get id(): Promise<string>;
|
|
11446
11592
|
get name(): Promise<string>;
|
|
11447
11593
|
get project(): Promise<ObjectMetadata>;
|
|
11448
11594
|
get loggingState(): BraintrustState;
|
|
11595
|
+
toEvalData(): Promise<{
|
|
11596
|
+
dataset_id: string;
|
|
11597
|
+
dataset_version?: string;
|
|
11598
|
+
dataset_environment?: string;
|
|
11599
|
+
dataset_snapshot_name?: string;
|
|
11600
|
+
_internal_btql?: Record<string, unknown>;
|
|
11601
|
+
}>;
|
|
11449
11602
|
protected getState(): Promise<BraintrustState>;
|
|
11603
|
+
version(options?: {
|
|
11604
|
+
batchSize?: number;
|
|
11605
|
+
}): Promise<string | undefined>;
|
|
11450
11606
|
private validateEvent;
|
|
11451
11607
|
private createArgs;
|
|
11452
11608
|
/**
|
|
@@ -11494,6 +11650,24 @@ declare class Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY
|
|
|
11494
11650
|
readonly metadata?: Record<string, unknown>;
|
|
11495
11651
|
}): string;
|
|
11496
11652
|
delete(id: string): string;
|
|
11653
|
+
createSnapshot({ name, description, update, }: {
|
|
11654
|
+
readonly name: string;
|
|
11655
|
+
readonly description?: string;
|
|
11656
|
+
readonly update?: boolean;
|
|
11657
|
+
}): Promise<DatasetSnapshotType>;
|
|
11658
|
+
listSnapshots(): Promise<DatasetSnapshotType[]>;
|
|
11659
|
+
getSnapshot(lookup: DatasetSnapshotLookup): Promise<DatasetSnapshotType | undefined>;
|
|
11660
|
+
updateSnapshot(snapshotId: string, { name, description, }: {
|
|
11661
|
+
readonly name?: string;
|
|
11662
|
+
readonly description?: string | null;
|
|
11663
|
+
}): Promise<DatasetSnapshotType>;
|
|
11664
|
+
deleteSnapshot(snapshotId: string): Promise<DatasetSnapshotType>;
|
|
11665
|
+
restorePreview({ version, }: {
|
|
11666
|
+
readonly version: string;
|
|
11667
|
+
}): Promise<DatasetRestorePreviewResult>;
|
|
11668
|
+
restore({ version, }: {
|
|
11669
|
+
readonly version: string;
|
|
11670
|
+
}): Promise<DatasetRestoreResult>;
|
|
11497
11671
|
/**
|
|
11498
11672
|
* Summarize the dataset, including high level metrics about its size and other metadata.
|
|
11499
11673
|
* @param summarizeData Whether to summarize the data. If false, only the metadata will be returned.
|
|
@@ -13226,17 +13400,23 @@ type EvalScorerArgs<Input, Output, Expected, Metadata extends BaseMetadata = Def
|
|
|
13226
13400
|
};
|
|
13227
13401
|
type OneOrMoreScores = Score | number | null | Array<Score>;
|
|
13228
13402
|
type EvalScorer<Input, Output, Expected, Metadata extends BaseMetadata = DefaultMetadataType> = (args: EvalScorerArgs<Input, Output, Expected, Metadata>) => OneOrMoreScores | Promise<OneOrMoreScores>;
|
|
13403
|
+
type OneOrMoreClassifications = Classification | Classification[] | null;
|
|
13404
|
+
type EvalClassifier<Input, Output, Expected, Metadata extends BaseMetadata = DefaultMetadataType> = (args: EvalScorerArgs<Input, Output, Expected, Metadata>) => OneOrMoreClassifications | Promise<OneOrMoreClassifications>;
|
|
13229
13405
|
type EvalResult<Input, Output, Expected, Metadata extends BaseMetadata = DefaultMetadataType> = EvalCase<Input, Expected, Metadata> & {
|
|
13230
13406
|
output: Output;
|
|
13231
|
-
scores: Record<string, number | null>;
|
|
13232
13407
|
error: unknown;
|
|
13233
13408
|
origin?: ObjectReferenceType;
|
|
13409
|
+
scores: Record<string, number | null>;
|
|
13410
|
+
classifications?: Record<string, ClassificationItem[]>;
|
|
13234
13411
|
};
|
|
13235
13412
|
type ErrorScoreHandler = (args: {
|
|
13236
13413
|
rootSpan: Span;
|
|
13237
13414
|
data: EvalCase<any, any, any>;
|
|
13238
13415
|
unhandledScores: string[];
|
|
13239
13416
|
}) => Record<string, number> | undefined | void;
|
|
13417
|
+
/**
|
|
13418
|
+
* Defines an evaluator. At least one of `scores` or `classifiers` must be provided.
|
|
13419
|
+
*/
|
|
13240
13420
|
interface Evaluator<Input, Output, Expected, Metadata extends BaseMetadata = DefaultMetadataType, Parameters extends EvalParameters = EvalParameters> {
|
|
13241
13421
|
/**
|
|
13242
13422
|
* A function that returns a list of inputs, expected outputs, and metadata.
|
|
@@ -13247,9 +13427,16 @@ interface Evaluator<Input, Output, Expected, Metadata extends BaseMetadata = Def
|
|
|
13247
13427
|
*/
|
|
13248
13428
|
task: EvalTask<Input, Output, Expected, Metadata, Parameters>;
|
|
13249
13429
|
/**
|
|
13250
|
-
* A set of functions that take an input, output, and expected value and return a
|
|
13430
|
+
* A set of functions that take an input, output, and expected value and return a {@link Score}.
|
|
13431
|
+
* At least one of `scores` or `classifiers` must be provided.
|
|
13432
|
+
*/
|
|
13433
|
+
scores?: EvalScorer<Input, Output, Expected, Metadata>[];
|
|
13434
|
+
/**
|
|
13435
|
+
* A set of functions that take an input, output, and expected value and return a
|
|
13436
|
+
* {@link Classification}. Results are recorded under the `classifications` column.
|
|
13437
|
+
* At least one of `scores` or `classifiers` must be provided.
|
|
13251
13438
|
*/
|
|
13252
|
-
|
|
13439
|
+
classifiers?: EvalClassifier<Input, Output, Expected, Metadata>[];
|
|
13253
13440
|
/**
|
|
13254
13441
|
* A set of parameters that will be passed to the evaluator.
|
|
13255
13442
|
* Can be:
|