CDD & Rasa X

Video


Appendix

One of the biggest risks in machine learning is that we end up optimising for a dataset that doesn't reflect what our users are interested in.

To prevent this "optimising the wrong thing"-phenomenon we recommend following a development methodology called Conversation-Driven Development.

Conversation-Driven Development(CDD) is the process of listening to your users and using those insights to improve your AI assistant. It is the overarching best practice approach for chatbot development.

CDD includes the following actions:

  1. Share your assistant with users as soon as possible
  2. Review conversations on a regular basis
  3. Annotate messages and use them as NLU training data
  4. Test that your assistant always behaves as you expect
  5. Track when your assistant fails and measure its performance over time
  6. Fix how your assistant handles unsuccessful conversations

CDD is not a linear process; you'll circle back to the same actions over and over as you develop and improve your bot.

Rasa X

To make it easier to get started with Conversation-Driven Development we recommend working with Rasa X. It's a closed source, but free, tool that works on top of Rasa Open Source. One of the main benefits is that it can be deployed anywhere, so that your training data doesn't leave your organisation.

Rasa X Architecture

Before talking about how you might use Rasa X, it helps to understand how it communicates with Rasa. So let's start with a simplified diagram.

You'll notice that this previous diagram doesn't show the Custom Actions service connected to the Rasa Open Source service on the left. We've omitted this, as well as some other services, to keep the diagram simple. On the right you see Rasa X running as a service. This runs on top of Rasa Open Source and communicates over HTTP. Rasa Open Source emits events to Rasa X so that Rasa X can store information.

In order to make sure that communication with the outside world is routed appropriately, we usually add an NginX service in production. That way we'll have a load balanced that can route traffic to Rasa X or to Rasa Open Source via the input/output channels.

For simplicity we've omitted many of the databases that are connected to Rasa X, but we do want to highlight one connection that Rasa X can make on your behalf: your git provider!

Rasa X can connect to Github (or Gitlab/Bitbucket for that matter) so that your project is kept in sync with production. This also means that you can easily deploy from Github. You can configure your Git provider to update the model in Rasa X whenever you push to the main branch of your repository. This is great, because it gives you many options to configure CI/CD as well!

Installation

If you'd like to run Rasa X locally, you'll need to install it first. You can do this with pip but you'll need to make sure that you set the index url to point to Rasa's servers.

python -m pip install rasa-x --extra-index-url https://pypi.rasa.com/simple

Optionally, you can also install ngrok if you'd like to share your local assistant with users on the internet. If you prefer a more step-by-step guide on how to install Rasa X, you may appreciate these installation videos that explain the steps per operating system.


Rasa X Windows Installation

Rasa X Ubuntu Installation

Rasa X MacOS Installation

Code

Once installed, you can run Rasa X on the terminal via:

rasa x

If you'd like to share your assistant via ngrok. You will first need to share the assistant from the menu. This should give you a URL that you can share which will look something like:

http://localhost:5002/guest/conversations/production/e2c5n124128bfabati4n11234

You use ngrok in a second terminal and point it to the correct port via:

ngrok http 5002

You can now share your assistant online by translating your localhost url to your docker url.

# If this is the localhost url
http://localhost:5002/guest/conversations/production/e2c5n124128bfabati4n11234
# If this is the ngrok url
http://95abeh5bef.ngrok.io
# Then this is the url you can share with users
http://95abeh5bef.ngrok.io/guest/conversations/production/e2c5n124128bfabati4n11234

Links

Exercises

Try to answer the following questions to test your knowledge.

  • What are the 6 main actions you'll follow when you practice CDD?
  • Is Rasa X a product that contains Rasa Open Source or does it work on top of Rasa Open Source?

2016-2022 © Rasa.