Creating a New Assistant

Video


Installation

In general, all you'll need to install Rasa is this command:

python -m pip install rasa

You 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 init

This 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.yml file is the file where everything comes together.
  • The config.yml file contains the configuration for your machine learning models.
  • The data folder contains data that your assistant will learn from.
  • The nlu.yml file contains examples for your intents and entities.
  • The stories.yml file contains examples of conversations turns.
  • The rules.yml file 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 init allows you to start a new Rasa project.
  • rasa train allows you to train a new assistant based on your current training data.
  • rasa shell allows you to chat with a trained assistant.
  • rasa -h allows you get receive relevant help text for a command.
  • rasa --debug gives 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.yml and the config.yml file.
  • What two commands will you be using the most when developing your own assistant from the terminal?

2016-2022 © Rasa.