MCPcopy
hub / github.com/algorithmicsuperintelligence/optillm / extract_gsm8k_answer

Function extract_gsm8k_answer

scripts/eval_optillmbench.py:88–96  ·  view source on GitHub ↗

Extract numerical answer after ### from GSM8K responses.

(text: str)

Source from the content-addressed store, hash-verified

86 raise
87
88def extract_gsm8k_answer(text: str) -> float:
89 """Extract numerical answer after ### from GSM8K responses."""
90 match = re.search(r'###\s*(-?\d*\.?\d+)', text)
91 if match:
92 try:
93 return float(match.group(1))
94 except ValueError:
95 return None
96 return None
97
98def remove_thinking_blocks(text: str) -> str:
99 """

Callers 1

evaluate_responseFunction · 0.85

Calls 1

searchMethod · 0.45

Tested by

no test coverage detected