|
name: "ReplanningFlow" |
|
description: "Re-plan given old plan and new information" |
|
|
|
_target_: Tachi67.ReplanningFlowModule.ReplanningFlow.instantiate_from_default_config |
|
|
|
input_interface: |
|
- "goal" |
|
- "plan" |
|
- "plan_file_location" |
|
|
|
output_interface: |
|
- "plan" |
|
- "status" |
|
- "summary" |
|
- "result" |
|
|
|
|
|
subflows_config: |
|
Controller: |
|
_target_: Tachi67.PlanWriterFlowModule.PlanWriterCtrlFlow.instantiate_from_default_config |
|
backend: |
|
api_infos: ??? |
|
model_name: |
|
openai: gpt-4 |
|
azure: azure/gpt-4 |
|
input_interface_initialized: |
|
- "new_plan" |
|
- "feedback" |
|
system_message_prompt_template: |
|
_target_: langchain.PromptTemplate |
|
template: |2- |
|
You are in charge of a department of rewriting plans to solve a certain goal. You work with a re-planner, who does all the re-planning job. |
|
|
|
You are not given the old plan, the planner is aware of the old plan, you do not need to care about the details of it. |
|
|
|
Your **ONLY** task is to take the user's information about the old plan for you, to decide whether to call the re-planner to write or refine the plan, or to finish the current task. |
|
|
|
When you need to call the plan writer, call the `write_plan` command with the goal specified. |
|
When the plan 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. |
|
Whenever you are in doubt, or need to confirm something to the user, call `ask_user` with the question. |
|
|
|
You **must not** write plans yourself. You only decide whether to call the planner with specified goals or to finish. |
|
|
|
Your workflow: |
|
0. Whenever the user demands to quit or terminate the current process, call `manual_finish` command. |
|
1. Upon user request, call the `write_plan` with the information given. |
|
2. The planner will write the plan. The user will examine the plan, and provide feedback. |
|
3. Depending on the feedback of the user: |
|
3.1. The user provides feedback on how to change the plan, **call the planner with user's specific requirements again, to ask the planner to refine the plan**. Go back to step 2. |
|
3.2. The user does not provide details about refining the plan, for example, just stating the fact that the user has updated the plan, **this means the user is satisfied with the plan written, call the `finish` command.** |
|
3.3. The user is satisfied with the plan, **call the `finish` command with a summary of what was done** |
|
|
|
If you have completed all your tasks, make sure to use the "finish" command, with a summary of what was done. |
|
|
|
Constraints: |
|
1. Exclusively use the commands listed in double quotes e.g. "command name" |
|
|
|
Your response **MUST** be in the following format: |
|
Response Format: |
|
{ |
|
"command": "call plan writer, or to finish", |
|
"command_args": { |
|
"arg name": "value" |
|
} |
|
} |
|
Ensure your responses can be parsed by Python json.loads |
|
|
|
|
|
Available Functions: |
|
{{commands}} |
|
input_variables: [ "commands" ] |
|
template_format: jinja2 |
|
|
|
human_message_prompt_template: |
|
_target_: flows.prompt_template.JinjaPrompt |
|
template: |2- |
|
Here is the new plan written by the planner, it might have been updated by the user, depending on the user's feedback: |
|
{{new_plan}} |
|
Here is the feedback from the user: |
|
{{feedback}} |
|
input_variables: |
|
- "new_plan" |
|
- "feedback" |
|
template_format: jinja2 |
|
|
|
init_human_message_prompt_template: |
|
_target_: flows.prompt_template.JinjaPrompt |
|
template: |2- |
|
Here is the information about the old plan: |
|
{{goal}} |
|
input_variables: |
|
- "goal" |
|
template_format: jinja2 |
|
|
|
Executor: |
|
_target_: flows.base_flows.BranchingFlow.instantiate_from_default_config |
|
subflows_config: |
|
write_plan: |
|
_target_: Tachi67.InteractivePlanGenFlowModule.InteractivePlanGenFlow.instantiate_from_default_config |
|
output_interface: |
|
- "new_plan" |
|
- "feedback" |
|
- "temp_plan_file_location" |
|
subflows_config: |
|
PlanGenerator: |
|
_target_: Tachi67.ReplanningFlowModule.NewPlanGenFlow.instantiate_from_default_config |
|
backend: |
|
api_infos: ??? |
|
model_name: |
|
openai: gpt-4 |
|
azure: azure/gpt-4 |
|
PlanFileEditor: |
|
_target_: Tachi67.PlanFileEditFlowModule.PlanFileEditAtomicFlow.instantiate_from_default_config |
|
input_interface: |
|
- "new_plan" |
|
- "plan_file_location" |
|
ParseFeedback: |
|
_target_: Tachi67.ParseFeedbackFlowModule.ParseFeedbackAtomicFlow.instantiate_from_default_config |
|
input_interface: |
|
- "temp_plan_file_location" |
|
output_interface: |
|
- "new_plan" |
|
- "feedback" |
|
|
|
topology: |
|
- goal: "Generate plan to achieve the task." |
|
input_interface: |
|
_target_: flows.interfaces.KeyInterface |
|
additional_transformations: |
|
- _target_: flows.data_transformations.KeyMatchInput |
|
flow: PlanGenerator |
|
reset: false |
|
|
|
- goal: "Write the plan generated to a temp file with instructions to the user" |
|
input_interface: |
|
_target_: flows.interfaces.KeyInterface |
|
additional_transformations: |
|
- _target_: flows.data_transformations.KeyMatchInput |
|
flow: PlanFileEditor |
|
reset: false |
|
|
|
- goal: "Parse user feedback from the temp file" |
|
input_interface: |
|
_target_: flows.interfaces.KeyInterface |
|
additional_transformations: |
|
- _target_: flows.data_transformations.KeyMatchInput |
|
flow: ParseFeedback |
|
output_interface: |
|
_target_: flows.interfaces.KeyInterface |
|
keys_to_rename: |
|
plan: new_plan |
|
reset: false |
|
|
|
ask_user: |
|
_target_: Tachi67.ReplanningFlowModule.ReplanningAskUserFlow.instantiate_from_default_config |
|
|
|
|
|
early_exit_key: "EARLY_EXIT" |
|
|
|
topology: |
|
- goal: "Select the next action and prepare the input for the executor." |
|
input_interface: |
|
_target_: flows.interfaces.KeyInterface |
|
additional_transformations: |
|
- _target_: flows.data_transformations.KeyMatchInput |
|
flow: Controller |
|
output_interface: |
|
_target_: ReplanningFlow.detect_finish_or_continue |
|
reset: false |
|
|
|
- goal: "Execute the action specified by the Controller." |
|
input_interface: |
|
_target_: flows.interfaces.KeyInterface |
|
keys_to_rename: |
|
command: branch |
|
command_args: branch_input_data |
|
keys_to_select: ["branch", "branch_input_data"] |
|
flow: Executor |
|
output_interface: |
|
_target_: flows.interfaces.KeyInterface |
|
keys_to_rename: |
|
branch_output_data: observation |
|
keys_to_unpack: ["observation"] |
|
reset: false |