notice

This is unreleased documentation for Rasa Open Source Documentation Master/Unreleased version.
For the latest released documentation, see the latest version (2.x).

Version: Master/Unreleased

rasa.core.policies.rule_policy

InvalidRule Objects

class InvalidRule(RasaException)

Exception that can be raised when rules are not valid.

RulePolicyGraphComponent Objects

class RulePolicyGraphComponent(MemoizationPolicyGraphComponent)

Policy which handles all the rules.

supported_data

@staticmethod
def supported_data() -> SupportedData

The type of data supported by this policy.

Returns:

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

get_default_config

@staticmethod
def get_default_config() -> Dict[Text, Any]

Returns the default config (see parent class for full docstring).

__init__

def __init__(config: Dict[Text, Any], model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext, featurizer: Optional[TrackerFeaturizer] = None, lookup: Optional[Dict] = None) -> None

Initializes the policy.

raise_if_incompatible_with_domain

@classmethod
def raise_if_incompatible_with_domain(cls, config: Dict[Text, Any], domain: Domain) -> None

Checks whether the domains action names match the configured fallback.

Arguments:

  • config - configuration of a RulePolicy
  • domain - a domain

Raises:

InvalidDomain if this policy is incompatible with the domain

train

def train(training_trackers: List[TrackerWithCachedStates], domain: Domain, **kwargs: Any, ,) -> Resource

Trains the policy on given training trackers.

Arguments:

  • training_trackers - The list of the trackers.
  • domain - The domain.

Returns:

The resource which can be used to load the trained policy.

predict_action_probabilities

def predict_action_probabilities(tracker: DialogueStateTracker, domain: Domain, rule_only_data: Optional[Dict[Text, Any]] = None, **kwargs: Any, ,) -> "PolicyPrediction"

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

persist

def persist() -> None

Persists trained RulePolicy.