Esempio n. 1
0
def create_simple_project(path: Path):
    scaffold.create_initial_project(str(path))

    # create a config file
    # for the cli test the resulting model is not important, use components that are
    # fast to train
    write_yaml(
        {
            "language":
            "en",
            "pipeline": [{
                "name": "KeywordIntentClassifier"
            }],
            "policies": [
                {
                    "name": "MappingPolicy"
                },
                {
                    "name": "MemoizationPolicy",
                    "max_history": 3
                },
            ],
        },
        path / "config.yml",
    )
    return path
Esempio n. 2
0
def project() -> Text:
    import tempfile
    from rasa.cli.scaffold import create_initial_project

    directory = tempfile.mkdtemp()
    create_initial_project(directory)

    return directory
async def test_example_bot_training_on_initial_project(tmp_path: Path):
    # we need to test this one separately, as we can't test it in place
    # configuration suggestions would otherwise change the initial file
    scaffold.create_initial_project(str(tmp_path))

    importer = TrainingDataImporter.load_from_config(
        str(tmp_path / "config.yml"),
        str(tmp_path / "domain.yml"),
        str(tmp_path / "data"),
    )

    with pytest.warns(None) as record:
        await importer.get_nlu_data()
        await importer.get_stories()

    assert not len(record)
Esempio n. 4
0
def test_example_bot_training_on_initial_project(tmp_path: Path):
    # we need to test this one separately, as we can't test it in place
    # configuration suggestions would otherwise change the initial file
    scaffold.create_initial_project(str(tmp_path))

    importer = TrainingDataImporter.load_from_config(
        str(tmp_path / "config.yml"),
        str(tmp_path / "domain.yml"),
        str(tmp_path / "data"),
    )

    with pytest.warns(UserWarning) as record:
        importer.get_nlu_data()
        importer.get_stories()

    # two for slot auto-fill removal
    assert len(record) == 2
    assert ("Slot auto-fill has been removed in 3.0 and replaced with "
            "a new explicit mechanism to set slots."
            in record[0].message.args[0])
    assert record[0].message.args[0] == record[1].message.args[0]