Tutorial: Rasa Basics
These docs are for version 1.x of Rasa Open Source. Docs for the new version 2.0 can be found here.
Tutorial: Rasa Basics
This page explains the basics of building an assistant with Rasa and shows the structure of a Rasa project. You can test it out right here without installing anything. You can also install Rasa and follow along in your command line.
The glossary contains an overview of the most common terms you’ll see in the Rasa documentation.
Steps
- 1. Create a New Project
- 2. View Your NLU Training Data
- 3. Define Your Model Configuration
- 4. Write Your First Stories
- 5. Define a Domain
- 6. Train a Model
- 7. Test Your Assistant
- 8. Talk to Your Assistant
- Next Steps
1. Create a New Project
The first step is to create a new Rasa project. To do this, run:
rasa init --no-prompt
The rasa init command creates all the files that a Rasa project needs and trains a simple bot on some sample data. This creates the following files:
| File | Description |
|---|---|
__init__.py |
an empty file that helps python find your actions |
actions.py |
code for your custom actions |
config.yml |
configuration of your NLU and Core models |
credentials.yml |
details for connecting to other services |
data/nlu.md |
your NLU training data |
data/stories.md |
your stories |
domain.yml |
your assistant’s domain |
endpoints.yml |
details for connecting to channels like fb messenger |
models/<timestamp>.tar.gz |
your initial model |
2. View Your NLU Training Data
To see the NLU training data created by the rasa init command:
cat data/nlu.md
The lines starting with ## define the names of your intents, which are groups of messages with the same meaning.
3. Define Your Model Configuration
View your model configuration file by running:
cat config.yml
4. Write Your First Stories
To view the example stories inside the file data/stories.md, run:
cat data/stories.md
5. Define a Domain
To define a Domain, run:
cat domain.yml
6. Train a Model
To train a model, run:
rasa train
The rasa train command will look for both NLU and Core data and will train a combined model.
7. Test Your Assistant
After training a model, test that your assistant behaves as expected by running:
rasa test
8. Talk to Your Assistant
Start talking to your assistant by running:
rasa shell
Next Steps
Now that you’ve built your first Rasa bot:
- Visit the forms documentation.
- Learn about custom actions.
- Explore how to connect your bot to different messaging apps .