| 524 | } |
| 525 | |
| 526 | def extract_example(self, prompt: str) -> list: |
| 527 | prompt = prompt['task'] |
| 528 | lines = (line.strip() for line in prompt.split('\n') if line.strip()) |
| 529 | |
| 530 | results = [] |
| 531 | lines_iter = iter(lines) |
| 532 | for line in lines_iter: |
| 533 | if line.startswith('>>>'): |
| 534 | function_call = line[4:] |
| 535 | expected_output = next(lines_iter, None) |
| 536 | if expected_output: |
| 537 | results.append(f"assert {function_call} == {expected_output}") |
| 538 | |
| 539 | return results |
| 540 | |
| 541 | def _execute(self, input:Dict[str,str], spatial_info:Dict[str,Any], temporal_info:Dict[str,Any],**kwargs): |
| 542 | """ To be overriden by the descendant class """ |