benchmark works

This commit is contained in:
Paul Gauthier 2023-06-23 14:49:48 -07:00
parent caf58cf313
commit e2cbc17f07

View file

@ -23,11 +23,12 @@ def create_temp_repo(dirname, tempdir):
shutil.copy2(s, d) shutil.copy2(s, d)
add_files = [] add_files = []
for root, _, files in os.walk(tempdir): for file in os.listdir(tempdir):
for file in files: dump(file)
if "test" not in file: full_path = os.path.join(tempdir, file)
rel_path = os.path.relpath(os.path.join(root, file), tempdir)
add_files.append(rel_path) if "test" not in file and os.path.isfile(full_path):
add_files.append(file)
""" """
# Create a new git repo in tempdir # Create a new git repo in tempdir
@ -57,7 +58,7 @@ def main(tempdir):
fnames = create_temp_repo(dirname, tempdir) fnames = create_temp_repo(dirname, tempdir)
tempdir = Path(tempdir) tempdir = Path(tempdir)
fnames = [tempdir / fn for fn in fnames] fnames = [str(tempdir / fn) for fn in fnames]
io = InputOutput( io = InputOutput(
pretty=True, pretty=True,
@ -66,6 +67,8 @@ def main(tempdir):
main_model = models.Model("gpt-3.5-turbo") main_model = models.Model("gpt-3.5-turbo")
dump(fnames)
coder = Coder.create( coder = Coder.create(
main_model, main_model,
None, None,
@ -73,10 +76,16 @@ def main(tempdir):
os.environ["OPENAI_API_KEY"], os.environ["OPENAI_API_KEY"],
fnames=fnames, fnames=fnames,
verbose=True, verbose=True,
git=False, use_git=False,
) )
coder.run(with_message="follow the instructions in the .md file") instructions = (tempdir / "docs/instructions.md").read_text()
instructions += (
"\n\n=====\n\nModify these files according to the above instructions: " + " ".join(fnames)
)
coder.run(with_message=instructions)
if __name__ == "__main__": if __name__ == "__main__":