This is unreleased documentation for Rasa Documentation Main/Unreleased version.
For the latest released documentation, see the latest version (3.x).

Version: Main/Unreleased


TrackerWithCachedStates Objects

class TrackerWithCachedStates(DialogueStateTracker)

A tracker wrapper that caches the state creation of the tracker.


def __init__(sender_id: Text,
slots: Optional[Iterable[Slot]],
max_event_history: Optional[int] = None,
domain: Optional[Domain] = None,
is_augmented: bool = False,
is_rule_tracker: bool = False) -> None

Initializes a tracker with cached states.


def from_events(cls,
sender_id: Text,
evts: List[Event],
slots: Optional[Iterable[Slot]] = None,
max_event_history: Optional[int] = None,
sender_source: Optional[Text] = None,
domain: Optional[Domain] = None,
is_rule_tracker: bool = False) -> "TrackerWithCachedStates"

Initializes a tracker with given events.


def past_states_for_hashing(domain: Domain,
omit_unset_slots: bool = False
) -> Deque[FrozenState]

Generates and caches the past states of this tracker based on the history.


  • domain - a :class:rasa.shared.core.domain.Domain
  • omit_unset_slots - If True do not include the initial values of slots.


A list of states


def past_states(
domain: Domain,
omit_unset_slots: bool = False,
ignore_rule_only_turns: bool = False,
rule_only_data: Optional[Dict[Text, Any]] = None) -> List[State]

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


  • domain - The Domain.
  • omit_unset_slots - If True do not include the initial values of slots.
  • ignore_rule_only_turns - If True ignore dialogue turns that are present only in rules.
  • rule_only_data - Slots and loops, which only occur in rules but not in stories.


a list of states


def clear_states() -> None

Reset the states.


def init_copy() -> "TrackerWithCachedStates"

Create a new state tracker with the same initial values.


def copy(sender_id: Text = "",
sender_source: Text = "") -> "TrackerWithCachedStates"

Creates a duplicate of this tracker.

A new tracker will be created and all events will be replayed.


def update(event: Event, domain: Optional[Domain] = None) -> None

Modify the state of the tracker according to an Event.

TrainingDataGenerator Objects

class TrainingDataGenerator()

Generates trackers from training data.


def __init__(story_graph: StoryGraph,
domain: Domain,
remove_duplicates: bool = True,
unique_last_num_states: Optional[int] = None,
augmentation_factor: int = 50,
tracker_limit: Optional[int] = None,
use_story_concatenation: bool = True,
debug_plots: bool = False)

Given a set of story parts, generates all stories that are possible.

The different story parts can end and start with checkpoints and this generator will match start and end checkpoints to connect complete stories. Afterwards, duplicate stories will be removed and the data is augmented (if augmentation is enabled).


def generate() -> List[TrackerWithCachedStates]

Generate trackers from stories and rules.


The generated trackers.


def generate_story_trackers() -> List[TrackerWithCachedStates]

Generate trackers from stories (exclude rule trackers).


The generated story trackers.