Esempio n. 1
0
def set_export_arguments(parser: argparse.ArgumentParser) -> None:
    default_arguments.add_endpoint_param(
        parser,
        default=DEFAULT_ENDPOINTS_PATH,
        help_text=("Endpoint configuration file specifying the tracker store "
                   "and event broker."),
    )

    parser.add_argument(
        "--minimum-timestamp",
        type=float,
        help=
        ("Minimum timestamp of events to be exported. The constraint is applied "
         "in a 'greater than or equal' comparison."),
    )

    parser.add_argument(
        "--maximum-timestamp",
        type=float,
        help=("Maximum timestamp of events to be exported. The constraint is "
              "applied in a 'less than' comparison."),
    )

    parser.add_argument(
        "--conversation-ids",
        help=("Comma-separated list of conversation IDs to migrate. If unset, "
              "all available conversation IDs will be exported."),
    )
Esempio n. 2
0
def add_test_core_argument_group(parser: Union[argparse.ArgumentParser,
                                               argparse._ActionsContainer]):
    add_stories_param(parser, "test")
    parser.add_argument("--max-stories",
                        type=int,
                        help="Maximum number of stories to test on.")
    parser.add_argument(
        "--output",
        type=str,
        default="results",
        help="Output path for any files created during the evaluation.",
    )
    parser.add_argument(
        "--e2e",
        "--end-to-end",
        action="store_true",
        help="Run an end-to-end evaluation for combined action and "
        "intent prediction. Requires a story file in end-to-end "
        "format.",
    )
    add_endpoint_param(parser)
    parser.add_argument(
        "--fail-on-prediction-errors",
        action="store_true",
        help="If a prediction error is encountered, an exception "
        "is thrown. This can be used to validate stories during "
        "tests, e.g. on travis.",
    )
    parser.add_argument(
        "--url",
        type=str,
        help="If supplied, downloads a story file from a URL and "
        "trains on it. Fetches the data by sending a GET request "
        "to the supplied URL.",
    )
Esempio n. 3
0
def add_test_core_argument_group(
    parser: Union[argparse.ArgumentParser, argparse._ActionsContainer],
    include_e2e_argument: bool = False,
) -> None:
    add_stories_param(parser, "test")
    parser.add_argument(
        "--max-stories", type=int, help="Maximum number of stories to test on."
    )
    add_out_param(
        parser,
        default=DEFAULT_RESULTS_PATH,
        help_text="Output path for any files created during the evaluation.",
    )
    if include_e2e_argument:
        parser.add_argument(
            "--e2e",
            "--end-to-end",
            action="store_true",
            help="Run an end-to-end evaluation for combined action and "
            "intent prediction. Requires a story file in end-to-end "
            "format.",
        )
    add_endpoint_param(
        parser, help_text="Configuration file for the connectors as a yml file."
    )
    parser.add_argument(
        "--fail-on-prediction-errors",
        action="store_true",
        help="If a prediction error is encountered, an exception "
        "is thrown. This can be used to validate stories during "
        "tests, e.g. on travis.",
    )
    parser.add_argument(
        "--url",
        type=str,
        help="If supplied, downloads a story file from a URL and "
        "trains on it. Fetches the data by sending a GET request "
        "to the supplied URL.",
    )
    parser.add_argument(
        "--evaluate-model-directory",
        default=False,
        action="store_true",
        help="Should be set to evaluate models trained via "
        "'rasa train core --config <config-1> <config-2>'. "
        "All models in the provided directory are evaluated "
        "and compared against each other.",
    )
    add_no_plot_param(parser)
    add_errors_success_params(parser)
