This is documentation for Rasa Documentation v2.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (3.x).

Version: 2.x


InvalidRule Objects

class InvalidRule(RasaException)

Exception that can be raised when rules are not valid.

RulePolicy Objects

class RulePolicy(MemoizationPolicy)

Policy which handles all the rules


| @staticmethod
| supported_data() -> SupportedData

The type of data supported by this policy.


The data type supported by this policy (ML and rule data).


| __init__(featurizer: Optional[TrackerFeaturizer] = None, priority: int = RULE_POLICY_PRIORITY, lookup: Optional[Dict] = None, core_fallback_threshold: float = DEFAULT_CORE_FALLBACK_THRESHOLD, core_fallback_action_name: Text = ACTION_DEFAULT_FALLBACK_NAME, enable_fallback_prediction: bool = True, restrict_rules: bool = True, check_for_contradictions: bool = True, **kwargs: Any, ,) -> None

Create a RulePolicy object.


  • featurizer - Featurizer which is used to convert conversation states to features.
  • priority - Priority of the policy which is used if multiple policies predict actions with the same confidence.
  • lookup - Lookup table which is used to pick matching rules for a conversation state.
  • core_fallback_threshold - Confidence of the prediction if no rule matched and de-facto threshold for a core fallback.
  • core_fallback_action_name - Name of the action which should be predicted if no rule matched.
  • enable_fallback_prediction - If True core_fallback_action_name is predicted in case no rule matched.
  • restrict_rules - If True rules are restricted to contain a maximum of 1 user message. This is used to avoid that users build a state machine using the rules.
  • check_for_contradictions - Check for contradictions.


| train(training_trackers: List[TrackerWithCachedStates], domain: Domain, interpreter: NaturalLanguageInterpreter, **kwargs: Any, ,) -> None

Trains the policy on given training trackers.


  • training_trackers - The list of the trackers.
  • domain - The domain.
  • interpreter - Interpreter which can be used by the polices for featurization.


| predict_action_probabilities(tracker: DialogueStateTracker, domain: Domain, interpreter: NaturalLanguageInterpreter, **kwargs: Any, ,) -> "PolicyPrediction"

Predicts the next action (see parent class for more information).


| get_rule_only_data() -> Dict[Text, Any]

Gets the slots and loops that are used only in rule data.


Slots and loops that are used only in rule data.