Creating a New Assistant
Video
Installation
In general, all you'll need to install Rasa is this command:
python -m pip install rasaYou will need to have python installed beforehand though. So feel free to check the following installation guides for extra help.
Windows Installation
MacOS Installation
Ubuntu Installation
Given that Rasa is installed, we can now start exploring some of the basic commands.
Code
Given that Rasa is installed, you can start a new assistant by running:
python -m rasa initThis will start a prompt which will generate a new assistant. You're able to indicate where you want the new project to be created and you're also able to train the new assistant after the files have been created.
The assistant that you'll create is called "moodbot". It's a simple assistant that tries to cheer you up if you're sad. If you're happy the bot will just say "goodbye" and if you're sad the bot will try to show you a picture of a cute tiger.
Files
The Rasa project that you've just created should have the following file structure.
📂 /path/to/project
┣━━ 📂 actions
┃ ┣━━ 🐍 __init__.py
┃ ┗━━ 🐍 actions.py
┣━━ 📂 data
┃ ┣━━ 📄 nlu.yml
┃ ┣━━ 📄 rules.yml
┃ ┗━━ 📄 stories.yml
┣━━ 📂 models
┣━━ 📂 tests
┃ ┗━━ 📄 test_stories.yml
┣━━ 📄 config.yml
┣━━ 📄 credentials.yml
┣━━ 📄 domain.yml
┗━━ 📄 endpoints.yml
It's good to understand what some of these files are for. So as a quick overview:
- The
domain.ymlfile is the file where everything comes together. - The
config.ymlfile contains the configuration for your machine learning models. - The
datafolder contains data that your assistant will learn from. - The
nlu.ymlfile contains examples for your intents and entities. - The
stories.ymlfile contains examples of conversations turns. - The
rules.ymlfile contains predefined rules for the dialogue policies.
All of these files will be explained in more detail later, but these five files play an especially crucial part in developing Rasa assistant. So it's good to be concious of them right away.
Commands
There are a few commands that are good to be aware of from the command line.
rasa initallows you to start a new Rasa project.rasa trainallows you to train a new assistant based on your current training data.rasa shellallows you to chat with a trained assistant.rasa -hallows you get receive relevant help text for a command.rasa --debuggives you extra log output when running commands.
Links
Exercises
Try to answer the following questions to test your knowledge.
- What's the main command you'll use to install Rasa?
- What's the difference between the
domain.ymland theconfig.ymlfile. - What two commands will you be using the most when developing your own assistant from the terminal?