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

Function parse_evaluation_response

RealChart2Code_eval/evaluate_task1.py:572–597  ·  view source on GitHub ↗
(response_content: str)

Source from the content-addressed store, hash-verified

570
571
572def parse_evaluation_response(response_content: str) -> Dict:
573
574
575 try:
576 return json.loads(response_content)
577 except json.JSONDecodeError:
578 pass
579
580
581 json_match = re.search(r'```json\s*\n(.*?)\n```', response_content, re.DOTALL)
582 if json_match:
583 try:
584 return json.loads(json_match.group(1))
585 except json.JSONDecodeError:
586 pass
587
588
589 json_match = re.search(r'\{.*\}', response_content, re.DOTALL)
590 if json_match:
591 try:
592 return json.loads(json_match.group(0))
593 except json.JSONDecodeError:
594 pass
595
596
597 return create_empty_evaluation()
598
599
600def create_empty_evaluation() -> Dict:

Callers 1

Calls 1

create_empty_evaluationFunction · 0.70

Tested by

no test coverage detected