@@ -83,6 +83,11 @@ export async function runEval<
8383 concurrency = Math . min ( concurrency , 32 ) ;
8484
8585 const [ hlFile , function_ ] = await getHLFile ( client , fileConfig ) ;
86+ if ( hlFile . type === "flow" && ! function_ ) {
87+ throw new HumanloopRuntimeError (
88+ "Flows can only be evaluated locally, please provide a callable inside `file` argument." ,
89+ ) ;
90+ }
8691 const type_ = hlFile . type as FileType ;
8792
8893 let hlDataset : DatasetResponse ;
@@ -629,13 +634,16 @@ async function resolveFile<I extends Record<string, unknown> & { message?: any[]
629634 ) ;
630635 }
631636
632- if ( callable ) {
637+ if ( version ) {
633638 // User responsibility to provide adequate file.version for upserting the file
634639 console . info (
635640 `${ CYAN } Upserting a new File version based on \`file.version\`. Will use provided callable for generating Logs.${ RESET } \n` ,
636641 ) ;
637642 try {
638- return [ await upsertFile ( client , fileConfig ) , callable ] ;
643+ return [
644+ await upsertFile ( client , fileConfig ) ,
645+ callable ? callable : undefined ,
646+ ] ;
639647 } catch ( error : any ) {
640648 throw new HumanloopRuntimeError (
641649 `Error upserting File. Please ensure \`file.version\` is valid: ${ error . toString ( ) } ` ,
@@ -645,7 +653,7 @@ async function resolveFile<I extends Record<string, unknown> & { message?: any[]
645653
646654 if ( ! versionId && ! environment ) {
647655 // Return default version of the file
648- return [ hlFile as unknown as EvaluatedFile , undefined ] ;
656+ return [ hlFile as unknown as EvaluatedFile , callable ] ;
649657 }
650658
651659 if ( ! fileId && ( versionId || environment ) ) {
0 commit comments