name: "Planner/Coder" description: "Generates plan with interactions with the user, used for the coder class" _target_: Tachi67.CoderFlowModule.Planner_CoderFlow.instantiate_from_default_config input_interface: - "goal" - "code_library" - "memory_files" output_interface: - "plan" - "status" - "summary" ### Subflows specification subflows_config: Controller: _target_: Tachi67.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: _target_: Tachi67.InteractivePlanGenFlowModule.InteractivePlanGenFlow.instantiate_from_default_config input_interface: - "goal" - "plan_file_location" - "code_library_location" - "code_library" subflows_config: PlanGenerator: _target_: Tachi67.PlanGeneratorFlowModule.PlanGeneratorAtomicFlow.instantiate_from_default_config backend: api_infos: ??? model_name: openai: gpt-4 azure: azure/gpt-4 input_interface_non_initialized: - "goal" - "code_library" - "code_library_location" input_interface_initialized: - "goal" - "code_library" - "code_library_location" system_message_prompt_template: _target_: aiflows.prompt_template.JinjaPrompt template: |2- You are a planner for a coding department, you write step-by-step plans for the coders to follow and execute. You and the coders work with a code library located at {{code_library_location}}, **it is important that when you make plans, make the best use of the functions in the library.** Here are the contents in the library: {{code_library}} The coders are able to read and write the code library, namely, they can import and use the functions in the library, and they are also able to extend the library. Apart from reading and writing code, the coders are also able to execute a code script written by themselves. **You task is: given a goal to achieve, write step-by-step plans for the coders, each step of your plan should involve one of the three actions: 1. Extend the code library with a function, describe the purpose, input and output of this function so that the coders understand what you mean and write appropriate functions. 2. Run a code script, for example, downloading a package after you realize the current environment lacks it; import and call one function from the code library with specific inputs. 3. 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 extending the library, or running code, or giving a final answer. 2. Always try to use the functions already existent in the code library. To use them, instruct the coders to import and run the function from the code library. 3. If the current milestone cannot be solved by the functions in the library, generalize the problem and instruct the coders to extend the library with a function to deal with this problem. For example, suppose the goal you need to achieve is "Download Google's stock prices from the last 6 months from Yahoo finance", there is no function available to solve this in the library. In this case, your step of plan is: "Extend the library with a function that reads the stock prices for the last k months for a company given its `company_code`" 4. On top of criterion 3, when you instruct the coders to extend the library, make sure that: 4.1. Each time you instruct to extend the library, ask for only one function. 4.2. If the problem you generalize involves several separated steps and should not be done in one function, decompose the problem into several sub-problems and instruct the coders to extend the library with a function for each sub-problem, this should be done in several steps of plan. 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 extending the library, or running code, or answering. 3. You should make plans with as few steps as possible. **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.** input_variables: - "code_library_location" - "code_library" PlanFileEditor: _target_: Tachi67.PlanFileEditFlowModule.PlanFileEditAtomicFlow.instantiate_from_default_config ParseFeedback: _target_: Tachi67.ParseFeedbackFlowModule.ParseFeedbackAtomicFlow.instantiate_from_default_config input_interface: - "temp_plan_file_location" output_interface: - "plan" - "feedback" ask_user: _target_: Tachi67.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_CoderFlow.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