Exemple #1
0
def test_core(args: argparse.Namespace) -> None:
    from rasa.test import test_core

    endpoints = get_validated_path(args.endpoints, "endpoints",
                                   DEFAULT_ENDPOINTS_PATH, True)
    stories = get_validated_path(args.stories, "stories", DEFAULT_DATA_PATH)
    stories = data.get_core_directory(stories)
    output = args.out or DEFAULT_RESULTS_PATH

    if not os.path.exists(output):
        os.makedirs(output)

    if isinstance(args.model, list) and len(args.model) == 1:
        args.model = args.model[0]

    if isinstance(args.model, str):
        model_path = get_validated_path(args.model, "model",
                                        DEFAULT_MODELS_PATH)

        test_core(
            model=model_path,
            stories=stories,
            endpoints=endpoints,
            output=output,
            kwargs=vars(args),
        )

    else:
        test_compare(args.model, stories, output)
Exemple #2
0
def test_core(args: argparse.Namespace) -> None:
    from rasa.test import test_core

    endpoints = get_validated_path(
        args.endpoints, "endpoints", DEFAULT_ENDPOINTS_PATH, True
    )
    stories = get_validated_path(args.stories, "stories", DEFAULT_DATA_PATH)
    stories = data.get_core_directory(stories)
    output = args.output or DEFAULT_RESULTS_PATH
    args.config = get_validated_path(args.config, "config", DEFAULT_CONFIG_PATH)

    if len(args.model) == 1:
        args.model = args.model[0]

        model_path = get_validated_path(args.model, "model", DEFAULT_MODELS_PATH)

        test_core(
            model=model_path,
            stories=stories,
            endpoints=endpoints,
            output=output,
            kwargs=vars(args),
        )

    else:
        test_compare(args.model, stories, output)