44 type IfExistsType as IfExists ,
55} from "../../generated_types" ;
66import type { BuildSuccess , EvaluatorState , FileHandle } from "../types" ;
7- import { scorerName , warning } from "../../framework" ;
7+ import { classifierName , scorerName , warning } from "../../framework" ;
88import {
99 _internalGetGlobalState ,
1010 Experiment ,
@@ -181,23 +181,42 @@ export async function uploadHandleBundles({
181181 function_type : "task" ,
182182 origin,
183183 } ,
184- ...evaluator . evaluator . scores . map ( ( score , i ) : BundledFunctionSpec => {
185- const name = scorerName ( score , i ) ;
186- return {
187- ...baseInfo ,
188- // There is a very small chance that someone names a function with the same convention, but
189- // let's assume it's low enough that it doesn't matter.
190- ...formatNameAndSlug ( [ "eval" , namePrefix , "scorer" , name ] ) ,
191- description : `Score ${ name } for eval ${ namePrefix } ` ,
192- location : {
193- type : "experiment" ,
194- eval_name : evaluator . evaluator . evalName ,
195- position : { type : "scorer" , index : i } ,
196- } ,
197- function_type : "scorer" ,
198- origin,
199- } ;
200- } ) ,
184+ ...( evaluator . evaluator . scores ?? [ ] ) . map (
185+ ( score , i ) : BundledFunctionSpec => {
186+ const name = scorerName ( score , i ) ;
187+ return {
188+ ...baseInfo ,
189+ // There is a very small chance that someone names a function with the same convention, but
190+ // let's assume it's low enough that it doesn't matter.
191+ ...formatNameAndSlug ( [ "eval" , namePrefix , "scorer" , name ] ) ,
192+ description : `Score ${ name } for eval ${ namePrefix } ` ,
193+ location : {
194+ type : "experiment" ,
195+ eval_name : evaluator . evaluator . evalName ,
196+ position : { type : "scorer" , index : i } ,
197+ } ,
198+ function_type : "scorer" ,
199+ origin,
200+ } ;
201+ } ,
202+ ) ,
203+ ...( evaluator . evaluator . classifiers ?? [ ] ) . map (
204+ ( classifier , i ) : BundledFunctionSpec => {
205+ const name = classifierName ( classifier , i ) ;
206+ return {
207+ ...baseInfo ,
208+ ...formatNameAndSlug ( [ "eval" , namePrefix , "classifier" , name ] ) ,
209+ description : `Classifier ${ name } for eval ${ namePrefix } ` ,
210+ location : {
211+ type : "experiment" ,
212+ eval_name : evaluator . evaluator . evalName ,
213+ position : { type : "classifier" , index : i } ,
214+ } ,
215+ function_type : "classifier" ,
216+ origin,
217+ } ;
218+ } ,
219+ ) ,
201220 ] ;
202221
203222 bundleSpecs . push ( ...fileSpecs ) ;
@@ -220,9 +239,14 @@ export async function uploadHandleBundles({
220239 serializeRemoteEvalParametersContainer ( resolvedParameters ) ,
221240 }
222241 : { } ) ,
223- scores : evaluator . evaluator . scores . map ( ( score , i ) => ( {
242+ scores : ( evaluator . evaluator . scores ?? [ ] ) . map ( ( score , i ) => ( {
224243 name : scorerName ( score , i ) ,
225244 } ) ) ,
245+ classifiers : ( evaluator . evaluator . classifiers ?? [ ] ) . map (
246+ ( classifier , i ) => ( {
247+ name : classifierName ( classifier , i ) ,
248+ } ) ,
249+ ) ,
226250 } ;
227251
228252 bundleSpecs . push ( {
0 commit comments