MCPcopy Create free account
hub / github.com/Speakn0w/RealChart2Code / save_score_result

Function save_score_result

RealChart2Code_eval/evaluate_task3.py:698–746  ·  view source on GitHub ↗
(task_info: Dict, evaluation: Dict, raw_response: str, plot_file: Path, 
                     results_dir: Path, generation_model: str, evaluation_model: str, 
                     execution_success: bool, execution_message: str)

Source from the content-addressed store, hash-verified

696
697
698def save_score_result(task_info: Dict, evaluation: Dict, raw_response: str, plot_file: Path,
699 results_dir: Path, generation_model: str, evaluation_model: str,
700 execution_success: bool, execution_message: str) -> Path:
701
702
703 task_dir = task_info['data_directory'].name
704 task_result_dir = results_dir / task_dir
705 task_result_dir.mkdir(exist_ok=True)
706
707
708 difficulty = task_info['difficulty']
709 is_multi = task_info['is_multi']
710 score_filename = f"score_{difficulty}_mul.json" if is_multi else f"score_{difficulty}.json"
711
712
713 overall_score = calculate_overall_score(evaluation)
714
715
716 result = {
717 "generation_model": generation_model,
718 "evaluation_model": evaluation_model,
719 "task_file": str(task_info['task_file']),
720 "category": task_info['category'],
721 "instruction": task_info['instruction'],
722 "difficulty": difficulty,
723 "is_multi": is_multi,
724 "timestamp": datetime.now().isoformat(),
725
726
727 "execution_success": execution_success,
728 "execution_message": execution_message,
729 "code_generated": bool(task_info.get('code')),
730 "plot_generated": plot_file is not None,
731
732
733 "evaluation": evaluation,
734 "overall_score": overall_score,
735 "raw_response": raw_response
736 }
737
738
739 if plot_file:
740 result["plot_file"] = str(plot_file)
741
742 score_file = task_result_dir / score_filename
743 with open(score_file, 'w', encoding='utf-8') as f:
744 json.dump(result, f, ensure_ascii=False, indent=2)
745
746 return score_file
747
748
749def prepare_task_info(task_file: Path, max_data_rows: int) -> Optional[Dict]:

Callers 1

Calls 1

calculate_overall_scoreFunction · 0.70

Tested by

no test coverage detected