Tutorial: Rasa Basics
These docs are for version 1.x of Rasa Open Source.
User Guide
- Installation
- Tutorial: Rasa Basics
- Tutorial: Building Assistants
- Command Line Interface
- Architecture
- Messaging and Voice Channels
- Testing Your Assistant
- Validate Data
- Configuring the HTTP API
- Deploying Your Rasa Assistant
- Cloud Storage
NLU
- About
- Using NLU Only
- Training Data Format
- Language Support
- Choosing a Pipeline
- Components
- Entity Extraction
Core
- About
- Stories
- Domains
- Responses
- Actions
- Reminders and External Events
- Policies
- Slots
- Forms
- Retrieval Actions
- Interactive Learning
- Fallback Actions
- Knowledge Base Actions
Conversation Design
API Reference
- Action Server
- HTTP API
- Jupyter Notebooks
- Agent
- Custom NLU Components
- Rasa SDK
- Events
- Tracker
- Tracker Stores
- Event Brokers
- Lock Stores
- Training Data Importers
- Featurization of Conversations
- TensorFlow Configuration
- Migration Guide
- Rasa Open Source Change Log
Migrate from (beta)
Reference
Versions
viewing: 1.9.0
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.
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:
__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
The first piece of a Rasa assistant is an NLU model. NLU stands for Natural Language Understanding, which means turning user messages into structured data. To do this with Rasa, you provide training examples that show how Rasa should understand user messages, and then train a model by showing it those examples.
Run the code cell below 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. Rasa’s job will be to predict the correct intent when your users send new, unseen messages to your assistant.
3. Define Your Model Configuration
The configuration file defines the NLU and Core components that your model will use. In this example, your NLU model will use the supervised_embeddings pipeline.
Let’s take a look at your model configuration file.
cat config.yml
The language and pipeline keys specify how the NLU model should be built.
4. Write Your First Stories
At this stage, you will teach your assistant how to respond to your messages. This is called dialogue management, and is handled by your Core model.
Below is an example of a simple conversation. The user says hello, and the assistant says hello back. This is how it looks as a story:
## story1
* greet
- utter_greet
5. Define a Domain
The next thing we need to do is define a Domain. The domain defines the universe your assistant lives in: what user inputs it should expect to get, what actions it should be able to predict, how to respond, and what information to store.
The domain for our assistant is saved in a file called domain.yml:
cat domain.yml
So what do the different parts mean?
intents |
things you expect users to say |
actions |
things your assistant can do and say |
templates |
template strings for the things your assistant can say |
| How does this fit together? | Rasa Core’s job is to choose the right action to execute at each step of the conversation. |
6. Train a Model
Anytime we add new NLU or Core data, or update the domain or configuration, we need to re-train a neural network on our example stories and NLU data. To do this, run the command below.
rasa train
7. Test Your Assistant
After you train a model, check that your assistant behaves as expected.
rasa test
8. Talk to Your Assistant
Congratulations! 🚀 You just built an assistant powered entirely by machine learning.
Now that you’ve built your first Rasa bot it’s time to learn about some more advanced Rasa features.