notice

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

rasa.cli.utils

get_validated_path

get_validated_path(current: Optional[Text], parameter: Text, default: Optional[Text] = None, none_is_valid: bool = False) -> Optional[Text]

Check whether a file path or its default value is valid and returns it.

Arguments:

  • current - The parsed value.
  • parameter - The name of the parameter.
  • default - The default value of the parameter.
  • none_is_valid - True if None is valid value for the path, else `False``

Returns:

The current value if it was valid, else the default value of the argument if it is valid, else None.

cancel_cause_not_found

cancel_cause_not_found(current: Optional[Text], parameter: Text, default: Optional[Text]) -> None

Exits with an error because the given path was not valid.

Arguments:

  • current - The path given by the user.
  • parameter - The name of the parameter.
  • default - The default value of the parameter.

parse_last_positional_argument_as_model_path

parse_last_positional_argument_as_model_path() -> None

Fixes the parsing of a potential positional model path argument.

create_output_path

create_output_path(output_path: Text = DEFAULT_MODELS_PATH, prefix: Text = "", fixed_name: Optional[Text] = None) -> Text

Creates an output path which includes the current timestamp.

Arguments:

  • output_path - The path where the model should be stored.
  • fixed_name - Name of the model.
  • prefix - A prefix which should be included in the output path.

Returns:

The generated output path, e.g. "20191201-103002.tar.gz".

button_to_string

button_to_string(button: Dict[Text, Any], idx: int = 0) -> Text

Create a string representation of a button.

element_to_string

element_to_string(element: Dict[Text, Any], idx: int = 0) -> Text

Create a string representation of an element.

button_choices_from_message_data

button_choices_from_message_data(message: Dict[Text, Any], allow_free_text_input: bool = True) -> List[Text]

Return list of choices to present to the user.

If allow_free_text_input is True, an additional option is added at the end along with the response buttons that allows the user to type in free text.

payload_from_button_question

payload_from_button_question(button_question: "Question") -> Text

Prompt user with a button question and returns the nlu payload.

signal_handler

signal_handler(_: int, __: FrameType) -> None

Kills Rasa when OS signal is received.