From d1f0590911c0dc40d93c7a8948d9c4b2ac4ade94 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 28 Jun 2023 18:25:39 -0700 Subject: [PATCH] move benchmark prompts into their own file --- benchmark/benchmark.py | 17 +++-------------- benchmark/prompts.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 benchmark/prompts.py diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py index c3e349f2e..746ff4a49 100755 --- a/benchmark/benchmark.py +++ b/benchmark/benchmark.py @@ -14,6 +14,7 @@ from pathlib import Path import git import lox +import prompts import typer from rich.console import Console @@ -268,12 +269,7 @@ def run_test(testdir, model_name, edit_format, tries, no_unit_tests, verbose, co else: instructions = "" instructions += (testdir / ".docs/instructions.md").read_text() - instructions += f""" -===== -Use the above instructions to modify the supplied files: {file_list} -Keep and implement the existing function or class stubs, they will be called from unit tests. -Only use standard python libraries, don't suggest installing any packages. -""" + instructions += prompts.instructions_addendum.format(file_list=file_list) io = InputOutput( pretty=True, @@ -327,14 +323,7 @@ Only use standard python libraries, don't suggest installing any packages. errors = errors[:50] errors = "\n".join(errors) instructions = errors - instructions += f""" - -#### - -See the testing errors above. -The tests are correct. -Fix the code in {file_list} to resolve the errors. -""" + instructions += prompts.test_failures.format(file_list=file_list) results = dict( testdir=str(testdir), diff --git a/benchmark/prompts.py b/benchmark/prompts.py new file mode 100644 index 000000000..996941085 --- /dev/null +++ b/benchmark/prompts.py @@ -0,0 +1,16 @@ +instructions_addendum = """ +#### + +Use the above instructions to modify the supplied files: {file_list} +Keep and implement the existing function or class stubs, they will be called from unit tests. +Only use standard python libraries, don't suggest installing any packages. +""" + + +test_failures = """ +#### + +See the testing errors above. +The tests are correct. +Fix the code in {file_list} to resolve the errors. +"""