Events¶
List of all the events the dialogue system is able to handle and supports.
An event can be referenced by its type_name
attribute (e.g. when returning
events in an http callback).
Contents
The Event base class¶
-
class
rasa_core.events.
Event
(timestamp=None)[source]¶ Events describe everything that occurs in a conversation and tell the
rasa_core.trackers.DialogueStateTracker
how to update its state.
Events for Actions to Return¶
SlotSet¶
-
class
rasa_core.events.
SlotSet
(key, value=None, timestamp=None)[source]¶ The user has specified their preference for the value of a
slot
.Every slot has a name and a value. This event can be used to set a value for a slot on a conversation.
As a side effect the
Tracker
’s slots will be updated so thattracker.slots[key]=value
.
def apply_to(self, tracker):
tracker._set_slot(self.key, self.value)
Restarted¶
-
class
rasa_core.events.
Restarted
(timestamp=None)[source]¶ Conversation should start over & history wiped.
Instead of deleting all events, this event can be used to reset the trackers state (e.g. ignoring any past user messages & resetting all the slots).
def apply_to(self, tracker):
from rasa_core.actions.action import ActionListen
tracker._reset()
tracker.follow_up_action = ActionListen()
AllSlotsReset¶
-
class
rasa_core.events.
AllSlotsReset
(timestamp=None)[source]¶ All Slots are reset to their initial values.
If you want to keep the dialogue history and only want to reset the slots, you can use this event to set all the slots to their initial values.
def apply_to(self, tracker):
tracker._reset_slots()
ConversationPaused¶
-
class
rasa_core.events.
ConversationPaused
(timestamp=None)[source]¶ Ignore messages from the user to let a human take over.
As a side effect the
Tracker
’spaused
attribute will be set toTrue
.
def apply_to(self, tracker):
tracker._paused = True
ConversationResumed¶
-
class
rasa_core.events.
ConversationResumed
(timestamp=None)[source]¶ Bot takes over conversation.
Inverse of
PauseConversation
. As a side effect theTracker
’spaused
attribute will be set toFalse
.
def apply_to(self, tracker):
tracker._paused = False
Automatically tracked events¶
UserUttered¶
-
class
rasa_core.events.
UserUttered
(text, intent=None, entities=None, parse_data=None, timestamp=None, input_channel=None, message_id=None)[source]¶ The user has said something to the bot.
As a side effect a new
Turn
will be created in theTracker
.
def apply_to(self, tracker):
# type: (DialogueStateTracker) -> None
tracker.latest_message = self
BotUttered¶
-
class
rasa_core.events.
BotUttered
(text=None, data=None, timestamp=None)[source]¶ The bot has said something to the user.
This class is not used in the story training as it is contained in the
ActionExecuted
class. An entry is made in theTracker
.
def apply_to(self, tracker):
# type: (DialogueStateTracker) -> None
tracker.latest_bot_utterance = self
UserutteranceReverted¶
-
class
rasa_core.events.
UserUtteranceReverted
(timestamp=None)[source]¶ Bot reverts everything until before the most recent user message.
The bot will revert all events after the latest UserUttered, this also means that the last event on the tracker is usually action_listen and the bot is waiting for a new user message.
def apply_to(self, tracker):
# type: (DialogueStateTracker) -> None
tracker._reset()
tracker.replay_events()
ActionReverted¶
-
class
rasa_core.events.
ActionReverted
(timestamp=None)[source]¶ Bot undoes its last action.
The bot everts everything until before the most recent action. This includes the action itself, as well as any events that action created, like set slot events - the bot will now predict a new action using the state before the most recent action.
def apply_to(self, tracker):
# type: (DialogueStateTracker) -> None
tracker._reset()
tracker.replay_events()
ActionExecuted¶
-
class
rasa_core.events.
ActionExecuted
(action_name, policy=None, confidence=None, timestamp=None)[source]¶ An operation describes an action taken + its result.
It comprises an action and a list of events. operations will be appended to the latest
Turn
in theTracker.turns
.
def apply_to(self, tracker):
# type: (DialogueStateTracker) -> None
tracker.latest_action_name = self.action_name