Dialogue State Tracker

The tracker stores and maintains the state of the dialogue with a single user. It is stored in a tracker store, retrieved when incoming messages for the conversation are received and updated after actions have been executed

Here we go:

class rasa_core.trackers.DialogueStateTracker(sender_id, slots, max_event_history=None)[source]

Bases: object

Maintains the state of a conversation.

applied_events()[source]

Returns all actions that should be applied - w/o reverted events.

as_dialogue()[source]

Return a Dialogue object containing all of the turns.

This can be serialised and later used to recover the state of this tracker exactly.

clear_follow_up_action()[source]

Clears follow up action when it was executed

copy()[source]

Creates a duplicate of this tracker

current_slot_values()[source]

Return the currently set values of the slots

current_state(should_include_events=False, only_events_after_latest_restart=False)[source]

Return the current tracker state as an object.

events_after_latest_restart()[source]

Return a list of events after the most recent restart.

export_stories()[source]

Dump the tracker as a story in the Rasa Core story format.

Returns the dumped tracker as a string.

export_stories_to_file(export_path=u'debug.md')[source]

Dump the tracker as a story to a file.

classmethod from_dict(sender_id, dump_as_dict, domain)[source]

Create a tracker from dump.

The dump should be an array of dumped events. When restoring the tracker, these events will be replayed to recreate the state.

generate_all_prior_trackers()[source]

Returns a generator of the previous trackers of this tracker.

The resulting array is representing the trackers before each action.

get_latest_entity_values(entity_type)[source]

Get entity values found for the passed entity name in latest msg.

If you are only interested in the first entity of a given type use next(tracker.get_latest_entity_values(“my_entity_name”), None). If no entity is found None is the default result.

get_slot(key)[source]

Retrieves the value of a slot.

idx_after_latest_restart()[source]

Return the idx of the most recent restart in the list of events.

If the conversation has not been restarted, 0 is returned.

init_copy()[source]

Creates a new state tracker with the same initial values.

is_paused()[source]

State whether the tracker is currently paused.

past_states(domain)[source]

Generate the past states of this tracker based on the history.

recreate_from_dialogue(dialogue)[source]

Use a serialised Dialogue to update the trackers state.

This uses the state as is persisted in a TrackerStore. If the tracker is blank before calling this method, the final state will be identical to the tracker from which the dialogue was created.

replay_events()[source]

Update the tracker based on a list of events.

travel_back_in_time(target_time)[source]

Creates a new tracker with a state at a specific timestamp.

A new tracker will be created and all events previous to the passed time stamp will be replayed. Events that occur exactly at the target time will be included.

trigger_follow_up_action(action)[source]

Triggers another action following the execution of the current.

update(event)[source]

Modify the state of the tracker according to an Event.