Upload 10 files
Browse files- CodeWriterCtrlFlow.yaml +8 -4
- CodeWriterFlow.py +8 -0
CodeWriterCtrlFlow.yaml
CHANGED
@@ -32,7 +32,10 @@ commands:
|
|
32 |
description: "Write code to finish the goal with user interaction"
|
33 |
input_args: ["goal"]
|
34 |
finish:
|
35 |
-
description: "Signal that the objective has been satisfied,
|
|
|
|
|
|
|
36 |
input_args: []
|
37 |
ask_user:
|
38 |
description: "Ask user a question for confirmation or assistance"
|
@@ -50,7 +53,7 @@ system_message_prompt_template:
|
|
50 |
|
51 |
When you need to call the code writer, call the `write_code` command with the goal specified.
|
52 |
When you need to call the code tester, call the `test` command to test the code written.
|
53 |
-
When the code is written and the user is satisfied, call the `finish` command to terminate the current process.
|
54 |
Whenever you are in doubt, or need to confirm something to the user, call `ask_user` with the question.
|
55 |
|
56 |
The coder will only write one function per goal, make sure you are not asking the coder to write more than one function.
|
@@ -58,6 +61,7 @@ system_message_prompt_template:
|
|
58 |
You **must not** write code yourself. You only decide whether to call the coder with specified goals or to finish.
|
59 |
|
60 |
Your workflow:
|
|
|
61 |
1. Upon user request, call the `write_code` with the goal given.
|
62 |
2. The coder will write code, which is a function. The user will examine the code, and provide feedback.
|
63 |
3. Depending on the feedback of the user:
|
@@ -65,10 +69,10 @@ system_message_prompt_template:
|
|
65 |
3.2. The user does not provide details about refining the code, for example, just stating the fact that the user has updated the code, **this means the user is satisfied with the code written, call the `finish` command.**
|
66 |
4. If the user is satisfied with the code, call `test` to test the code
|
67 |
5. Depending on the result of the test:
|
68 |
-
5.1 Test passes, terminate the current process with the `finish command
|
69 |
5.2 Test fails, **call the coder with details of the test results to instruct the coder to refine the code**, go back to step 2.
|
70 |
|
71 |
-
If you have completed all your tasks, make sure to use the "finish" command.
|
72 |
|
73 |
Constraints:
|
74 |
1. Exclusively use the commands listed in double quotes e.g. "command name"
|
|
|
32 |
description: "Write code to finish the goal with user interaction"
|
33 |
input_args: ["goal"]
|
34 |
finish:
|
35 |
+
description: "Signal that the objective has been satisfied, return the summary of what was done"
|
36 |
+
input_args: ["summary"]
|
37 |
+
manual_finish:
|
38 |
+
description: "The user demands to quit and terminate the current process"
|
39 |
input_args: []
|
40 |
ask_user:
|
41 |
description: "Ask user a question for confirmation or assistance"
|
|
|
53 |
|
54 |
When you need to call the code writer, call the `write_code` command with the goal specified.
|
55 |
When you need to call the code tester, call the `test` command to test the code written.
|
56 |
+
When the code is written and the user is satisfied, call the `finish` command to terminate the current process with a summary of what was done in one sentence.
|
57 |
Whenever you are in doubt, or need to confirm something to the user, call `ask_user` with the question.
|
58 |
|
59 |
The coder will only write one function per goal, make sure you are not asking the coder to write more than one function.
|
|
|
61 |
You **must not** write code yourself. You only decide whether to call the coder with specified goals or to finish.
|
62 |
|
63 |
Your workflow:
|
64 |
+
0. Whenever the user demands to quit or terminate the current process, call `manual_finish` command.
|
65 |
1. Upon user request, call the `write_code` with the goal given.
|
66 |
2. The coder will write code, which is a function. The user will examine the code, and provide feedback.
|
67 |
3. Depending on the feedback of the user:
|
|
|
69 |
3.2. The user does not provide details about refining the code, for example, just stating the fact that the user has updated the code, **this means the user is satisfied with the code written, call the `finish` command.**
|
70 |
4. If the user is satisfied with the code, call `test` to test the code
|
71 |
5. Depending on the result of the test:
|
72 |
+
5.1 Test passes, terminate the current process with the `finish` command, with a summary of what was done in a sentence.
|
73 |
5.2 Test fails, **call the coder with details of the test results to instruct the coder to refine the code**, go back to step 2.
|
74 |
|
75 |
+
If you have completed all your tasks, make sure to use the "finish" command, with a summary of what was done.
|
76 |
|
77 |
Constraints:
|
78 |
1. Exclusively use the commands listed in double quotes e.g. "command name"
|
CodeWriterFlow.py
CHANGED
@@ -27,8 +27,16 @@ class CodeWriterFlow(ContentWriterFlow):
|
|
27 |
return {
|
28 |
"EARLY_EXIT": True,
|
29 |
"code": code_content,
|
|
|
30 |
"status": "finished"
|
31 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
elif command == "test":
|
33 |
# ~~~ fetch code string from flow state ~~~
|
34 |
keys_to_fetch_from_state = ["code"]
|
|
|
27 |
return {
|
28 |
"EARLY_EXIT": True,
|
29 |
"code": code_content,
|
30 |
+
"summary": "CodeWriter: " + output_payload["command_args"]["summary"],
|
31 |
"status": "finished"
|
32 |
}
|
33 |
+
elif command == "manual_finish":
|
34 |
+
return {
|
35 |
+
"EARLY_EXIT": True,
|
36 |
+
"code": "no code was generated",
|
37 |
+
"summary": "CodeWriter: CodeWriter was terminated explicitly by the user, process is unfinished",
|
38 |
+
"status": "unfinished"
|
39 |
+
}
|
40 |
elif command == "test":
|
41 |
# ~~~ fetch code string from flow state ~~~
|
42 |
keys_to_fetch_from_state = ["code"]
|