braintrust 3.7.1 → 3.9.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 +228 -5
- package/dev/dist/index.d.ts +228 -5
- package/dev/dist/index.js +6259 -1261
- package/dev/dist/index.mjs +6161 -1163
- package/dist/auto-instrumentations/bundler/esbuild.cjs +995 -55
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/rollup.cjs +995 -55
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +995 -55
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +995 -55
- package/dist/auto-instrumentations/bundler/webpack-loader.d.ts +11 -9
- package/dist/auto-instrumentations/bundler/webpack.cjs +995 -55
- package/dist/auto-instrumentations/bundler/webpack.mjs +2 -2
- package/dist/auto-instrumentations/{chunk-NY4CGTN6.mjs → chunk-G7F6HZGE.mjs} +9 -1
- package/dist/auto-instrumentations/{chunk-EVUKFMHG.mjs → chunk-ITP7RAUY.mjs} +21 -3
- package/dist/auto-instrumentations/chunk-KIMMUFAK.mjs +1781 -0
- package/dist/auto-instrumentations/{chunk-VLEJ5AEK.mjs → chunk-P5YLNB2A.mjs} +21 -3
- package/dist/auto-instrumentations/hook.mjs +1206 -82
- package/dist/auto-instrumentations/index.cjs +1161 -55
- package/dist/auto-instrumentations/index.d.mts +22 -1
- package/dist/auto-instrumentations/index.d.ts +22 -1
- package/dist/auto-instrumentations/index.mjs +172 -1
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +34 -6
- package/dist/auto-instrumentations/loader/cjs-patch.d.mts +1 -0
- package/dist/auto-instrumentations/loader/cjs-patch.d.ts +1 -0
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +15 -5
- package/dist/auto-instrumentations/loader/esm-hook.mjs +10 -4
- package/dist/auto-instrumentations/loader/get-package-version.cjs +20 -2
- package/dist/auto-instrumentations/loader/get-package-version.mjs +1 -1
- package/dist/browser.d.mts +501 -18
- package/dist/browser.d.ts +501 -18
- package/dist/browser.js +6985 -1211
- package/dist/browser.mjs +6985 -1211
- package/dist/cli.js +6160 -1133
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +16054 -10191
- package/dist/edge-light.mjs +16054 -10191
- package/dist/index.d.mts +501 -18
- package/dist/index.d.ts +501 -18
- package/dist/index.js +7144 -1370
- package/dist/index.mjs +6985 -1211
- package/dist/instrumentation/index.d.mts +17 -0
- package/dist/instrumentation/index.d.ts +17 -0
- package/dist/instrumentation/index.js +5929 -1053
- package/dist/instrumentation/index.mjs +5929 -1053
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +16054 -10191
- package/dist/workerd.mjs +16054 -10191
- package/package.json +13 -8
- 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/dist/auto-instrumentations/chunk-YCKND42U.mjs +0 -839
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;
|
|
@@ -2114,6 +2154,15 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2114
2154
|
}, {
|
|
2115
2155
|
type: "scorer";
|
|
2116
2156
|
index: number;
|
|
2157
|
+
}>, z.ZodObject<{
|
|
2158
|
+
type: z.ZodLiteral<"classifier">;
|
|
2159
|
+
index: z.ZodNumber;
|
|
2160
|
+
}, "strip", z.ZodTypeAny, {
|
|
2161
|
+
type: "classifier";
|
|
2162
|
+
index: number;
|
|
2163
|
+
}, {
|
|
2164
|
+
type: "classifier";
|
|
2165
|
+
index: number;
|
|
2117
2166
|
}>]>;
|
|
2118
2167
|
}, "strip", z.ZodTypeAny, {
|
|
2119
2168
|
type: "experiment";
|
|
@@ -2123,6 +2172,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2123
2172
|
} | {
|
|
2124
2173
|
type: "scorer";
|
|
2125
2174
|
index: number;
|
|
2175
|
+
} | {
|
|
2176
|
+
type: "classifier";
|
|
2177
|
+
index: number;
|
|
2126
2178
|
};
|
|
2127
2179
|
}, {
|
|
2128
2180
|
type: "experiment";
|
|
@@ -2132,6 +2184,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2132
2184
|
} | {
|
|
2133
2185
|
type: "scorer";
|
|
2134
2186
|
index: number;
|
|
2187
|
+
} | {
|
|
2188
|
+
type: "classifier";
|
|
2189
|
+
index: number;
|
|
2135
2190
|
};
|
|
2136
2191
|
}>, z.ZodObject<{
|
|
2137
2192
|
type: z.ZodLiteral<"function">;
|
|
@@ -2204,6 +2259,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2204
2259
|
} | {
|
|
2205
2260
|
type: "scorer";
|
|
2206
2261
|
index: number;
|
|
2262
|
+
} | {
|
|
2263
|
+
type: "classifier";
|
|
2264
|
+
index: number;
|
|
2207
2265
|
};
|
|
2208
2266
|
} | {
|
|
2209
2267
|
type: "function";
|
|
@@ -2236,6 +2294,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2236
2294
|
} | {
|
|
2237
2295
|
type: "scorer";
|
|
2238
2296
|
index: number;
|
|
2297
|
+
} | {
|
|
2298
|
+
type: "classifier";
|
|
2299
|
+
index: number;
|
|
2239
2300
|
};
|
|
2240
2301
|
} | {
|
|
2241
2302
|
type: "function";
|
|
@@ -2303,6 +2364,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2303
2364
|
} | {
|
|
2304
2365
|
type: "scorer";
|
|
2305
2366
|
index: number;
|
|
2367
|
+
} | {
|
|
2368
|
+
type: "classifier";
|
|
2369
|
+
index: number;
|
|
2306
2370
|
};
|
|
2307
2371
|
} | {
|
|
2308
2372
|
type: "function";
|
|
@@ -2348,6 +2412,9 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
2348
2412
|
} | {
|
|
2349
2413
|
type: "scorer";
|
|
2350
2414
|
index: number;
|
|
2415
|
+
} | {
|
|
2416
|
+
type: "classifier";
|
|
2417
|
+
index: number;
|
|
2351
2418
|
};
|
|
2352
2419
|
} | {
|
|
2353
2420
|
type: "function";
|
|
@@ -3940,6 +4007,34 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
3940
4007
|
bundle_key: z.ZodOptional<z.ZodString>;
|
|
3941
4008
|
report_key: z.ZodOptional<z.ZodString>;
|
|
3942
4009
|
topic_names: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
4010
|
+
generation_settings: z.ZodOptional<z.ZodObject<{
|
|
4011
|
+
algorithm: z.ZodEnum<["hdbscan", "kmeans"]>;
|
|
4012
|
+
dimension_reduction: z.ZodEnum<["umap", "pca", "none"]>;
|
|
4013
|
+
sample_size: z.ZodOptional<z.ZodNumber>;
|
|
4014
|
+
n_clusters: z.ZodOptional<z.ZodNumber>;
|
|
4015
|
+
min_cluster_size: z.ZodOptional<z.ZodNumber>;
|
|
4016
|
+
min_samples: z.ZodOptional<z.ZodNumber>;
|
|
4017
|
+
hierarchy_threshold: z.ZodOptional<z.ZodNumber>;
|
|
4018
|
+
naming_model: z.ZodOptional<z.ZodString>;
|
|
4019
|
+
}, "strip", z.ZodTypeAny, {
|
|
4020
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4021
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4022
|
+
sample_size?: number | undefined;
|
|
4023
|
+
n_clusters?: number | undefined;
|
|
4024
|
+
min_cluster_size?: number | undefined;
|
|
4025
|
+
min_samples?: number | undefined;
|
|
4026
|
+
hierarchy_threshold?: number | undefined;
|
|
4027
|
+
naming_model?: string | undefined;
|
|
4028
|
+
}, {
|
|
4029
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4030
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4031
|
+
sample_size?: number | undefined;
|
|
4032
|
+
n_clusters?: number | undefined;
|
|
4033
|
+
min_cluster_size?: number | undefined;
|
|
4034
|
+
min_samples?: number | undefined;
|
|
4035
|
+
hierarchy_threshold?: number | undefined;
|
|
4036
|
+
naming_model?: string | undefined;
|
|
4037
|
+
}>>;
|
|
3943
4038
|
distance_threshold: z.ZodOptional<z.ZodNumber>;
|
|
3944
4039
|
}, "strip", z.ZodTypeAny, {
|
|
3945
4040
|
type: "topic_map";
|
|
@@ -3948,6 +4043,16 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
3948
4043
|
bundle_key?: string | undefined;
|
|
3949
4044
|
report_key?: string | undefined;
|
|
3950
4045
|
topic_names?: Record<string, string> | undefined;
|
|
4046
|
+
generation_settings?: {
|
|
4047
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4048
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4049
|
+
sample_size?: number | undefined;
|
|
4050
|
+
n_clusters?: number | undefined;
|
|
4051
|
+
min_cluster_size?: number | undefined;
|
|
4052
|
+
min_samples?: number | undefined;
|
|
4053
|
+
hierarchy_threshold?: number | undefined;
|
|
4054
|
+
naming_model?: string | undefined;
|
|
4055
|
+
} | undefined;
|
|
3951
4056
|
distance_threshold?: number | undefined;
|
|
3952
4057
|
}, {
|
|
3953
4058
|
type: "topic_map";
|
|
@@ -3956,6 +4061,16 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
3956
4061
|
bundle_key?: string | undefined;
|
|
3957
4062
|
report_key?: string | undefined;
|
|
3958
4063
|
topic_names?: Record<string, string> | undefined;
|
|
4064
|
+
generation_settings?: {
|
|
4065
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4066
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4067
|
+
sample_size?: number | undefined;
|
|
4068
|
+
n_clusters?: number | undefined;
|
|
4069
|
+
min_cluster_size?: number | undefined;
|
|
4070
|
+
min_samples?: number | undefined;
|
|
4071
|
+
hierarchy_threshold?: number | undefined;
|
|
4072
|
+
naming_model?: string | undefined;
|
|
4073
|
+
} | undefined;
|
|
3959
4074
|
distance_threshold?: number | undefined;
|
|
3960
4075
|
}>;
|
|
3961
4076
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -3967,6 +4082,16 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
3967
4082
|
bundle_key?: string | undefined;
|
|
3968
4083
|
report_key?: string | undefined;
|
|
3969
4084
|
topic_names?: Record<string, string> | undefined;
|
|
4085
|
+
generation_settings?: {
|
|
4086
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4087
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4088
|
+
sample_size?: number | undefined;
|
|
4089
|
+
n_clusters?: number | undefined;
|
|
4090
|
+
min_cluster_size?: number | undefined;
|
|
4091
|
+
min_samples?: number | undefined;
|
|
4092
|
+
hierarchy_threshold?: number | undefined;
|
|
4093
|
+
naming_model?: string | undefined;
|
|
4094
|
+
} | undefined;
|
|
3970
4095
|
distance_threshold?: number | undefined;
|
|
3971
4096
|
};
|
|
3972
4097
|
topic_map_id?: string | undefined;
|
|
@@ -3979,6 +4104,16 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
3979
4104
|
bundle_key?: string | undefined;
|
|
3980
4105
|
report_key?: string | undefined;
|
|
3981
4106
|
topic_names?: Record<string, string> | undefined;
|
|
4107
|
+
generation_settings?: {
|
|
4108
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4109
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4110
|
+
sample_size?: number | undefined;
|
|
4111
|
+
n_clusters?: number | undefined;
|
|
4112
|
+
min_cluster_size?: number | undefined;
|
|
4113
|
+
min_samples?: number | undefined;
|
|
4114
|
+
hierarchy_threshold?: number | undefined;
|
|
4115
|
+
naming_model?: string | undefined;
|
|
4116
|
+
} | undefined;
|
|
3982
4117
|
distance_threshold?: number | undefined;
|
|
3983
4118
|
};
|
|
3984
4119
|
topic_map_id?: string | undefined;
|
|
@@ -4010,6 +4145,16 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4010
4145
|
bundle_key?: string | undefined;
|
|
4011
4146
|
report_key?: string | undefined;
|
|
4012
4147
|
topic_names?: Record<string, string> | undefined;
|
|
4148
|
+
generation_settings?: {
|
|
4149
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4150
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4151
|
+
sample_size?: number | undefined;
|
|
4152
|
+
n_clusters?: number | undefined;
|
|
4153
|
+
min_cluster_size?: number | undefined;
|
|
4154
|
+
min_samples?: number | undefined;
|
|
4155
|
+
hierarchy_threshold?: number | undefined;
|
|
4156
|
+
naming_model?: string | undefined;
|
|
4157
|
+
} | undefined;
|
|
4013
4158
|
distance_threshold?: number | undefined;
|
|
4014
4159
|
};
|
|
4015
4160
|
topic_map_id?: string | undefined;
|
|
@@ -4041,6 +4186,16 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4041
4186
|
bundle_key?: string | undefined;
|
|
4042
4187
|
report_key?: string | undefined;
|
|
4043
4188
|
topic_names?: Record<string, string> | undefined;
|
|
4189
|
+
generation_settings?: {
|
|
4190
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4191
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4192
|
+
sample_size?: number | undefined;
|
|
4193
|
+
n_clusters?: number | undefined;
|
|
4194
|
+
min_cluster_size?: number | undefined;
|
|
4195
|
+
min_samples?: number | undefined;
|
|
4196
|
+
hierarchy_threshold?: number | undefined;
|
|
4197
|
+
naming_model?: string | undefined;
|
|
4198
|
+
} | undefined;
|
|
4044
4199
|
distance_threshold?: number | undefined;
|
|
4045
4200
|
};
|
|
4046
4201
|
topic_map_id?: string | undefined;
|
|
@@ -4093,6 +4248,34 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4093
4248
|
bundle_key: z.ZodOptional<z.ZodString>;
|
|
4094
4249
|
report_key: z.ZodOptional<z.ZodString>;
|
|
4095
4250
|
topic_names: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
4251
|
+
generation_settings: z.ZodOptional<z.ZodObject<{
|
|
4252
|
+
algorithm: z.ZodEnum<["hdbscan", "kmeans"]>;
|
|
4253
|
+
dimension_reduction: z.ZodEnum<["umap", "pca", "none"]>;
|
|
4254
|
+
sample_size: z.ZodOptional<z.ZodNumber>;
|
|
4255
|
+
n_clusters: z.ZodOptional<z.ZodNumber>;
|
|
4256
|
+
min_cluster_size: z.ZodOptional<z.ZodNumber>;
|
|
4257
|
+
min_samples: z.ZodOptional<z.ZodNumber>;
|
|
4258
|
+
hierarchy_threshold: z.ZodOptional<z.ZodNumber>;
|
|
4259
|
+
naming_model: z.ZodOptional<z.ZodString>;
|
|
4260
|
+
}, "strip", z.ZodTypeAny, {
|
|
4261
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4262
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4263
|
+
sample_size?: number | undefined;
|
|
4264
|
+
n_clusters?: number | undefined;
|
|
4265
|
+
min_cluster_size?: number | undefined;
|
|
4266
|
+
min_samples?: number | undefined;
|
|
4267
|
+
hierarchy_threshold?: number | undefined;
|
|
4268
|
+
naming_model?: string | undefined;
|
|
4269
|
+
}, {
|
|
4270
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4271
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4272
|
+
sample_size?: number | undefined;
|
|
4273
|
+
n_clusters?: number | undefined;
|
|
4274
|
+
min_cluster_size?: number | undefined;
|
|
4275
|
+
min_samples?: number | undefined;
|
|
4276
|
+
hierarchy_threshold?: number | undefined;
|
|
4277
|
+
naming_model?: string | undefined;
|
|
4278
|
+
}>>;
|
|
4096
4279
|
distance_threshold: z.ZodOptional<z.ZodNumber>;
|
|
4097
4280
|
}, "strip", z.ZodTypeAny, {
|
|
4098
4281
|
type: "topic_map";
|
|
@@ -4101,6 +4284,16 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4101
4284
|
bundle_key?: string | undefined;
|
|
4102
4285
|
report_key?: string | undefined;
|
|
4103
4286
|
topic_names?: Record<string, string> | undefined;
|
|
4287
|
+
generation_settings?: {
|
|
4288
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4289
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4290
|
+
sample_size?: number | undefined;
|
|
4291
|
+
n_clusters?: number | undefined;
|
|
4292
|
+
min_cluster_size?: number | undefined;
|
|
4293
|
+
min_samples?: number | undefined;
|
|
4294
|
+
hierarchy_threshold?: number | undefined;
|
|
4295
|
+
naming_model?: string | undefined;
|
|
4296
|
+
} | undefined;
|
|
4104
4297
|
distance_threshold?: number | undefined;
|
|
4105
4298
|
}, {
|
|
4106
4299
|
type: "topic_map";
|
|
@@ -4109,6 +4302,16 @@ declare const FunctionData: z.ZodUnion<[z.ZodObject<{
|
|
|
4109
4302
|
bundle_key?: string | undefined;
|
|
4110
4303
|
report_key?: string | undefined;
|
|
4111
4304
|
topic_names?: Record<string, string> | undefined;
|
|
4305
|
+
generation_settings?: {
|
|
4306
|
+
algorithm: "hdbscan" | "kmeans";
|
|
4307
|
+
dimension_reduction: "none" | "umap" | "pca";
|
|
4308
|
+
sample_size?: number | undefined;
|
|
4309
|
+
n_clusters?: number | undefined;
|
|
4310
|
+
min_cluster_size?: number | undefined;
|
|
4311
|
+
min_samples?: number | undefined;
|
|
4312
|
+
hierarchy_threshold?: number | undefined;
|
|
4313
|
+
naming_model?: string | undefined;
|
|
4314
|
+
} | undefined;
|
|
4112
4315
|
distance_threshold?: number | undefined;
|
|
4113
4316
|
}>, z.ZodUnknown>]>;
|
|
4114
4317
|
declare const PromptData: z.ZodObject<{
|
|
@@ -8279,8 +8482,8 @@ declare const PromptSessionEvent: z.ZodObject<{
|
|
|
8279
8482
|
_xact_id: string;
|
|
8280
8483
|
prompt_session_id: string;
|
|
8281
8484
|
function_type?: "llm" | "scorer" | "task" | "tool" | "custom_view" | "preprocessor" | "facet" | "classifier" | "tag" | "parameters" | "sandbox" | null | undefined;
|
|
8282
|
-
_pagination_key?: string | null | undefined;
|
|
8283
8485
|
tags?: string[] | null | undefined;
|
|
8486
|
+
_pagination_key?: string | null | undefined;
|
|
8284
8487
|
completion?: unknown;
|
|
8285
8488
|
prompt_data?: unknown;
|
|
8286
8489
|
function_data?: unknown;
|
|
@@ -8293,8 +8496,8 @@ declare const PromptSessionEvent: z.ZodObject<{
|
|
|
8293
8496
|
_xact_id: string;
|
|
8294
8497
|
prompt_session_id: string;
|
|
8295
8498
|
function_type?: "llm" | "scorer" | "task" | "tool" | "custom_view" | "preprocessor" | "facet" | "classifier" | "tag" | "parameters" | "sandbox" | null | undefined;
|
|
8296
|
-
_pagination_key?: string | null | undefined;
|
|
8297
8499
|
tags?: string[] | null | undefined;
|
|
8500
|
+
_pagination_key?: string | null | undefined;
|
|
8298
8501
|
completion?: unknown;
|
|
8299
8502
|
prompt_data?: unknown;
|
|
8300
8503
|
function_data?: unknown;
|
|
@@ -10697,6 +10900,12 @@ declare abstract class ContextManager {
|
|
|
10697
10900
|
abstract getParentSpanIds(): ContextParentSpanIds | undefined;
|
|
10698
10901
|
abstract runInContext<R>(span: Span, callback: () => R): R;
|
|
10699
10902
|
abstract getCurrentSpan(): Span | undefined;
|
|
10903
|
+
/**
|
|
10904
|
+
* Returns the value to store in the ALS bound to a TracingChannel's start event.
|
|
10905
|
+
* In default mode this is the Span itself; in OTEL mode it is the OTEL Context
|
|
10906
|
+
* containing the span so that OTEL's own ALS stores a proper Context object.
|
|
10907
|
+
*/
|
|
10908
|
+
wrapSpanForStore(span: Span): unknown;
|
|
10700
10909
|
}
|
|
10701
10910
|
declare global {
|
|
10702
10911
|
var BRAINTRUST_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
|
|
@@ -11164,6 +11373,7 @@ type EvalCase<Input, Expected, Metadata> = {
|
|
|
11164
11373
|
_xact_id?: TransactionId;
|
|
11165
11374
|
created?: string | null;
|
|
11166
11375
|
upsert_id?: string;
|
|
11376
|
+
trialCount?: number;
|
|
11167
11377
|
} & (Expected extends void ? object : {
|
|
11168
11378
|
expected: Expected;
|
|
11169
11379
|
}) & (Metadata extends void ? object : {
|
|
@@ -13084,17 +13294,23 @@ type EvalScorerArgs<Input, Output, Expected, Metadata extends BaseMetadata = Def
|
|
|
13084
13294
|
};
|
|
13085
13295
|
type OneOrMoreScores = Score | number | null | Array<Score>;
|
|
13086
13296
|
type EvalScorer<Input, Output, Expected, Metadata extends BaseMetadata = DefaultMetadataType> = (args: EvalScorerArgs<Input, Output, Expected, Metadata>) => OneOrMoreScores | Promise<OneOrMoreScores>;
|
|
13297
|
+
type OneOrMoreClassifications = Classification | Classification[] | null;
|
|
13298
|
+
type EvalClassifier<Input, Output, Expected, Metadata extends BaseMetadata = DefaultMetadataType> = (args: EvalScorerArgs<Input, Output, Expected, Metadata>) => OneOrMoreClassifications | Promise<OneOrMoreClassifications>;
|
|
13087
13299
|
type EvalResult<Input, Output, Expected, Metadata extends BaseMetadata = DefaultMetadataType> = EvalCase<Input, Expected, Metadata> & {
|
|
13088
13300
|
output: Output;
|
|
13089
|
-
scores: Record<string, number | null>;
|
|
13090
13301
|
error: unknown;
|
|
13091
13302
|
origin?: ObjectReferenceType;
|
|
13303
|
+
scores: Record<string, number | null>;
|
|
13304
|
+
classifications?: Record<string, ClassificationItem[]>;
|
|
13092
13305
|
};
|
|
13093
13306
|
type ErrorScoreHandler = (args: {
|
|
13094
13307
|
rootSpan: Span;
|
|
13095
13308
|
data: EvalCase<any, any, any>;
|
|
13096
13309
|
unhandledScores: string[];
|
|
13097
13310
|
}) => Record<string, number> | undefined | void;
|
|
13311
|
+
/**
|
|
13312
|
+
* Defines an evaluator. At least one of `scores` or `classifiers` must be provided.
|
|
13313
|
+
*/
|
|
13098
13314
|
interface Evaluator<Input, Output, Expected, Metadata extends BaseMetadata = DefaultMetadataType, Parameters extends EvalParameters = EvalParameters> {
|
|
13099
13315
|
/**
|
|
13100
13316
|
* A function that returns a list of inputs, expected outputs, and metadata.
|
|
@@ -13105,9 +13321,16 @@ interface Evaluator<Input, Output, Expected, Metadata extends BaseMetadata = Def
|
|
|
13105
13321
|
*/
|
|
13106
13322
|
task: EvalTask<Input, Output, Expected, Metadata, Parameters>;
|
|
13107
13323
|
/**
|
|
13108
|
-
* A set of functions that take an input, output, and expected value and return a
|
|
13324
|
+
* A set of functions that take an input, output, and expected value and return a {@link Score}.
|
|
13325
|
+
* At least one of `scores` or `classifiers` must be provided.
|
|
13326
|
+
*/
|
|
13327
|
+
scores?: EvalScorer<Input, Output, Expected, Metadata>[];
|
|
13328
|
+
/**
|
|
13329
|
+
* A set of functions that take an input, output, and expected value and return a
|
|
13330
|
+
* {@link Classification}. Results are recorded under the `classifications` column.
|
|
13331
|
+
* At least one of `scores` or `classifiers` must be provided.
|
|
13109
13332
|
*/
|
|
13110
|
-
|
|
13333
|
+
classifiers?: EvalClassifier<Input, Output, Expected, Metadata>[];
|
|
13111
13334
|
/**
|
|
13112
13335
|
* A set of parameters that will be passed to the evaluator.
|
|
13113
13336
|
* Can be:
|