Migrating to Rasa 1.0

My experience migrating to the latest Rasa release

Posted by Greg Stephens on July 01, 2019 · 6 mins read

Migrating to Rasa 1.0

I have some existing Rasa chatbots that have been running since Rasa 0.11 that I have recently upgraded to Rasa 1.0. While there is a migration guide, at the time of this writing I found it to be far from complete. There is also a github rasa-demo that seems to be regularly updated by the folks at Rasa and I found this to be helpful.

My Bot

Some notes about my Rasa Bots:

  • Separate NLU & Core - I run separate NLU & Core containers
  • Chatroom - I use the ScalableMinds chatroom React Component to interact with my bots
  • Custom Tracker Store - I use a custom tracker store both to write log messages to monitor my bot and in some cases for an alternative data store
  • ELK Dashboard - I use Elasticsearch, Logstash, Kibana and Beats to create a Rasa monitoring dashboard for my bots
  • Postman - I use postman to do basic Rasa NLU & Core testing using the Rasa API

Separate NLU

I gave up trying to run a separate NLU as I have done from the beginning. The Rasa documentation states that you can continue to run a separate NLU but there is very little documentation on this that I could find. I found one mention that you need to specify the --enable-api option to run the NLU but, as this github issue reports, Rasa still reports that it is running Core.

The Rasa team recommends running a single container now instead of separate NLU and Core containers so I gave up trying to get seperate containers to work. Maybe you’ll find documetation on this by the time you read this.

Combining my NLU & Core containers reqiured me to change the following files:

  • endpoints.yml - no longer refers to the separate NLU endpoint
  • docker-compose.yml - dropped the NLU container, modified command to run new Rasa command line (see below)

Combined NLU & Core Configuration

Prior to Rasa 1.0 there were separate NLU & Core configuration files. I called my nlu_config.yml and config.yml. This setup is referenced in the 0.11.x to 0.12.0 migration guide states that the configuration is split.

With Rasa 1.0 the NLU & Core configuration should be stored in a single yml file. The rasa-demo project has an example file.

There was no mention of this in the Rasa 1.0 Migration Guide. I submitted a Github issue and associated PR so maybe this will be updated by the time you read this.

Project Structure

While not required, it’s recommended that your project filenames and directory structure follow the convention created by the rasa init command (see Create a new Project). Following this convention will make for easier use of Rasa X.

├── __init__.py
├── actions.py
├── config.yml
├── credentials.yml
├── data
│   ├── nlu.md
│   └── stories.md
├── domain.yml
├── endpoints.yml
└── models
    └── <timestamp>.tar.gz

Rasa Command

The Rasa command line and options have changed and this is fairly well documented (unless you want to run a separate NLU). Here’s the command line I’m now using to start a combined container:

run --enable-api --model /app/models --endpoints /app/endpoints_local.yml --credentials /app/credentials.yml --port 5005 --log-file /app/data/logs/rasa_core.log --debug

Input Channel for Chatroom

Prior to Rasa 1.0, users of the chatroom React Component had to setup a separate channel for the chatroom component. With Rasa 1.0, there is now a generic REST API that can be used by chatroom and other users.

This is a nice improvement so we can now get rid of the chatroom input channel code and the credentials.yml file is simplified to a single line:

rest:

YAML Syntax Checking

Rasa 1.0 appears to have improved, stricter YAML syntax checking. I did not find any mention of this in the docs but I ran into syntax errors in my domain.yml that worked fine in prior releases but my training process failed on these errors under Rasa 1.0

Python Package Name Changes

The Rasa python package names have changed. This required changes to my action agent code and my customer tracker store code.

Old Name Rasa 1.0
rasa_core rasa.core
rasa_core_sdk rasa_sdk

There’s a reference to the rasa_core change in the changelog but I found no references to the rasa_core_sdk change.

Action Agent Image

The action agent must use the rasa_sdk package or the rasa/rasa_sdk docker image. Past versions used the rasa_core_sdk image.

Models & Training

The model format has changed and the idea of NLU projects is removed. With the combined NLU & Core containers, the training is also combined.

docker run -v $(pwd)/data:/app/data rasa/rasa:latest-full train core --config /app/data/config.yml --out /app/data/models --domain /app/data/domain.yml --stories /app/data/stories

REST API

The REST API has changed but I could not find any documentation on the changes. The legacy API documentation is here and the new docs are here.

These are a couple of the endpoint changes that I use:

API Old New
POST /parse /model/parse
POST /train /model/train