mirror of
https://github.com/aljazceru/gpt-engineer.git
synced 2025-12-17 20:55:09 +01:00
Skip the respec by default, fix that it changed application
This commit is contained in:
@@ -11,7 +11,7 @@ def setup_sys_prompt(dbs):
|
||||
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"""
|
||||
messages = ai.start(
|
||||
setup_sys_prompt(dbs),
|
||||
@@ -61,16 +61,31 @@ def gen_spec(ai: AI, dbs: DBs):
|
||||
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"])
|
||||
|
||||
dbs.memory["specification"] = messages[-1]["content"]
|
||||
|
||||
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.
|
||||
"""
|
||||
@@ -88,7 +103,20 @@ def pre_unit_tests(ai: AI, dbs: DBs):
|
||||
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
|
||||
|
||||
messages = [
|
||||
@@ -146,10 +174,11 @@ def gen_entrypoint(ai, dbs):
|
||||
|
||||
# Different configs of what steps to run
|
||||
STEPS = {
|
||||
"default": [gen_spec, pre_unit_tests, run_clarified, execute_workspace],
|
||||
"benchmark": [gen_spec, pre_unit_tests, run_clarified, gen_entrypoint],
|
||||
"simple": [run, execute_workspace],
|
||||
"clarify": [clarify, run_clarified, gen_entrypoint],
|
||||
"default": [gen_spec, gen_unit_tests, gen_code, execute_workspace],
|
||||
"benchmark": [gen_spec, gen_unit_tests, gen_code, gen_entrypoint],
|
||||
"simple": [simple_gen, execute_workspace],
|
||||
"clarify": [clarify, gen_clarified_code, execute_workspace],
|
||||
"respec": [gen_spec, respec, gen_unit_tests, gen_code, execute_workspace],
|
||||
"execute_only": [execute_entrypoint],
|
||||
}
|
||||
|
||||
|
||||
@@ -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:
|
||||
- Is there anything that might not work the way the user expects?
|
||||
- Is there anything missing for the program to fully work?
|
||||
- Is there anything that can be simplified without decreasing quality?
|
||||
- Is there anything that might not work the way intended by the instructions?
|
||||
- Is there anything in the specification missing for the program to work as expected?
|
||||
- Is there anything that can be simplified without significant drawback?
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user