@@ -16,7 +16,7 @@ def summarize(
1616
1717
1818class MockEpisodeSummarizer :
19- def summarize (self , exp_result : ExpResult , step_analysis : list [ str ] ) -> str :
19+ def __call__ (self , exp_result : ExpResult ) -> str :
2020 return f"Agent did actions { ', ' .join (step .action for step in exp_result .steps_info if step .action )} "
2121
2222
@@ -33,8 +33,6 @@ def pipeline() -> ErrorAnalysisPipeline:
3333 exp_dir = exp_dir ,
3434 filter = None ,
3535 episode_summarizer = MockEpisodeSummarizer (),
36- step_summarizer = MockStepSummarizer (),
37- analyzer = MockAnalyzer (),
3836 )
3937
4038
@@ -49,30 +47,10 @@ def test_yield_with_filter(pipeline: ErrorAnalysisPipeline):
4947 pipeline .filter = None
5048
5149
52- def test_analyze_step (pipeline : ErrorAnalysisPipeline ):
53- exp_result = next (pipeline .filter_exp_results ())
54- step_analysis = pipeline .analyze_step (exp_result )
55-
56- assert len (exp_result .steps_info ) == len (step_analysis ) + 1
57- assert step_analysis [0 ] == f"Agent took action { exp_result .steps_info [0 ].action } at step 0"
58-
59-
60- def test_analyze_episode (pipeline : ErrorAnalysisPipeline ):
61- exp_result = next (pipeline .filter_exp_results ())
62- step_analysis = pipeline .analyze_step (exp_result )
63- episode_analysis = pipeline .analyze_episode (exp_result , step_analysis )
64-
65- for step_info in exp_result .steps_info :
66- if step_info .action :
67- assert step_info .action in episode_analysis
68-
69-
7050def test_save_analysis (pipeline : ErrorAnalysisPipeline ):
7151 exp_result = next (pipeline .filter_exp_results ())
72- step_analysis = pipeline .analyze_step (exp_result )
73- episode_analysis = pipeline .analyze_episode (exp_result , step_analysis )
74- error_analysis = pipeline .analyze_errors (exp_result , episode_analysis , step_analysis )
7552
53+ error_analysis = pipeline .episode_summarizer (exp_result )
7654 pipeline .save_analysis (exp_result , error_analysis , exists_ok = False )
7755
7856 assert (exp_result .exp_dir / "error_analysis.json" ).exists ()
0 commit comments