Importing Conversations¶
Rasa X makes it easier to create training data from real conversations. If you have a running assistant and you’re now trying out Rasa X, you can import conversations from your deployed system and start annotating them right away.
Rasa X can run both on your own computer and on a server.
In this tutorial you will import conversations from a running Rasa deployment
into your local instance of Rasa X.
You’ll connect to your existing tracker store, fetch the conversations,
and save them to a file that Rasa X can read.
You can only do this if your deployment uses one of the persisted tracker stores:
the MongoTrackerStore
, RedisTrackerStore
, or SQLTrackerStore
.
Installation and Setup¶
First, make sure you have Rasa X installed. See Installation and Setup .
When running locally, Rasa X uses SQLite to store data, including the conversations between your users and your assistant.
Make sure SQLite is installed on your machine. On most operating systems, you’ll already have it. To test this, run:
sqlite3 --version
If SQLite is installed you should get something similar to this:
3.24.0 2018-06-04 14:10:15 95fbac39baaab1c3a84fdfc82ccb7f42398b2e92f18a2a57bce1d4a713cbaapl
If you don’t get this input please install SQLite.
Connecting to Your Existing Tracker Store¶
Your existing Rasa deployment will be using a file called endpoints.yml
which
contains the details required to connect to your tracker store.
For example, the details for a MongoTrackerStore
might look like this:
tracker_store: store_type: mongod url: mongodb://localhost:27017 username: root password: your password db: rasa
Find the endpoints.yml
file used by your existing deployment and copy it to your computer.
Making a Local Copy of Your Tracker Store¶
Rather than connecting to your production database, it’s a good idea to create a copy of the DB that you can run locally. However, the tracker migration script only reads data (doesn’t write), so you can also skip this section and connect directly to your production tracker store.
The exact instructions for making a copy will depend on your deployment, so the following steps are just an example.
If you are using the MongoTrackerStore
and running MongoDB as a Docker container,
your container will have a directory mounted at /data/db
.
Look for an argument like -v /my/own/datadir:/data/db
in your docker-compose or
other orchestration setup to see which directory is being used to store data.
Make a copy of this directory on your own machine, for example by running:
scp username@host:/my/own/datadir mongodb-clone
This would name your local copy of the directory mongodb-clone
.
Then start MongoDB:
docker run -p 27017:27017 -v $(pwd)/mongodb-clone:/data/db -d mongo
And use the endpoints.yml
file above to connect the migration script to
your mongodb instance.
Running the Migration Script¶
Download the migration script from
GitHub.
This script will connect to your tracker store, fetch the conversations, and save them
locally to a file called rasa.db
and a file called tracker.db
.
Run the script on the command line:
python migrate_tracker_store.py
The script will ask you for the path to your endpoint configuration file.
Note
If you have a large number of conversations in your tracker store, this might take a while. To do a quick test, limiting to 10 conversations, add the
max-trackers
argument:python migrate_tracker_store --max-trackers 10
When the script finishes running, you’ll have two files called rasa.db
and
tracker.db
in your working directory.
View Conversations in Rasa X¶
Copy the rasa.db
and tracker.db
file into your project directory.
Move into your project directory, and start Rasa X.
To do this, run:
rasa x
This should open up the /conversations
page in the UI,
where you can see and annotate the user-assistant conversations.
If you have a large number of conversations, try filtering using the filter button
in the top right of the page.