(response_content: str)
| 570 | |
| 571 | |
| 572 | def 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 | |
| 600 | def create_empty_evaluation() -> Dict: |
no test coverage detected