Skip the respec by default, fix that it changed application

This commit is contained in:
Anton Osika
2023-06-17 21:54:11 +02:00
parent a4019fb82f
commit 0d186e22e6
2 changed files with 43 additions and 13 deletions

View File

@@ -11,7 +11,7 @@ def setup_sys_prompt(dbs):
return dbs.identity["generate"] + "\nUseful to know:\n" + dbs.identity["philosophy"] return dbs.identity["generate"] + "\nUseful to know:\n" + dbs.identity["philosophy"]
def run(ai: AI, dbs: DBs): def simple_gen(ai: AI, dbs: DBs):
"""Run the AI on the main prompt and save the results""" """Run the AI on the main prompt and save the results"""
messages = ai.start( messages = ai.start(
setup_sys_prompt(dbs), setup_sys_prompt(dbs),
@@ -61,16 +61,31 @@ def gen_spec(ai: AI, dbs: DBs):
ai.fsystem(f"Instructions: {dbs.input['main_prompt']}"), ai.fsystem(f"Instructions: {dbs.input['main_prompt']}"),
] ]
messages = ai.next(messages, dbs.identity["spec"])
messages = ai.next(messages, dbs.identity["respec"])
messages = ai.next(messages, dbs.identity["spec"]) messages = ai.next(messages, dbs.identity["spec"])
dbs.memory["specification"] = messages[-1]["content"] dbs.memory["specification"] = messages[-1]["content"]
return messages return messages
def respec(ai: AI, dbs: DBs):
messages = dbs.logs[gen_spec.__name__]
messages += [ai.fsystem(dbs.identity["respec"])]
def pre_unit_tests(ai: AI, dbs: DBs): messages = ai.next(messages)
messages = ai.next(
messages,
(
'Based on the conversation so far, please reiterate the specification for the program. '
'If there are things that can be improved, please incorporate the improvements. '
"If you are satisfied with the specification, just write out the specification word by word again."
)
)
dbs.memory["specification"] = messages[-1]["content"]
return messages
def gen_unit_tests(ai: AI, dbs: DBs):
""" """
Generate unit tests based on the specification, that should work. Generate unit tests based on the specification, that should work.
""" """
@@ -88,7 +103,20 @@ def pre_unit_tests(ai: AI, dbs: DBs):
return messages return messages
def run_clarified(ai: AI, dbs: DBs): def gen_clarified_code(ai: AI, dbs: DBs):
# get the messages from previous step
messages = json.loads(dbs.logs[clarify.__name__])
messages = [
ai.fsystem(setup_sys_prompt(dbs)),
] + messages[1:]
messages = ai.next(messages, dbs.identity["use_qa"])
to_files(messages[-1]["content"], dbs.workspace)
return messages
def gen_code(ai: AI, dbs: DBs):
# get the messages from previous step # get the messages from previous step
messages = [ messages = [
@@ -146,10 +174,11 @@ def gen_entrypoint(ai, dbs):
# Different configs of what steps to run # Different configs of what steps to run
STEPS = { STEPS = {
"default": [gen_spec, pre_unit_tests, run_clarified, execute_workspace], "default": [gen_spec, gen_unit_tests, gen_code, execute_workspace],
"benchmark": [gen_spec, pre_unit_tests, run_clarified, gen_entrypoint], "benchmark": [gen_spec, gen_unit_tests, gen_code, gen_entrypoint],
"simple": [run, execute_workspace], "simple": [simple_gen, execute_workspace],
"clarify": [clarify, run_clarified, gen_entrypoint], "clarify": [clarify, gen_clarified_code, execute_workspace],
"respec": [gen_spec, respec, gen_unit_tests, gen_code, execute_workspace],
"execute_only": [execute_entrypoint], "execute_only": [execute_entrypoint],
} }

View File

@@ -1,9 +1,10 @@
You are a pragmatic principal engineer at Google. You have been asked to review a specification for a new feature. You are a pragmatic principal engineer at Google.
You have been asked to review a specification for a new feature by a previous version of yourself
You have been asked to give feedback on the following: You have been asked to give feedback on the following:
- Is there anything that might not work the way the user expects? - Is there anything that might not work the way intended by the instructions?
- Is there anything missing for the program to fully work? - Is there anything in the specification missing for the program to work as expected?
- Is there anything that can be simplified without decreasing quality? - Is there anything that can be simplified without significant drawback?
You are asked to make educated assumptions for each unclear item. You are asked to make educated assumptions for each unclear item.
For each of these, communicate which assumptions you'll make when implementing the feature. For each of these, communicate which assumptions you'll make when implementing the feature.