rasa.core.events
deserialise_events
Convert a list of dictionaries to a list of corresponding events.
Example format: [{"event": "slot", "value": 5, "name": "my_slot"}]
md_format_message
Uses NLU parser information to generate a message with inline entity annotations.
Arguments:
text
- text of the messageintent
- intent of the messageentities
- entities of the message
Returns:
Message with entities annotated inline, e.g.
I am from [Berlin]{"entity": "city"}
.
Event Objects
Events describe everything that occurs in
a conversation and tell the :class:rasa.core.trackers.DialogueStateTracker
how to update its state.
resolve_by_type
Returns a slots class by its type name.
UserUttered Objects
The user has said something to the bot.
As a side effect a new Turn
will be created in the Tracker
.
as_sub_state
Turns a UserUttered event into a substate containing information about entities, intent and text of the UserUttered
Returns:
a dictionary with intent name, text and entities
BotUttered Objects
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 the Tracker
.
message
Return the complete message as a dictionary.
SlotSet Objects
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
that tracker.slots[key]=value
.
Restarted Objects
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).
UserUtteranceReverted Objects
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.
AllSlotsReset Objects
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.
ReminderScheduled Objects
Schedules the asynchronous triggering of a user intent (with entities if needed) at a given time.
__init__
Creates the reminder
Arguments:
intent
- Name of the intent to be triggered.trigger_date_time
- Date at which the execution of the action should be triggered (either utc or with tz).name
- ID of the reminder. If there are multiple reminders with the same id only the last will be run.entities
- Entities that should be supplied together with the triggered intent.kill_on_user_message
-True
means a user message before the trigger date will abort the reminder.timestamp
- Creation date of the event.metadata
- Optional event metadata.
ReminderCancelled Objects
Cancel certain jobs.
__init__
Creates a ReminderCancelled event.
If all arguments are None
, this will cancel all reminders.
are to be cancelled. If no arguments are supplied, this will cancel all reminders.
Arguments:
name
- Name of the reminder to be cancelled.intent
- Intent name that is to be used to identify the reminders to be cancelled.entities
- Entities that are to be used to identify the reminders to be cancelled.timestamp
- Optional timestamp.metadata
- Optional event metadata.
cancels_job_with_name
Determines if this ReminderCancelled
event should cancel the job with the given name.
Arguments:
job_name
- Name of the job to be tested.sender_id
- Thesender_id
of the tracker.
Returns:
True
, if this ReminderCancelled
event should cancel the job with the given name,
and False
otherwise.
ActionReverted Objects
Bot undoes its last action.
The bot reverts 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.
StoryExported Objects
Story should get dumped to a file.
FollowupAction Objects
Enqueue a followup action.
ConversationPaused Objects
Ignore messages from the user to let a human take over.
As a side effect the Tracker
's paused
attribute will
be set to True
.
ConversationResumed Objects
Bot takes over conversation.
Inverse of PauseConversation
. As a side effect the Tracker
's
paused
attribute will be set to False
.
ActionExecuted Objects
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
Tracker.turns`.
as_sub_state
Turns ActionExecuted into a dictionary containing action name or action text. One action cannot have both set at the same time
Returns:
a dictionary containing action name or action text with the corresponding key
AgentUttered Objects
The agent 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 the Tracker
.
ActiveLoop Objects
If name
is not None: activates a loop with name
else deactivates active loop.
LegacyForm Objects
Legacy handler of old Form
events.
The ActiveLoop
event used to be called Form
. This class is there to handle old
legacy events which were stored with the old type name form
.
FormValidation Objects
Event added by FormPolicy and RulePolicy to notify form action whether or not to validate the user input.
ActionExecutionRejected Objects
Notify Core that the execution of the action has been rejected
SessionStarted Objects
Mark the beginning of a new conversation session.