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

Version: Main/Unreleased


RankingCandidateMetadata Objects

class RankingCandidateMetadata()

Dataclass to represent metada for a candidate intent.

UnexpecTEDIntentPolicyMetadata Objects

class UnexpecTEDIntentPolicyMetadata()

Dataclass to represent policy metadata.

UnexpecTEDIntentPolicy Objects

DefaultV1Recipe.ComponentType.POLICY_WITH_END_TO_END_SUPPORT, is_trainable=True
class UnexpecTEDIntentPolicy(TEDPolicy)

UnexpecTEDIntentPolicy has the same model architecture as TEDPolicy.

The difference is at a task level. Instead of predicting the next probable action, this policy predicts whether the last predicted intent is a likely intent according to the training stories and conversation context.


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

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


def __init__(config: Dict[Text, Any],
model_storage: ModelStorage,
resource: Resource,
execution_context: ExecutionContext,
model: Optional[RasaModel] = None,
featurizer: Optional[TrackerFeaturizer] = None,
fake_features: Optional[Dict[Text, List[Features]]] = None,
entity_tag_specs: Optional[List[EntityTagSpec]] = None,
label_quantiles: Optional[Dict[int, List[float]]] = None)

Declares instance variables with default values.


def model_class() -> Type["IntentTED"]

Gets the class of the model architecture to be used by the policy.


Required class.


def compute_label_quantiles_post_training(model_data: RasaModelData,
label_ids: np.ndarray) -> None

Computes quantile scores for prediction of action_unlikely_intent.

Multiple quantiles are computed for each label so that an appropriate threshold can be picked at inference time according to the tolerance value specified.


  • model_data - Data used for training the model.
  • label_ids - Numerical IDs of labels for each data point used during training.


def run_training(model_data: RasaModelData,
label_ids: Optional[np.ndarray] = None) -> None

Feeds the featurized training data to the model.


  • model_data - Featurized training data.
  • label_ids - Label ids corresponding to the data points in model_data.


RasaCoreException if label_ids is None as it's needed for running post training procedures.


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

Predicts the next action the bot should take after seeing the tracker.


  • tracker - Tracker containing past conversation events.
  • domain - Domain of the assistant.
  • rule_only_data - Slots and loops which are specific to rules and hence should be ignored by this policy.
  • precomputations - Contains precomputed features and attributes.


The policy's prediction (e.g. the probabilities for the actions).


def persist_model_utilities(model_path: Path) -> None

Persists model's utility attributes like model weights, etc.


  • model_path - Path where model is to be persisted

IntentTED Objects

class IntentTED(TED)

Follows TED's model architecture from

However, it has been re-purposed to predict multiple labels (intents) instead of a single label (action).


def dot_product_loss_layer() -> tf.keras.layers.Layer

Returns the dot-product loss layer to use.

Multiple intents can be valid simultaneously, so IntentTED uses the MultiLabelDotProductLoss.


The loss layer that is used by _prepare_dot_product_loss.


def run_bulk_inference(
model_data: RasaModelData
) -> Dict[Text, Union[np.ndarray, Dict[Text, Any]]]

Computes model's predictions for input data.


  • model_data - Data to be passed as input


Predictions for the input data.