JarvisFlowModule / Planner_JarvisFlow.yaml
Tachi67's picture
Migrate dependency from HF/Tachi67 to HF/aiflows
97dd01c
name: "Planner/Jarvis"
description: "Generates plan with interactions with the user, used for the coder class"
_target_: flow_modules.aiflows.JarvisFlowModule.Planner_JarvisFlow.instantiate_from_default_config
input_interface:
- "goal"
- "memory_files"
output_interface:
- "plan"
- "status"
- "summary"
### Subflows specification
subflows_config:
Controller:
_target_: flow_modules.aiflows.PlanWriterFlowModule.PlanWriterCtrlFlow.instantiate_from_default_config
backend:
api_infos: ???
model_name:
openai: gpt-4
azure: azure/gpt-4
Executor:
_target_: aiflows.base_flows.BranchingFlow.instantiate_from_default_config
subflows_config:
write_plan:
subflows_config:
PlanGenerator:
backend:
api_infos: ???
model_name:
openai: gpt-4
azure: azure/gpt-4
system_message_prompt_template:
_target_: aiflows.prompt_template.JinjaPrompt
template: |2-
You are the planner for Jarvis, an intelligent agent able to achieve goals by writing and running code, you write step-by-step plans for Jarvis to follow and execute.
Jarvis is capable of:
1. Generating and running code, given a goal.
2. Giving a final answer to the user when the goal is achieved, it is also possible that Jarvis is able to give a final answer without writing and running code.
**Your task is: given a goal to achieve, decompose the goal into step-by-step plans for Jarvis, each step of your plan should ONLY involve one of the following:
1. Write and run code with a given goal generated by you, the goal should be a sub-goal of the current goal, it should be nicely separated from other-subgoals.
2. Give a final answer.**
Here are some criteria you should consider in order to write a good plan:
1. The plan should be nicely separated into steps, each step should involve either writing & running code, or giving a final answer.
2. Decompose the goal into sub-goals, each sub-goal should be nicely separated from other sub-goals, all the sub-goals should be logically linked in order to process each sub-goal to achieve the final goal.
Performance Evaluation:
1. Your plan must be as explicit, well-indented, and human-readable as possible.
2. Your plan must be step-by-step with number indexes, each step involves either writing & running code or giving a final answer.
3. You should make plans with as few steps as possible.
**Here is an example of a good plan:**
Goal: Send an email with the data of the weather in Paris of 19. Dec. 2021 to my friend.
Plan:
1. Write and run code to get the data of the weather in Paris of 19. Dec. 2021.
2. Write and run code to send an email with the data of the weather in Paris of 19. Dec. 2021 to my friend.
3. Give a final answer to the user.
**It's important that you should only respond in JSON format as described below:**
Response Format:
{
"plan": "A well indented string, containing a step-by-step plan to finish the given goal",
}
Ensure your responses can be parsed by Python json.loads
**Make sure that the plan you generate is a well-indented human readable string, with numbered indexes for each step.**
PlanFileEditor:
_target_: flow_modules.aiflows.PlanFileEditFlowModule.PlanFileEditAtomicFlow.instantiate_from_default_config
ParseFeedback:
_target_: flow_modules.aiflows.ParseFeedbackFlowModule.ParseFeedbackAtomicFlow.instantiate_from_default_config
input_interface:
- "temp_plan_file_location"
output_interface:
- "plan"
- "feedback"
ask_user:
_target_: flow_modules.aiflows.PlanWriterFlowModule.PlanWriterAskUserFlow.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_: aiflows.interfaces.KeyInterface
additional_transformations:
- _target_: aiflows.data_transformations.KeyMatchInput
flow: Controller
output_interface:
_target_: Planner_JarvisFlow.detect_finish_or_continue
reset: false
- goal: "Execute the action specified by the Controller."
input_interface:
_target_: aiflows.interfaces.KeyInterface
keys_to_rename:
command: branch
command_args: branch_input_data
keys_to_select: ["branch", "branch_input_data"]
flow: Executor
output_interface:
_target_: aiflows.interfaces.KeyInterface
keys_to_rename:
branch_output_data.plan: plan
branch_output_data.feedback: feedback
branch_output_data.temp_plan_file_location: temp_plan_file_location
keys_to_delete: ["branch_output_data"]
reset: false