MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / extract_answer

Function extract_answer

eval_general/eval_gsm8k_tgi.py:141–146  ·  view source on GitHub ↗
(completion)

Source from the content-addressed store, hash-verified

139
140
141def extract_answer(completion):
142 try:
143 last_number = re.findall(r'\d+', completion)[-1]
144 return eval(last_number)
145 except:
146 return INVALID_ANS
147
148
149def is_correct(completion, answer):

Callers 1

is_correctFunction · 0.85

Calls 1

evalFunction · 0.85

Tested by

no test coverage detected