Esempio n. 4
0
def set_markers_arguments(parser: argparse.ArgumentParser) -> None:
    """Specifies arguments for `rasa evaluate markers`."""
    parser.add_argument(
        "output_filename",
        type=Path,
        help="The filename to write the extracted markers to (CSV format).",
    )

    parser.add_argument(
        "--config",
        default="markers.yml",
        type=Path,
        help="The marker configuration file(s) containing marker definitions. "
        "This can be a single YAML file, or a directory that contains several "
        "files with marker definitions in it. The content of these files will "
        "be read and merged together.",
    )

    stats = parser.add_mutually_exclusive_group()

    stats.add_argument(
        "--no-stats",
        action="store_false",
        dest="stats",
        help="Do not compute summary statistics.",
    )

    stats.add_argument(
        "--stats-file-prefix",
        default="stats",
        nargs="?",
        type=Path,
        help=
        "The common file prefix of the files where we write out the compute "
        "statistics. More precisely, the file prefix must consist of a common "
        "path plus a common file prefix, to which suffixes `-overall.csv` and "
        "`-per-session.csv` will be added automatically.",
    )

    add_endpoint_param(
        parser,
        help_text="Configuration file for the tracker store as a yml file.",
    )

    add_domain_param(parser)
Esempio n. 5
0
def _add_common_params(parser: argparse.ArgumentParser) -> None:
    parser.add_argument(
        "--skip-visualization",
        default=False,
        action="store_true",
        help="Disable plotting the visualization during interactive learning.",
    )

    parser.add_argument(
        "--conversation-id",
        default=uuid.uuid4().hex,
        help="Specify the id of the conversation the messages are in. Defaults to a "
        "UUID that will be randomly generated.",
    )

    add_endpoint_param(
        parser,
        help_text="Configuration file for the model server and the connectors as a yml file.",
    )
Esempio n. 6
0
def set_interactive_core_arguments(parser: argparse.ArgumentParser):
    add_model_param(parser, model_name="Rasa Core", default=None)
    add_stories_param(parser)

    add_skip_visualization_param(parser)

    add_endpoint_param(
        parser,
        help_text=
        "Configuration file for the model server and the connectors as a yml file.",
    )

    train_arguments = parser.add_argument_group("Train Arguments")
    add_config_param(train_arguments)
    add_domain_param(train_arguments)
    add_out_param(train_arguments)
    add_augmentation_param(train_arguments)
    add_debug_plots_param(train_arguments)
    add_dump_stories_param(train_arguments)
Esempio n. 7
0
def set_interactive_arguments(parser: argparse.ArgumentParser):
    add_model_param(parser, default=None)
    add_data_param(parser)

    add_skip_visualization_param(parser)

    add_endpoint_param(
        parser,
        help_text=
        "Configuration file for the model server and the connectors as a yml file.",
    )

    train_arguments = parser.add_argument_group("Train Arguments")
    add_config_param(train_arguments)
    add_domain_param(train_arguments)
    add_out_param(train_arguments,
                  help_text="Directory where your models should be stored.")
    add_augmentation_param(train_arguments)
    add_debug_plots_param(train_arguments)
    add_dump_stories_param(train_arguments)
    add_force_param(train_arguments)
