Table of Contents
ChatHumanFlowModule
ChatHumanFlowModule Objects
class ChatHumanFlowModule(CompositeFlow)
This class implements a Chat Human Flow Module. It is a flow that consists of two sub-flows that are executed circularly. It Contains the following subflows:
- A User Flow: A flow makes queries to the Assistant Flow. E.g. The user asks the assistant (LLM) a question.
- A Assistant Flow: A flow that responds to queries made by the User Flow. E.g. The assistant (LLM) answers the user's question.
To end the interaction, the user must type "<END>"
An illustration of the flow is as follows:
|------> User Flow -----------> |
^ |
| |
| v
|<------ Assistant Flow <-------|
Configuration Parameters:
name
(str): The name of the flow. Default: "ChatHumanFlowModule"description
(str): A description of the flow. This description is used to generate the help message of the flow. Default: "Flow that enables chatting between a ChatAtomicFlow and a user providing the input."max_rounds
(int): The maximum number of rounds the flow can run for. Default: None, which means that there is no limit on the number of rounds.early_exit_key
(str): The key that is used to exit the flow. Default: "end_of_interaction"subflows_config
(Dict[str,Any]): A dictionary of subflows configurations. Default:Assistant Flow
: The configuration of the Assistant Flow. By default, it a ChatAtomicFlow. It default parmaters are defined in ChatAtomicFlowModule.User Flow
: The configuration of the User Flow. By default, it a HumanStandardInputFlow. It default parmaters are defined in HumanStandardInputFlowModule.
topology
(str): (List[Dict[str,Any]]): The topology of the flow which is "circular". By default, the topology is the one shown in the illustration above (the topology is also described in ChatHumanFlowModule.yaml).
Input Interface:
- None. By default, the input interface doesn't expect any input.
Output Interface:
end_of_interaction
(bool): Whether the interaction is finished or not.
Arguments:
\**kwargs
(Dict[str, Any]
): Arguments to be passed to the parent class CircularFlow constructor.
set_up_flow_state
def set_up_flow_state()
This method sets up the flow state. It is called when the flow is executed.
type
@classmethod
def type(cls)
This method returns the type of the flow.
max_rounds_reached
def max_rounds_reached()
This method checks if the maximum number of rounds has been reached. If the maximum number of rounds has been reached, it returns True. Otherwise, it returns False.
generate_reply
def generate_reply()
This method generates the reply message. It is called when the interaction is finished.
Arguments:
input_message
(FlowMessage
): The input message to the flow.
call_to_user
def call_to_user(input_message)
This method calls the User Flow. (Human)
Arguments:
input_message
(FlowMessage
): The input message to the flow.
call_to_assistant
def call_to_assistant(input_message)
This method calls the Assistant Flow.
Arguments:
input_message
(FlowMessage
): The input message to the flow.
run
def run(input_message: FlowMessage)
This method runs the flow. It is the main method of the flow and it is called when the flow is executed.
Arguments:
input_message
(FlowMessage
): The input message to the flow.