Allow benchmarking tool to handle empty response (#12174)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Kangyan-Zhou
2025-10-29 20:26:23 -07:00
committed by GitHub
co-authored by Claude
parent 25c5049870
commit 2b71531a70
5 changed files with 9 additions and 3 deletions
@@ -80,6 +80,7 @@ class HumanEval(Eval):
instruction = "Read the following function signature and docstring, and fully implement the function described. Your response should only contain the code for this function.\n"
def find_code(completion):
completion = completion or ""
pattern = re.compile(r"```python\n(.*?)```", re.DOTALL)
matches = pattern.findall(completion)
extracted_answer = matches[0] if len(matches) >= 1 else completion