MCPcopy Create free account
hub / github.com/FastMAS/KVCOMM / extract_answer_from_output

Function extract_answer_from_output

KVCOMM/utils/utils.py:12–19  ·  view source on GitHub ↗
(completion)

Source from the content-addressed store, hash-verified

10ANSWER_TRIGGER = "The answer is"
11
12def extract_answer_from_output(completion):
13 match = ANS_RE.search(completion)
14 if match:
15 match_str = match.group(1).strip()
16 match_str = match_str.replace(",", "")
17 return match_str
18 else:
19 return INVALID_ANS
20
21def is_correct(model_answer, answer):
22 gt_answer = extract_answer_from_output(answer)

Callers 1

is_correctFunction · 0.85

Calls 1

searchMethod · 0.45

Tested by

no test coverage detected