| 36 | return entry_point |
| 37 | |
| 38 | def process_solution(self, solution, instance): |
| 39 | if self.dataset.name == "openai_humaneval" and not solution.startswith("def"): |
| 40 | lines = solution.splitlines() |
| 41 | if len(lines) > 0: |
| 42 | lines[0] = " " + lines[0] |
| 43 | solution = instance["prompt"] + "\n".join(lines) |
| 44 | elif self.dataset.name == "openai_humaneval": |
| 45 | try: |
| 46 | ast.parse(solution) |
| 47 | except: |
| 48 | lines = solution.splitlines() |
| 49 | if len(lines) > 0: |
| 50 | lines[0] = " " + lines[0] |
| 51 | solution = instance["prompt"] + "\n".join(lines) |
| 52 | |
| 53 | return solution |
| 54 | |
| 55 | |
| 56 | def get_solutions(self, codegen = False, chat = False): |