rasa.cli.utils
get_validated_path
Checks 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
ifNone
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
.
missing_config_keys
Checks whether the config file at path
contains the mandatory_keys
.
Arguments:
path
- The path to the config file.mandatory_keys
- A list of mandatory config keys.
Returns:
The list of missing config keys.
validate_assistant_id_in_config
Verifies that the assistant_id key exists and has a unique value in config.
Issues a warning if the key does not exist or has the default value and replaces it with a pseudo-random string value.
validate_config_path
Verifies that the config path exists.
Exit if the config file does not exist.
Arguments:
config
- Path to the config file.default_config
- default config to use if the file atconfig
doesn't exist.Returns
- The path to the config file.
validate_mandatory_config_keys
Get a config from a config file and check if it is valid.
Exit if the config isn't valid.
Arguments:
config
- Path to the config file.mandatory_keys
- The keys that have to be specified in the config file.Returns
- The path to the config file if the config is valid.
get_validated_config
Validates config and returns path to validated config file.
validate_files
Validates either the story structure or the entire project.
Arguments:
fail_on_warnings
-True
if the process should exit with a non-zero statusmax_history
- The max history to use when validating the story structure.importer
- TheTrainingDataImporter
to use to load the training data.stories_only
- IfTrue
, only the story structure is validated.
cancel_cause_not_found
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
Fixes the parsing of a potential positional model path argument.
button_to_string
Create a string representation of a button.
element_to_string
Create a string representation of an element.
button_choices_from_message_data
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
Prompt user with a button question and returns the nlu payload.
signal_handler
Kills Rasa when OS signal is received.