@@ -6,23 +6,49 @@ import { ExperimentSummary } from "braintrust";
66import { capitalize } from "@braintrust/core" ;
77import { z } from "zod" ;
88
9- const paramsSchema = z . strictObject ( {
10- api_key : z . string ( ) ,
11- root : z . string ( ) ,
12- paths : z . string ( ) ,
13- runtime : z . enum ( [ "node" , "python" ] ) ,
14- use_proxy : z
15- . string ( )
16- . toLowerCase ( )
17- . transform ( x => JSON . parse ( x ) )
18- . pipe ( z . boolean ( ) ) ,
19- terminate_on_failure : z
20- . string ( )
21- . toLowerCase ( )
22- . transform ( x => JSON . parse ( x ) )
23- . pipe ( z . boolean ( ) )
24- . default ( "false" ) ,
25- } ) ;
9+ const nodeManagers = [ "npm" , "pnpm" ] ;
10+ const pythonManagers = [ "pip" , "uv" ] ;
11+
12+ const paramsSchema = z
13+ . strictObject ( {
14+ api_key : z . string ( ) ,
15+ root : z . string ( ) ,
16+ paths : z . string ( ) ,
17+ runtime : z . enum ( [ "node" , "python" ] ) ,
18+ package_manager : z
19+ . enum ( [ "" , ...nodeManagers , ...pythonManagers ] )
20+ . describe ( "The preferred package manager for the runtime selected" )
21+ . default ( "" ) ,
22+ use_proxy : z
23+ . string ( )
24+ . toLowerCase ( )
25+ . transform ( x => JSON . parse ( x ) )
26+ . pipe ( z . boolean ( ) ) ,
27+ terminate_on_failure : z
28+ . string ( )
29+ . toLowerCase ( )
30+ . transform ( x => JSON . parse ( x ) )
31+ . pipe ( z . boolean ( ) )
32+ . default ( "false" ) ,
33+ } )
34+ . refine (
35+ data => {
36+ if ( data . package_manager === "" ) {
37+ return true ;
38+ }
39+ if ( data . runtime === "node" ) {
40+ return nodeManagers . includes ( data . package_manager as any ) ;
41+ }
42+ if ( data . runtime === "python" ) {
43+ return pythonManagers . includes ( data . package_manager as any ) ;
44+ }
45+ return false ;
46+ } ,
47+ {
48+ message : "Package manager must match the selected runtime" ,
49+ path : [ "package_manager" ] , // This will show the error on the package_manager field
50+ } ,
51+ ) ;
2652export type Params = z . infer < typeof paramsSchema > ;
2753
2854const TITLE = "## Braintrust eval report\n" ;
@@ -37,6 +63,7 @@ async function main(): Promise<void> {
3763 root : core . getInput ( "root" ) ,
3864 paths : core . getInput ( "paths" ) ,
3965 runtime : core . getInput ( "runtime" ) ,
66+ package_manager : core . getInput ( "package_manager" ) ,
4067 use_proxy : core . getInput ( "use_proxy" ) ,
4168 terminate_on_failure : core . getInput ( "terminate_on_failure" ) ,
4269 } ) ;
0 commit comments