Get HumanEval from OpenAI's github repo and return as a list of parsed dicts. Returns: List[Dict[str, str]]: List of dicts with keys "prompt", "test", "entry_point" Notes: "task_id" is the identifier string for the task. "prompt" is the prompt to be used for the tas
()
| 67 | |
| 68 | |
| 69 | def get_human_eval() -> Dict[str, Dict]: |
| 70 | """Get HumanEval from OpenAI's github repo and return as a list of parsed dicts. |
| 71 | |
| 72 | Returns: |
| 73 | List[Dict[str, str]]: List of dicts with keys "prompt", "test", "entry_point" |
| 74 | |
| 75 | Notes: |
| 76 | "task_id" is the identifier string for the task. |
| 77 | "prompt" is the prompt to be used for the task (function signature with docstrings). |
| 78 | "test" is test-cases wrapped in a `check` function. |
| 79 | "entry_point" is the name of the function. |
| 80 | """ |
| 81 | # Check if human eval file exists in CACHE_DIR |
| 82 | human_eval_path = os.path.join(CACHE_DIR, "HumanEval.jsonl") |
| 83 | make_cache( |
| 84 | "https://github.com/openai/human-eval/raw/master/data/HumanEval.jsonl.gz", |
| 85 | human_eval_path, |
| 86 | ) |
| 87 | |
| 88 | human_eval = open(human_eval_path, "r").read().split("\n") |
| 89 | human_eval = [json.loads(line) for line in human_eval if line] |
| 90 | |
| 91 | # Handle 115_max_fill.py to make its docstring well-formed |
| 92 | human_eval[115]["prompt"] = "import math\n" + human_eval[115]["prompt"].replace( |
| 93 | "import math\n", "" |
| 94 | ) |
| 95 | |
| 96 | return {task["task_id"]: task for task in human_eval} |
no test coverage detected