-
Notifications
You must be signed in to change notification settings - Fork 12
The conversation
In most chatbots, you can think of the conversation as a set of states. Each state represents a specific point in conversation, e.g. you might have states for greeting, telling a joke, recommending restaurants and so on. Take a look at this picture: (TODO picture)
Golem provides a dialog manager that makes it easy to define and move between these states. We further group states by the conversation topic into so-called flows, which you can use to split your bot into smaller independent packages.
Each state consists of:
- a unique name, in format "flow.state"
- an action that will be run when the state is activated
- (optional) requirements of the action
The conversation begins in a flow called default. Each flow starts in the root state. Whenever a message with intent greeting is received, the bot moves to the greeting.root state.
Each action can either be a hardcoded message sent to the user, or a python function. This function must take one parameter - dialog (more on that later).
The bot moves between states when:
- the extracted intent or entity matches one of flows
- you set the next parameter or you return a state name from an action
Flows and states can either be defined directly in Python, or using the YAML (/JSON) markup language.
For example:
greeting:
- name: root
action:
text: "Hello there!"
next: "greeting.help:"
- name: help
action: actions.custom_function
You also need to register the flow in the BOTS
section of GOLEM_CONFIG
, as shown on the previous page. This way, you can easily enable and disable modules of your chatbot using the config file.
You can continue to Conversations in YAML or TODO.