add more comments & docs
Browse filesFiles changed (6)
- CoderFlow.py+4
- Controller_CoderFlow.py+83-1
- CtrlExMem_CoderFlow.py+17-2
- Planner_CoderFlow.py+19-1
- README.md+189-23
- UpdatePlanAtomicFlow.py+23-1
19 unmodified lines20212223242519 unmodified lines- `result` (str): The result of the flow, the result will be returned to the caller (i.e. JarvisFlow).- `summary` (str): The summary of the flow, the summary will be logged into the logs of the caller flow (i.e. JarvisFlow).Typical workflow of Coder:0. JarvisFlow calls Coder with a goal.1. MemoryReading reads plans, logs and code library.19 unmodified lines2021222324252627282919 unmodified lines- `result` (str): The result of the flow, the result will be returned to the caller (i.e. JarvisFlow).- `summary` (str): The summary of the flow, the summary will be logged into the logs of the caller flow (i.e. JarvisFlow).*Configuration Parameters*: (Also see super class: AbstractBossFlow)- `memory_files` (dict): The memory files of the flow. The memory files are the files that the flow reads and writes. Typically it should contain plan, logs, and code_library.Typical workflow of Coder:0. JarvisFlow calls Coder with a goal.1. MemoryReading reads plans, logs and code library.
14 unmodified lines151617181920212223242516 unmodified lines4243444546472 unmodified lines5051525354555657585960613 unmodified lines65666768697016 unmodified lines87888990919212 unmodified lines10510610710810911014 unmodified linesinput_args: List[str]class Controller_CoderFlow(ChatAtomicFlow):"""Refer to: https://huggingface.co/Tachi67/JarvisFlowModule/blob/main/Controller_JarvisFlow.py"""def __init__(self,commands: List[Command],**kwargs):super().__init__(**kwargs)self.system_message_prompt_template = self.system_message_prompt_template.partial(commands=self._build_commands_manual(commands),16 unmodified lines@staticmethoddef _build_commands_manual(commands: List[Command]) -> str:ret = ""for i, command in enumerate(commands):command_input_json_schema = json.dumps(2 unmodified linesreturn retdef _get_content_file_location(self, input_data, content_name):# get the location of the file that contains the content: plan, logs, code_libraryassert "memory_files" in input_data, "memory_files not passed to Coder/Controller"assert content_name in input_data["memory_files"], f"{content_name} not in memory files"return input_data["memory_files"][content_name]def _get_content(self, input_data, content_name):# get the content of the file that contains the content: plan, logs, code_libraryassert content_name in input_data, f"{content_name} not passed to Coder/Controller"content = input_data[content_name]3 unmodified lines@classmethoddef instantiate_from_config(cls, config):flow_config = deepcopy(config)kwargs = {"flow_config": flow_config}16 unmodified linesreturn cls(**kwargs)def _update_prompts_and_input(self, input_data: Dict[str, Any]):if 'goal' in input_data:input_data['goal'] += self.hint_for_modelif 'result' in input_data:12 unmodified lines)def run(self, input_data: Dict[str, Any]) -> Dict[str, Any]:self._update_prompts_and_input(input_data)# ~~~when conversation is initialized, append the updated system prompts to the chat history ~~~14 unmodified lines151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636416 unmodified lines8182838485868788899091922 unmodified lines95969798991001011021031041051061071081091101111121131141151161171181191201211221231243 unmodified lines12812913013113213313413513613713813914016 unmodified lines15715815916016116216316416516616716812 unmodified lines18118218318418518618718818919019119214 unmodified linesinput_args: List[str]class Controller_CoderFlow(ChatAtomicFlow):"""Refer to: https://huggingface.co/aiflows/JarvisFlowModule/blob/main/Controller_JarvisFlow.pyThis flow is used to control the coder flow.*Input Interface Non Initialized*:- `goal`- `plan`- `code_library`- `logs`- `memory_files`*Input Interface Initialized*:- `goal`- `plan`- `code_library`- `logs`- `memory_files`- `result`*Output Interface*:- `command`- `command_args`*Configuration Parameters*:- `Input Interface Non Initialized`: Input interface before the conversation is initialized.- `Input Interface Initialized`: Input interface after the conversation is initialized.- `Output Interface`: Output interface.- `backend`: The backend of the LLM.- `command`: A list of available commands for the controller to call.- `system_message_prompt_template`: The template of the system message prompt.- `init_human_message_prompt_template`: The template of the initial human message prompt.- `human_message_prompt_template`: The template of the human message prompt.- `previous_messages`: The sliding window of previous messages."""def __init__(self,commands: List[Command],**kwargs):"""Initialize the flow.:param commands: A list of available commands for the controller to call.:type commands: List[Command]:param kwargs: Refer to the configuration parameters.:type kwargs: Dict[str, Any]"""super().__init__(**kwargs)self.system_message_prompt_template = self.system_message_prompt_template.partial(commands=self._build_commands_manual(commands),16 unmodified lines@staticmethoddef _build_commands_manual(commands: List[Command]) -> str:"""Build the manual for the commands.:param commands: A list of available commands for the controller to call.:type commands: List[Command]:return: The manual for the commands.:rtype: str"""ret = ""for i, command in enumerate(commands):command_input_json_schema = json.dumps(2 unmodified linesreturn retdef _get_content_file_location(self, input_data, content_name):"""Get the location of the file that contains the content: plan, logs, code_library:param input_data: The input data.:type input_data: Dict[str, Any]:param content_name: The name of the content.:type content_name: str:raises AssertionError: If the content is not in the memory files.:return: The location of the file that contains the content.:rtype: str"""# get the location of the file that contains the content: plan, logs, code_libraryassert "memory_files" in input_data, "memory_files not passed to Coder/Controller"assert content_name in input_data["memory_files"], f"{content_name} not in memory files"return input_data["memory_files"][content_name]def _get_content(self, input_data, content_name):"""Get the content of the file that contains the content: plan, logs, code_library:param input_data: The input data.:type input_data: Dict[str, Any]:param content_name: The name of the content.:type content_name: str:raises AssertionError: If the content is not in the memory files.:return: The content of the file that contains the content.:rtype: str"""# get the content of the file that contains the content: plan, logs, code_libraryassert content_name in input_data, f"{content_name} not passed to Coder/Controller"content = input_data[content_name]3 unmodified lines@classmethoddef instantiate_from_config(cls, config):"""Instantiate the flow from the configuration.:param config: The configuration.:type config: Dict[str, Any]:return: The instantiated flow.:rtype: Controller_CoderFlow"""flow_config = deepcopy(config)kwargs = {"flow_config": flow_config}16 unmodified linesreturn cls(**kwargs)def _update_prompts_and_input(self, input_data: Dict[str, Any]):"""Update the prompts and input data.:param input_data: The input data.:type input_data: Dict[str, Any]:raises AssertionError: If the input data is not valid."""if 'goal' in input_data:input_data['goal'] += self.hint_for_modelif 'result' in input_data:12 unmodified lines)def run(self, input_data: Dict[str, Any]) -> Dict[str, Any]:"""Run the flow.:param input_data: The input data.:type input_data: Dict[str, Any]:return: The output data.:rtype: Dict[str, Any]"""self._update_prompts_and_input(input_data)# ~~~when conversation is initialized, append the updated system prompts to the chat history ~~~
4 unmodified lines5678910115 unmodified lines1718192021222324252 unmodified lines2829303132334 unmodified linesclass CtrlExMem_CoderFlow(CtrlExMemFlow):"""This class inherits from the CtrlExMemFlow class from AbstractBossFlowModule.See: https://huggingface.co/Tachi67/AbstractBossFlowModule/blob/main/CtrlExMemFlow.py*Input Interface*:- `plan`5 unmodified lines*Output Interface*- `result` (str): The result of the flow, the result will be returned to the caller.- `summary` (str): The summary of the flow, the summary will be logged into the logs of the caller flow."""def _on_reach_max_round(self):self._state_update_dict({"result": "the maximum amount of rounds was reached before the coder flow has done the job","summary": "CoderFlow: the maximum amount of rounds was reached before the flow has done the job",2 unmodified lines@CircularFlow.output_msg_payload_processordef detect_finish_or_continue(self, output_payload: Dict[str, Any], src_flow) -> Dict[str, Any]:command = output_payload["command"]if command == "finish":return {4 unmodified lines5678910115 unmodified lines17181920212223242526272829303132332 unmodified lines363738394041424344454647484 unmodified linesclass CtrlExMem_CoderFlow(CtrlExMemFlow):"""This class inherits from the CtrlExMemFlow class from AbstractBossFlowModule.See: https://huggingface.co/aiflows/AbstractBossFlowModule/blob/main/CtrlExMemFlow.py*Input Interface*:- `plan`5 unmodified lines*Output Interface*- `result` (str): The result of the flow, the result will be returned to the caller.- `summary` (str): The summary of the flow, the summary will be logged into the logs of the caller flow.*Configuration Parameters*:- See the configuration parameters of the CtrlExMemFlow class from AbstractBoss (https://huggingface.co/aiflows/AbstractBossFlowModule/blob/main/CtrlExMemFlow.py).- `input_interface`: the input interface of the flow- `output_interface`: the output interface of the flow- `subflows_config`: the configuration of the subflows"""def _on_reach_max_round(self):"""This method is called when the flow reaches the maximum amount of rounds."""self._state_update_dict({"result": "the maximum amount of rounds was reached before the coder flow has done the job","summary": "CoderFlow: the maximum amount of rounds was reached before the flow has done the job",2 unmodified lines@CircularFlow.output_msg_payload_processordef detect_finish_or_continue(self, output_payload: Dict[str, Any], src_flow) -> Dict[str, Any]:"""This method is called when the flow receives a message from a subflow.This method will check the message and decide whether the flow should continue or finish.:param output_payload: the output payload of the subflow:param src_flow: the source flow of the message:return: the output payload of the flow:rtype: Dict[str, Any]"""command = output_payload["command"]if command == "finish":return {
5 unmodified lines67891011125 unmodified linesclass Planner_CoderFlow(PlanWriterFlow):"""Planner of the coder flow, it inherits from PlanWriterFlow, see: https://huggingface.co/Tachi67/PlanWriterFlowModule"""def _on_reach_max_round(self):self._state_update_dict({5 unmodified lines67891011121314151617181920212223242526272829305 unmodified linesclass Planner_CoderFlow(PlanWriterFlow):"""Planner of the coder flow, it inherits from PlanWriterFlow, see: https://huggingface.co/aiflows/PlanWriterFlowModuleThis flow is responsible for generating the plan for the coder flow.*Input Interface*- `goal`- `memory_files`- `code_library`*Output Interface*- `plan`- `summary`- `status`*Configuration Parameters*:- Look at the configuration parameters of PlanWriterFlowModule for detailed info. (https://huggingface.co/aiflows/PlanWriterFlowModule)- `input_interface`: the input interface of the flow, default: `["goal", "memory_files", "code_library"]`- `output_interface`: the output interface of the flow, default: `["plan", "summary", "status"]`- `subflows_config`: configuration of the subflows.- `topology`: topology of the subflows."""def _on_reach_max_round(self):self._state_update_dict({
123479 unmodified lines848586878889909192939495969798991001011021031041051061071081091101111121138 unmodified lines1221231241251261271286 unmodified lines13513613713813914010 unmodified lines1511521531541551561577 unmodified lines16516616716816917017117 unmodified lines18919019119219319421 unmodified lines216217218219220221### Structure of Coder```goal, memory_files (dict)79 unmodified lines- library.pyAbout the branches:- [ExtendLibrary](https://huggingface.co/Tachi67/ExtendLibraryFlowModule): Writes and tests code functions in an interactive fashion, finally saves the written function to the code library.- [ask_user](https://huggingface.co/Tachi67/ExtendLibraryFlowModule/blob/main/ExtLibAskUserFlow.py): Ask user for info / confirmation, etc.- [re_plan](https://huggingface.co/Tachi67/ReplanningFlowModule): One branch of the executors, when something goes wrong, re-draft the plan.- [update_plan](https://huggingface.co/Tachi67/JarvisFlowModule/blob/main/UpdatePlanAtomicFlow.py): One branch of the executors, when the controller realizes that one (or some, depending on the LLM's response) step of the plan is (are) done, it generates a new plan that marks the step(s) as done.- [run_code](https://huggingface.co/Tachi67/RunCodeFlowModule): Runs the code written by the Controller, will first open up a temp file with the code for user confirmation and editing, then the code is passed to the [InterpreterFlow](https://huggingface.co/Tachi67/InterpreterFlowModule).# Table of Contents* [CtrlExMem\_CoderFlow](#CtrlExMem_CoderFlow)* [CtrlExMem\_CoderFlow](#CtrlExMem_CoderFlow.CtrlExMem_CoderFlow)* [run\_coder](#run_coder)* [Planner\_CoderFlow](#Planner_CoderFlow)* [Planner\_CoderFlow](#Planner_CoderFlow.Planner_CoderFlow)* [Controller\_CoderFlow](#Controller_CoderFlow)* [Controller\_CoderFlow](#Controller_CoderFlow.Controller_CoderFlow)* [UpdatePlanAtomicFlow](#UpdatePlanAtomicFlow)* [UpdatePlanAtomicFlow](#UpdatePlanAtomicFlow.UpdatePlanAtomicFlow)* [CoderFlow](#CoderFlow)* [CoderFlow](#CoderFlow.CoderFlow)* [run](#CoderFlow.CoderFlow.run)* [\_\_init\_\_](#__init__)<a id="CtrlExMem_CoderFlow"></a>8 unmodified lines```This class inherits from the CtrlExMemFlow class from AbstractBossFlowModule.See: https://huggingface.co/Tachi67/AbstractBossFlowModule/blob/main/CtrlExMemFlow.py*Input Interface*:- `plan`6 unmodified lines- `result` (str): The result of the flow, the result will be returned to the caller.- `summary` (str): The summary of the flow, the summary will be logged into the logs of the caller flow.<a id="run_coder"></a># run\_coder10 unmodified linesclass Planner_CoderFlow(PlanWriterFlow)```Planner of the coder flow, it inherits from PlanWriterFlow, see: https://huggingface.co/Tachi67/PlanWriterFlowModule<a id="Controller_CoderFlow"></a>7 unmodified linesclass Controller_CoderFlow(ChatAtomicFlow)```Refer to: https://huggingface.co/Tachi67/JarvisFlowModule/blob/main/Controller_JarvisFlow.py<a id="UpdatePlanAtomicFlow"></a>17 unmodified lines*Output Interface*- `result`: the result of the update plan operation<a id="CoderFlow"></a># CoderFlow21 unmodified lines- `result` (str): The result of the flow, the result will be returned to the caller (i.e. JarvisFlow).- `summary` (str): The summary of the flow, the summary will be logged into the logs of the caller flow (i.e. JarvisFlow).Typical workflow of Coder:0. JarvisFlow calls Coder with a goal.1. MemoryReading reads plans, logs and code library.1234567891011121314151617181920212223242526272879 unmodified lines1081091101111121131141151161171181191201211221238 unmodified lines1321331341351361371386 unmodified lines14514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817910 unmodified lines1901911921931941951961971981992002012022032042052062072082092102112122132147 unmodified lines22222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031117 unmodified lines32933033133233333433533633733833934034134234334434534634734834935035135235335435535621 unmodified lines378379380381382383384385386387# Table of Contents* [Structure of Coder](#structure-of-coder)* [CtrlExMem\_CoderFlow](#CtrlExMem_CoderFlow)* [CtrlExMem\_CoderFlow](#CtrlExMem_CoderFlow.CtrlExMem_CoderFlow)* [detect\_finish\_or\_continue](#CtrlExMem_CoderFlow.CtrlExMem_CoderFlow.detect_finish_or_continue)* [run\_coder](#run_coder)* [Planner\_CoderFlow](#Planner_CoderFlow)* [Planner\_CoderFlow](#Planner_CoderFlow.Planner_CoderFlow)* [Controller\_CoderFlow](#Controller_CoderFlow)* [Controller\_CoderFlow](#Controller_CoderFlow.Controller_CoderFlow)* [\_\_init\_\_](#Controller_CoderFlow.Controller_CoderFlow.__init__)* [instantiate\_from\_config](#Controller_CoderFlow.Controller_CoderFlow.instantiate_from_config)* [run](#Controller_CoderFlow.Controller_CoderFlow.run)* [UpdatePlanAtomicFlow](#UpdatePlanAtomicFlow)* [UpdatePlanAtomicFlow](#UpdatePlanAtomicFlow.UpdatePlanAtomicFlow)* [run](#UpdatePlanAtomicFlow.UpdatePlanAtomicFlow.run)* [CoderFlow](#CoderFlow)* [CoderFlow](#CoderFlow.CoderFlow)* [run](#CoderFlow.CoderFlow.run)* [\_\_init\_\_](#__init__)# Structure of Coder```goal, memory_files (dict)79 unmodified lines- library.pyAbout the branches:- [ExtendLibrary](https://huggingface.co/aiflows/ExtendLibraryFlowModule): Writes and tests code functions in an interactive fashion, finally saves the written function to the code library.- [ask_user](https://huggingface.co/aiflows/ExtendLibraryFlowModule/blob/main/ExtLibAskUserFlow.py): Ask user for info / confirmation, etc.- [re_plan](https://huggingface.co/aiflows/ReplanningFlowModule): One branch of the executors, when something goes wrong, re-draft the plan.- [update_plan](https://huggingface.co/aiflows/JarvisFlowModule/blob/main/UpdatePlanAtomicFlow.py): One branch of the executors, when the controller realizes that one (or some, depending on the LLM's response) step of the plan is (are) done, it generates a new plan that marks the step(s) as done.- [run_code](https://huggingface.co/aiflows/RunCodeFlowModule): Runs the code written by the Controller, will first open up a temp file with the code for user confirmation and editing, then the code is passed to the [InterpreterFlow](https://huggingface.co/aiflows/InterpreterFlowModule).<a id="CtrlExMem_CoderFlow"></a>8 unmodified lines```This class inherits from the CtrlExMemFlow class from AbstractBossFlowModule.See: https://huggingface.co/aiflows/AbstractBossFlowModule/blob/main/CtrlExMemFlow.py*Input Interface*:- `plan`6 unmodified lines- `result` (str): The result of the flow, the result will be returned to the caller.- `summary` (str): The summary of the flow, the summary will be logged into the logs of the caller flow.*Configuration Parameters*:- See the configuration parameters of the CtrlExMemFlow class from AbstractBoss (https://huggingface.co/aiflows/AbstractBossFlowModule/blob/main/CtrlExMemFlow.py).- `input_interface`: the input interface of the flow- `output_interface`: the output interface of the flow- `subflows_config`: the configuration of the subflows<a id="CtrlExMem_CoderFlow.CtrlExMem_CoderFlow.detect_finish_or_continue"></a>#### detect\_finish\_or\_continue```python@CircularFlow.output_msg_payload_processordef detect_finish_or_continue(output_payload: Dict[str, Any],src_flow) -> Dict[str, Any]```This method is called when the flow receives a message from a subflow.This method will check the message and decide whether the flow should continue or finish.**Arguments**:- `output_payload`: the output payload of the subflow- `src_flow`: the source flow of the message**Returns**:`Dict[str, Any]`: the output payload of the flow<a id="run_coder"></a># run\_coder10 unmodified linesclass Planner_CoderFlow(PlanWriterFlow)```Planner of the coder flow, it inherits from PlanWriterFlow, see: https://huggingface.co/aiflows/PlanWriterFlowModuleThis flow is responsible for generating the plan for the coder flow.*Input Interface*- `goal`- `memory_files`- `code_library`*Output Interface*- `plan`- `summary`- `status`*Configuration Parameters*:- Look at the configuration parameters of PlanWriterFlowModule for detailed info. (https://huggingface.co/aiflows/PlanWriterFlowModule)- `input_interface`: the input interface of the flow, default: `["goal", "memory_files", "code_library"]`- `output_interface`: the output interface of the flow, default: `["plan", "summary", "status"]`- `subflows_config`: configuration of the subflows.- `topology`: topology of the subflows.<a id="Controller_CoderFlow"></a>7 unmodified linesclass Controller_CoderFlow(ChatAtomicFlow)```Refer to: https://huggingface.co/aiflows/JarvisFlowModule/blob/main/Controller_JarvisFlow.pyThis flow is used to control the coder flow.*Input Interface Non Initialized*:- `goal`- `plan`- `code_library`- `logs`- `memory_files`*Input Interface Initialized*:- `goal`- `plan`- `code_library`- `logs`- `memory_files`- `result`*Output Interface*:- `command`- `command_args`*Configuration Parameters*:- `Input Interface Non Initialized`: Input interface before the conversation is initialized.- `Input Interface Initialized`: Input interface after the conversation is initialized.- `Output Interface`: Output interface.- `backend`: The backend of the LLM.- `command`: A list of available commands for the controller to call.- `system_message_prompt_template`: The template of the system message prompt.- `init_human_message_prompt_template`: The template of the initial human message prompt.- `human_message_prompt_template`: The template of the human message prompt.- `previous_messages`: The sliding window of previous messages.<a id="Controller_CoderFlow.Controller_CoderFlow.__init__"></a>#### \_\_init\_\_```pythondef __init__(commands: List[Command], **kwargs)```Initialize the flow.**Arguments**:- `commands` (`List[Command]`): A list of available commands for the controller to call.- `kwargs` (`Dict[str, Any]`): Refer to the configuration parameters.<a id="Controller_CoderFlow.Controller_CoderFlow.instantiate_from_config"></a>#### instantiate\_from\_config```python@classmethoddef instantiate_from_config(cls, config)```Instantiate the flow from the configuration.**Arguments**:- `config` (`Dict[str, Any]`): The configuration.**Returns**:`Controller_CoderFlow`: The instantiated flow.<a id="Controller_CoderFlow.Controller_CoderFlow.run"></a>#### run```pythondef run(input_data: Dict[str, Any]) -> Dict[str, Any]```Run the flow.**Arguments**:- `input_data` (`Dict[str, Any]`): The input data.**Returns**:`Dict[str, Any]`: The output data.<a id="UpdatePlanAtomicFlow"></a>17 unmodified lines*Output Interface*- `result`: the result of the update plan operation*Configuration Parameters*:- `input_interface`: the input interface of the flow, default: `["updated_plan"]`- `output_interface`: the output interface of the flow, default: `["result"]`<a id="UpdatePlanAtomicFlow.UpdatePlanAtomicFlow.run"></a>#### run```pythondef run(input_data: Dict[str, Any])```The run function of the flow.**Arguments**:- `input_data` (`Dict[str, Any]`): the input data to the flow**Returns**:`Dict[str, Any]`: the output data of the flow<a id="CoderFlow"></a># CoderFlow21 unmodified lines- `result` (str): The result of the flow, the result will be returned to the caller (i.e. JarvisFlow).- `summary` (str): The summary of the flow, the summary will be logged into the logs of the caller flow (i.e. JarvisFlow).*Configuration Parameters*: (Also see super class: AbstractBossFlow)- `memory_files` (dict): The memory files of the flow. The memory files are the files that the flow reads and writes. Typically it should contain plan, logs, and code_library.Typical workflow of Coder:0. JarvisFlow calls Coder with a goal.1. MemoryReading reads plans, logs and code library.
12346 unmodified lines11121314151617181920212213 unmodified lines3637383940#TODO: generalize updateplanatomicflow with the one in extendlibraryfrom typing import Dict, Anyfrom aiflows.base_flows.atomic import AtomicFlowclass UpdatePlanAtomicFlow(AtomicFlow):6 unmodified lines*Output Interface*- `result`: the result of the update plan operation"""def _check_input(self, input_data: Dict[str, Any]):assert "memory_files" in input_data, "memory_files not passed to UpdatePlanAtomicFlow.yaml"assert "plan" in input_data["memory_files"], "plan not in memory_files"def _call(self, input_data: Dict[str, Any]):try:plan_file_location = input_data["memory_files"]["plan"]plan_to_write = input_data["updated_plan"]13 unmodified linesself,input_data: Dict[str, Any]):self._check_input(input_data)return self._call(input_data)1236 unmodified lines101112131415161718192021222324252627282930313233343536373813 unmodified lines5253545556575859606162from typing import Dict, Anyfrom aiflows.base_flows.atomic import AtomicFlowclass UpdatePlanAtomicFlow(AtomicFlow):6 unmodified lines*Output Interface*- `result`: the result of the update plan operation*Configuration Parameters*:- `input_interface`: the input interface of the flow, default: `["updated_plan"]`- `output_interface`: the output interface of the flow, default: `["result"]`"""def _check_input(self, input_data: Dict[str, Any]):"""Check if the input data is valid.:param input_data: the input data to the flow:type input_data: Dict[str, Any]:raises AssertionError: if the input data is not valid:raises AssertionError: if the input data does not contain the required keys"""assert "memory_files" in input_data, "memory_files not passed to UpdatePlanAtomicFlow.yaml"assert "plan" in input_data["memory_files"], "plan not in memory_files"def _call(self, input_data: Dict[str, Any]):"""The main function of the flow.:param input_data: the input data to the flow:type input_data: Dict[str, Any]:return: the output data of the flow:rtype: Dict[str, Any]"""try:plan_file_location = input_data["memory_files"]["plan"]plan_to_write = input_data["updated_plan"]13 unmodified linesself,input_data: Dict[str, Any]):"""The run function of the flow.:param input_data: the input data to the flow:type input_data: Dict[str, Any]:return: the output data of the flow:rtype: Dict[str, Any]"""self._check_input(input_data)return self._call(input_data)
CoderFlow.py+4
Controller_CoderFlow.py+83-1
CtrlExMem_CoderFlow.py+17-2
Planner_CoderFlow.py+19-1
README.md+189-23
UpdatePlanAtomicFlow.py+23-1