This commit is contained in:
Emil Ahlbäck
2023-06-18 16:26:03 +02:00
parent 38401b2f35
commit 3f86b2a33d
2 changed files with 16 additions and 1 deletions

View File

@@ -193,10 +193,23 @@ def use_feedback(ai: AI, dbs: DBs):
return messages
def fix_code(ai: AI, dbs: DBs):
codemem = json.loads(dbs.logs[gen_code.__name__])[-1]["content"]
messages = [
ai.fsystem(setup_sys_prompt(dbs)),
ai.fuser(f"Instructions: {dbs.input['main_prompt']}"),
ai.fuser(codemem),
ai.fsystem(dbs.identity["fixer"]),
]
messages = ai.next(messages, "Please fix any errors in the code above.")
to_files(messages[-1]["content"], dbs.workspace)
return messages
# Different configs of what steps to run
STEPS = {
"default": [gen_spec, gen_unit_tests, gen_code, gen_entrypoint, execute_entrypoint],
"benchmark": [gen_spec, gen_unit_tests, gen_code, gen_entrypoint],
"benchmark": [gen_spec, gen_unit_tests, gen_code, fix_code, gen_entrypoint],
"simple": [simple_gen, gen_entrypoint, execute_entrypoint],
"clarify": [clarify, gen_clarified_code, gen_entrypoint, execute_entrypoint],
"respec": [

2
identity/fix_code Normal file
View File

@@ -0,0 +1,2 @@
You are a super smart developer. You have been tasked with fixing a program and making it work according to the best of your knowledge. There might be placeholders in the code you have to fill in.
You provide fully functioning, well formatted code with few comments, that works and has no bugs or placeholders.