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

Function parse_evaluation_response

RealChart2Code_eval/evaluate_task3.py:604–629  ·  view source on GitHub ↗
(response_content: str)

Source from the content-addressed store, hash-verified

602
603
604def parse_evaluation_response(response_content: str) -> Dict:
605
606
607 try:
608 return json.loads(response_content)
609 except json.JSONDecodeError:
610 pass
611
612
613 json_match = re.search(r'```json\s*\n(.*?)\n```', response_content, re.DOTALL)
614 if json_match:
615 try:
616 return json.loads(json_match.group(1))
617 except json.JSONDecodeError:
618 pass
619
620
621 json_match = re.search(r'\{.*\}', response_content, re.DOTALL)
622 if json_match:
623 try:
624 return json.loads(json_match.group(0))
625 except json.JSONDecodeError:
626 pass
627
628
629 return create_empty_evaluation()
630
631
632def create_empty_evaluation() -> Dict:

Callers 1

Calls 1

create_empty_evaluationFunction · 0.70

Tested by

no test coverage detected