(response_content: str)
| 602 | |
| 603 | |
| 604 | def 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 | |
| 632 | def create_empty_evaluation() -> Dict: |
no test coverage detected