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

Version: 2.3.x


ResponseSelector Objects

class ResponseSelector(DIETClassifier)

Response selector using supervised embeddings.

The response selector embeds user inputs and candidate response into the same space. Supervised embeddings are trained by maximizing similarity between them. It also provides rankings of the response that did not "win".

The supervised response selector needs to be preceded by a featurizer in the pipeline. This featurizer creates the features used for the embeddings. It is recommended to use CountVectorsFeaturizer that can be optionally preceded by SpacyNLP and SpacyTokenizer.

Based on the starspace idea from: However, in this implementation the mu parameter is treated differently and additional hidden layers are added together with dropout.


| __init__(component_config: Optional[Dict[Text, Any]] = None, index_label_id_mapping: Optional[Dict[int, Text]] = None, entity_tag_specs: Optional[List[EntityTagSpec]] = None, model: Optional[RasaModel] = None, all_retrieval_intents: Optional[List[Text]] = None, responses: Optional[Dict[Text, List[Dict[Text, Any]]]] = None, finetune_mode: bool = False) -> None

Declare instance variables with default values.


  • component_config - Configuration for the component.
  • index_label_id_mapping - Mapping between label and index used for encoding.
  • entity_tag_specs - Format specification all entity tags.
  • model - Model architecture.
  • all_retrieval_intents - All retrieval intents defined in the data.
  • responses - All responses defined in the data.
  • finetune_mode - If True loads the model with pre-trained weights, otherwise initializes it with random weights.


| preprocess_train_data(training_data: TrainingData) -> RasaModelData

Prepares data for training.

Performs sanity checks on training data, extracts encodings for labels.


  • training_data - training data to preprocessed.


| process(message: Message, **kwargs: Any) -> None

Return the most likely response, the associated intent_response_key and its similarity to the input.


| persist(file_name: Text, model_dir: Text) -> Dict[Text, Any]

Persist this model into the passed directory.

Return the metadata necessary to load the model again.


| @classmethod
| load(cls, meta: Dict[Text, Any], model_dir: Text = None, model_metadata: Metadata = None, cached_component: Optional["ResponseSelector"] = None, **kwargs: Any, ,) -> "ResponseSelector"

Loads the trained model from the provided directory.



Diet 2 Diet transformer implementation.