Extracts the content of the … block from `predict`. Returns the inner text (with leading/trailing whitespace stripped), or None if no tag is found.
(predict: str)
| 91 | return match.group(1).strip() |
| 92 | |
| 93 | def extract_answer(predict: str) -> Optional[str]: |
| 94 | """ |
| 95 | Extracts the content of the <answer>…</answer> block from `predict`. |
| 96 | Returns the inner text (with leading/trailing whitespace stripped), |
| 97 | or None if no <answer> tag is found. |
| 98 | """ |
| 99 | match = re.search(r"<answer>([\s\S]*?)</answer>", predict, re.DOTALL) |
| 100 | if not match: |
| 101 | return predict |
| 102 | return match.group(1).strip() |
| 103 | |
| 104 | def accuracy_reward(predict: str, ground_truth: str) -> float: |
| 105 | answer = extract_boxed_content(predict) |
nothing calls this directly
no outgoing calls
no test coverage detected