Table of Contents
- Structure of PlanWriterFlow
- run_planwriter
- PlanWriterAskUserFlow
- PlanWriterFlow
- __init__
- PlanWriterCtrlFlow
Structure of PlanWriterFlow
goal
|
v
+---------------+
| Controller | --------<<<<-----------+
+---------------+ |
| |
| (command, command args) |
| |
v |
+------------------+ |
| Executor | Each branch is an |
| (Tree Structure) | executor |
+------------------+ |
| ^
| (summary) |
| |
v |
| |
+-> goes back to the Controller>-+
Structure of the Executors:
+-------------------+
| Branching |
| Executor |
+-------------------+
/ \
/ \
/ \
/ \
write_plan ask_user
About the branches:
- ask_user: Ask user for info / confirmation, etc.
- write_plan: Generates plan (user edit is allowed) and fetches user feedback.
How it works: Controller calls write_plan until user is satisfied in the feedback, finish.
run_planwriter
PlanWriterAskUserFlow
PlanWriterAskUserFlow Objects
class PlanWriterAskUserFlow(HumanStandardInputFlow)
Refer to: https://huggingface.co/aiflows/ExtendLibraryFlowModule/blob/main/ExtLibAskUserFlow.py This flow is used to ask the user a question and get a response.
Input Interface:
question
Output Interface:
feedbackplan
Configuration Parameters:
query_message_prompt_template: The message template to prompt the user for input.request_multi_line_input_flag: Whether to request multi-line input from the user.end_of_input_string: The string to enter to indicate the end of input.
run
def run(input_data: Dict[str, Any]) -> Dict[str, Any]
Run the flow module.
Arguments:
input_data(Dict[str, Any]): The input data to the flow module.
Returns:
Dict[str, Any]: The output data from the flow module.
PlanWriterFlow
PlanWriterFlow Objects
class PlanWriterFlow(ContentWriterFlow)
This flow inherits from ContentWriterFlow. In the subflow of the executor, we specify the InteractivePlanGenFlow (https://huggingface.co/aiflows/InteractivePlanGenFlowModule)
Input Interface:
goal
Output Interface:
planresultsummarystatus
Configuration Parameters:
- Also refer to superclass ContentWriterFlow (https://huggingface.co/aiflows/ContentWriterFlowModule)
input_interface: the input interface of the flowoutput_interface: the output interface of the flowsubflows_config: the configuration of the subflowsearly_exit_key: the key in the flow state that indicates the early exit conditiontopology: the topology of the flow
detect_finish_or_continue
@CircularFlow.output_msg_payload_processor
def detect_finish_or_continue(output_payload: Dict[str, Any],
src_flow) -> Dict[str, Any]
This function is called when the subflow finishes running.
configured in the topology of the subflow config.
Arguments:
output_payload(Dict[str, Any]): the output payload of the subflowsrc_flow(Flow): the subflow that generates the output payload
Returns:
Dict[str, Any]: the processed output payload
run
def run(input_data: Dict[str, Any]) -> Dict[str, Any]
This function runs the flow.
Arguments:
input_data(Dict[str, Any]): the input data of the flow
Returns:
Dict[str, Any]: the output data of the flow
__init__
PlanWriterCtrlFlow
PlanWriterCtrlFlow Objects
class PlanWriterCtrlFlow(ChatAtomicFlow)
Refer to: https://huggingface.co/aiflows/JarvisFlowModule/blob/main/Controller_JarvisFlow.py This flow is a controller flow that controls the PlanWriterFlow.
Input Interface Non Initialized:
goal: str
Input Interface Initialized:
feedback: strgoal: strplan: str
Output Interface:
command: strcommand_args: Dict[str, Any]
Configuration Parameters:
input_interface_non_initialized: List[str] = ["goal"]input_interface_initialized: List[str] = ["feedback", "goal", "plan"]output_interface: List[str] = ["command", "command_args"]backend: Dict[str, Any] : backend of the LLMcommands: List[Dict[str, Any]] : commands that the LLM can executesystem_message_prompt_template: str : the template of the system message promptinit_human_message_prompt_template: str : the template of the initial human message prompthuman_message_prompt_template: str : the template of the human message promptprevious_messages: Dict[str, Any] : the previous messages of the conversation (sliding window)
__init__
def __init__(commands: List[Command], **kwargs)
This function initializes the flow.
Arguments:
commands(List[Command]): List[Command] : commands that the LLM can executekwargs(Dict[str, Any]): other parameters
instantiate_from_config
@classmethod
def instantiate_from_config(cls, config)
This function instantiates the flow from the config.
Arguments:
config(Dict[str, Any]): the config of the flow
Returns:
ChatAtomicFlow: the instantiated flow
run
def run(input_data: Dict[str, Any]) -> Dict[str, Any]
This function runs the flow.
Arguments:
input_data(Dict[str, Any]): the input data
Returns:
Dict[str, Any]: the output of the flow