Evaluate if any of the n attempts got the correct answer. Args: attempts (List[Dict]): List of attempt results correct_answer (int): The correct answer Returns: Tuple[bool, Optional[int]]: (whether any attempt was correct, first correct attempt numb
(attempts: List[Dict], correct_answer: int)
| 436 | return attempts |
| 437 | |
| 438 | def evaluate_pass_at_n(attempts: List[Dict], correct_answer: int) -> Tuple[bool, Optional[int]]: |
| 439 | """ |
| 440 | Evaluate if any of the n attempts got the correct answer. |
| 441 | |
| 442 | Args: |
| 443 | attempts (List[Dict]): List of attempt results |
| 444 | correct_answer (int): The correct answer |
| 445 | |
| 446 | Returns: |
| 447 | Tuple[bool, Optional[int]]: (whether any attempt was correct, first correct attempt number) |
| 448 | """ |
| 449 | for attempt in attempts: |
| 450 | if attempt["predicted_answer"] == correct_answer: |
| 451 | return True, attempt["attempt_number"] |
| 452 | return False, None |
| 453 | |
| 454 | def load_existing_results(filename: str) -> List[Dict]: |
| 455 | """Load existing results from file if it exists.""" |