@@ -33,7 +33,7 @@ def run_pipeline(file):
3333
3434 #-----------------------------------------------------
3535
36- # tests.execute(LLMExecutor())
36+ tests .execute (LLMExecutor ())
3737 print ("Stage 3/5 completed - LLM queries executed and will be stored in results/stage3_execution_result.json" )
3838
3939 execution_result_json = tests .to_dict ()
@@ -43,20 +43,34 @@ def run_pipeline(file):
4343
4444 #-----------------------------------------------------
4545
46- # tests.evaluate_responses()
46+ tests .evaluate_responses ()
4747 print ("Stage 4/5 completed - Paraphrases generated and will be stored in results/stage4_response_evaluation.json" )
4848
4949 response_evaluation_result_json = tests .to_dict ()
5050
5151 with open ("results/stage4_response_evaluation.json" , 'w' ) as json_file :
5252 json .dump (response_evaluation_result_json , json_file , indent = 4 )
5353
54+
55+
56+ # file_path = "results/stage5_metric_evaluation.json"
57+ # with open(file_path, "r") as json_file:
58+ # test_data = json.load(json_file)
59+ # from sources.models.unit_tests import UnitTests
60+ # tests = UnitTests.from_json(test_data)
61+ # print(tests[0].question)
62+
5463 #----------------------------------------------------- Stage 5
5564
56- # tests.evaluate_responses()
65+ result_array = tests .get_evaluation_result_as_numpy ()
66+ print (result_array )
67+ from sources .metrics .accuracy import Accuracy
68+ metric = Accuracy ()
69+ metric .get_metric_value (result_array )
70+ tests .metrics .append (metric )
5771 print ("Stage 5/5 completed - Metric evaluation completed and will be stored in results/stage5_metric_evaluation.json" )
5872
59- #----------------------------------------------------- Metadata creation
73+ # # ----------------------------------------------------- Metadata creation
6074
6175 end_time = time .time ()
6276 execution_time = end_time - start_time
@@ -93,7 +107,7 @@ def run_pipeline(file):
93107 return tests
94108
95109 # Below is the the code to load the object from JSON. Adapt it according to the stage you want to load the object from.
96- # file_path = "results/tests .json"
110+ # file_path = "results/stage5_metric_evaluation .json"
97111 # with open(file_path, "r") as json_file:
98112 # test_data = json.load(json_file)
99113 # from sources.models.unit_tests import UnitTests
0 commit comments