Esempio n. 8
0
def add_server_arguments(parser: argparse.ArgumentParser) -> None:
    """Add arguments for running API endpoint."""
    parser.add_argument(
        "--log-file",
        type=str,
        # Rasa should not log to a file by default, otherwise there will be problems
        # when running on OpenShift
        default=None,
        help="Store logs in specified file.",
    )
    add_endpoint_param(
        parser,
        help_text=
        "Configuration file for the model server and the connectors as a "
        "yml file.",
    )

    server_arguments = parser.add_argument_group("Server Settings")

    add_interface_argument(server_arguments)

    add_port_argument(server_arguments)

    server_arguments.add_argument(
        "-t",
        "--auth-token",
        type=str,
        help="Enable token based authentication. Requests need to provide "
        "the token to be accepted.",
    )
    server_arguments.add_argument(
        "--cors",
        nargs="*",
        type=str,
        help=
        "Enable CORS for the passed origin. Use * to whitelist all origins.",
    )
    server_arguments.add_argument(
        "--enable-api",
        action="store_true",
        help="Start the web server API in addition to the input channel.",
    )
    server_arguments.add_argument(
        "--response-timeout",
        default=constants.DEFAULT_RESPONSE_TIMEOUT,
        type=int,
        help="Maximum time a response can take to process (sec).",
    )
    server_arguments.add_argument(
        "--remote-storage",
        help=
        "Set the remote location where your Rasa model is stored, e.g. on AWS.",
    )
    server_arguments.add_argument(
        "--ssl-certificate",
        help="Set the SSL Certificate to create a TLS secured server.",
    )
    server_arguments.add_argument(
        "--ssl-keyfile",
        help="Set the SSL Keyfile to create a TLS secured server.")
    server_arguments.add_argument(
        "--ssl-ca-file",
        help="If your SSL certificate needs to be verified, "
        "you can specify the CA file "
        "using this parameter.",
    )
    server_arguments.add_argument(
        "--ssl-password",
        help=
        "If your ssl-keyfile is protected by a password, you can specify it "
        "using this paramer.",
    )

    channel_arguments = parser.add_argument_group("Channels")
    channel_arguments.add_argument(
        "--credentials",
        default=None,
        help="Authentication credentials for the connector as a yml file.",
    )
    channel_arguments.add_argument("--connector",
                                   type=str,
                                   help="Service to connect to.")

    jwt_auth = parser.add_argument_group("JWT Authentication")
    jwt_auth.add_argument(
        "--jwt-secret",
        type=str,
        help="Public key for asymmetric JWT methods or shared secret"
        "for symmetric methods. Please also make sure to use "
        "--jwt-method to select the method of the signature, "
        "otherwise this argument will be ignored."
        "Note that this key is meant for securing the HTTP API.",
    )
    jwt_auth.add_argument(
        "--jwt-method",
        type=str,
        default="HS256",
        help="Method used for the signature of the JWT authentication payload.",
    )
Esempio n. 9
0
def add_server_arguments(parser: argparse.ArgumentParser):
    parser.add_argument(
        "--log-file",
        type=str,
        default="rasa_core.log",
        help="Store logs in specified file.",
    )
    add_endpoint_param(
        parser,
        help_text=
        "Configuration file for the model server and the connectors as a "
        "yml file.",
    )

    server_arguments = parser.add_argument_group("Server Settings")
    server_arguments.add_argument(
        "-p",
        "--port",
        default=constants.DEFAULT_SERVER_PORT,
        type=int,
        help="Port to run the server at.",
    )
    server_arguments.add_argument(
        "-t",
        "--auth-token",
        type=str,
        help="Enable token based authentication. Requests need to provide "
        "the token to be accepted.",
    )
    server_arguments.add_argument(
        "--cors",
        nargs="*",
        type=str,
        help=
        "Enable CORS for the passed origin. Use * to whitelist all origins.",
    )
    server_arguments.add_argument(
        "--enable-api",
        action="store_true",
        help="Start the web server API in addition to the input channel.",
    )
    server_arguments.add_argument(
        "--remote-storage",
        help=
        "Set the remote location where your Rasa model is stored, e.g. on AWS.",
    )

    channel_arguments = parser.add_argument_group("Channels")
    channel_arguments.add_argument(
        "--credentials",
        default=None,
        help="Authentication credentials for the connector as a yml file.",
    )
    channel_arguments.add_argument("--connector",
                                   type=str,
                                   help="Service to connect to.")

    jwt_auth = parser.add_argument_group("JWT Authentication")
    jwt_auth.add_argument(
        "--jwt-secret",
        type=str,
        help="Public key for asymmetric JWT methods or shared secret"
        "for symmetric methods. Please also make sure to use "
        "--jwt-method to select the method of the signature, "
        "otherwise this argument will be ignored.",
    )
    jwt_auth.add_argument(
        "--jwt-method",
        type=str,
        default="HS256",
        help="Method used for the signature of the JWT authentication payload.",
    )