@@ -457,3 +457,53 @@ async def my_async_flow(question: str) -> str:
457457 evaluation_id = evaluations_response .items [0 ].id
458458 runs_response = humanloop_client .evaluations .list_runs_for_evaluation (id = evaluation_id )
459459 assert runs_response .runs [0 ].status == "completed"
460+
461+
462+ async def test_eval_simple_async_callable (
463+ get_humanloop_client : GetHumanloopClientFn ,
464+ eval_dataset : ResourceIdentifiers ,
465+ output_not_null_evaluator : ResourceIdentifiers ,
466+ sdk_test_dir : str ,
467+ ):
468+ humanloop_client = get_humanloop_client ()
469+
470+ flow_path = f"{ sdk_test_dir } /Test Async Flow"
471+
472+ # GIVEN a simple async callable
473+ async def my_async_callable (question : str ) -> str :
474+ return "It's complicated don't worry about it!"
475+
476+ # WHEN we run an evaluation with the async callable
477+ humanloop_client .evaluations .run ( # type: ignore [attr-defined]
478+ name = "test_async_eval_run" ,
479+ file = {
480+ "path" : flow_path ,
481+ "type" : "flow" ,
482+ "version" : {
483+ "attributes" : {
484+ "foo" : "bar" ,
485+ },
486+ },
487+ "callable" : my_async_callable ,
488+ },
489+ dataset = {
490+ "path" : eval_dataset .file_path ,
491+ },
492+ evaluators = [
493+ {
494+ "path" : output_not_null_evaluator .file_path ,
495+ }
496+ ],
497+ )
498+
499+ # THEN the Flow is created
500+ flow = humanloop_client .files .retrieve_by_path (path = flow_path )
501+ assert flow is not None
502+
503+ # THEN the evaluation finishes successfully
504+ evaluations_response = humanloop_client .evaluations .list (file_id = flow .id )
505+ assert evaluations_response .items and len (evaluations_response .items ) == 1
506+ # THEN the evaluation is completed
507+ evaluation_id = evaluations_response .items [0 ].id
508+ runs_response = humanloop_client .evaluations .list_runs_for_evaluation (id = evaluation_id )
509+ assert runs_response .runs [0 ].status == "completed"
0 commit comments