Botsociety to Rasa export example: The Concertbot

  • by

Rasa export demo: The Concertbot

To demonstrate the power of the Botsociety Rasa export, we re-designed the official Rasa example ‘Concertbot’ in Botsociety. It will give you a good idea of what you can accomplish by using a Botsociety design as the starting point of your Rasa project. We will also break the export file by file, showing how to use them in your Rasa project.

Note: This blog post will not go into the details of how to design a chatbot on Botsociety. If you are interested in that, check out the rest of our tutorials here.

Before we start, the files! We will be using a design file on Botsociety that will export the ConcertBot example.

The design file can be found here:

Botsociety

The Rasa Concert bot example that I reference can is in the official Rasa Github repository. Here:

RasaHQ/rasa

Ready? Let’s go!

Exporting the design file

The first thing that you will need to do is copy the design file to your Botsociety account so that you can edit it. To do that:

If you don’t have a Botsociety account, you can create one for free.

Ok, now you own a copy of your file!

To export the file from the example:

  • Click on the wrench icon on the left-hand side panel
  • From the dropdown on top select Rasa
  • Click export

That’s it! You just have downloaded your Rasa files on your computers. Let’s open the ZIP file.

The resulting export

The export has the following files:

As you will notice, Botsociety generated the Rasa file structure for you. So if you compare it with the Rasa example on Github:

You will see that the only difference is the README file.

Trending Bot Articles:

1. 3 Tips for your Voice and Chatbot Program from Gartner’s Customer Service Hype Cycle 2020

2. Deploying Watson Assistant Web Chat in Salesforce Lightning Console

3. Are Chatbots Vulnerable? Best Practices to Ensure Chatbots Security

4. Your Path to AI — An IBM Developer Series

Ok great! Let’s analyze each file one by one.

config.yml

This file sets up your Rasa bot general configuration. You may want to change it. Here’s the Rasa example. Botsociety exports a static, default one to get you started:

The config.yml file in the Botsociety export

The Rasa example is very similar, with different values for the epochs and other settings:

The config.yml file in Rasa

To know what to do with the config.yml, check the relevant Rasa documentation.

Conclusion: If you are using your Botsociety export to update an existing Rasa project, our suggestion is not to copy this over. Otherwise, it’s a good starting point.

Custom_slot.py

This is a static file, and it’s exactly the same in the Rasa export and in the Botsociety export.

Conclusion: If you are using your Botsociety export to update an existing Rasa project, our suggestion is not to copy this over. Otherwise, it’s a good starting point.

Domain.yml

This is an important file. It lists the intents, the responses, and the actions available in the bot. This is how it looks in the Botsociety export:

version: '2.0'
actions: []
entities: []
intents:
- greet:
use_entities: []
- how_to_get_started:
use_entities: []
- deny:
use_entities: []
- goodbye:
use_entities: []
- affirm:
use_entities: []
- compare_reviews:
use_entities: []
- search_venues:
use_entities: []
- search_concerts:
use_entities: []
- thankyou:
use_entities: []
- nlu_fallback:
use_entities: []
- bot_challenge:
use_entities: []
responses:
utter_greet:
- text: hey there
utter_how_to_get_started:
- text: i can help you find concerts and venues. do you like music?
utter_goodbye:
- text: 'goodbye :('
utter_affirm:
- text: awesome! you can ask me things like "find me some concerts"
utter_compare_reviews:
- text: |-
foo fighters: 4.5
katy perry: 5.0
utter_search_venues:
- text: |-
here are some venues i found
big arena: 4.5
rock cellar: 5.0
utter_search_concerts:
- text: |-
foo fighters
katy perry
utter_thankyou:
- text: you're very welcome.
utter_nlu_fallback:
- text: 'sorry, i didn''t get that, can you rephrase?'
utter_bot_challenge:
- text: 'i am a bot, powered by rasa.'

This is how it looks in the Rasa example:

The Rasa example contains everything that Botsociety exported, plus two additional fields that contain data that is not defined in Botsociety.

Let’s take a look at them.

The first one is the slot section:

slots:
concerts:
type: list
influence_conversation: false
venues:
type: list
influence_conversation: false
likes_music:
type: bool
influence_conversation: true

The slots are a Rasa feature that allows you to give context to your chatbot. We may eventually add context inside Botsociety and make this feature available in the export in the future, but for now, you will need to set these up in Rasa directly. In this case, adding the above block in this file is needed to set up the slots of this conversation.

The second block that is present in the Rasa example only is the session config:

session_config:
session_expiration_time: 60 # value in minutes
carry_over_slots_to_new_session: true

Those are additional configurations that you can find in Rasa.

Conclusion: As you see, most of the heavy lifting on the domain.yml was done by Botsociety based on your design. If you want to add additional features

endpoint.py

This is a static file, and it’s exactly the same in the Rasa export and in the Botsociety export.

Conclusion: If you are using your Botsociety export to update an existing Rasa project, our suggestion is not to copy this over. Otherwise, it’s a good starting point.

Almost there! We are now going to analyze the files that are inside the data directory:

nlu.yml

This file contains all of the possible intents and the training phrases for each intent. If you compare the two files (here’s the Rasa one), you will see that they are exactly the same:

As you see, Botsociety compiled this file for you, using the utterances defined in the messages on the user side. If you are not sure how to add utterances in Botsociety, here’s the relevant docs.

Conclusion: You can drag and drop this file into your Rasa project to update any new training phrase or new intents. You can also use it to kick off your Rasa project. Unless you are doing very particular customizations, the nlu.yml file is used without manual editing.

rules.yml

This file reflects the hard-coded steps that the bot will take. This is what the Botsociety export looks like:

This is what the Rasa example looks like:

As you see, the Rasa example has a lot more hard-coded rules, since it’s handcrafted. In the Botsociety export, we are following the Rasa’s recommendation of not over-using rules, and we are relying on stories. These differences in the file should not affect how your bot behaves.

Conclusion: The Rules.yml file of the Botsociety export is a good starting point. If you already have a custom rules.yml, you can keep using that instead of the one exported by Botsociety.

stories.yml

This file lists the possible interaction patterns that the user can take in your bot. The two files are very similar but — as you may have guessed — the Botsociety export is automatically generated and therefore contains all of the possible combinations, numbered. For example, this is the story that contains the search_concerts in the Rasa example:

- story: search_concerts
steps:
- intent: search_concerts
- action: action_search_concerts
- slot_was_set:
- concerts: [{"artist": "Foo Fighters", "reviews": 4.5}]

This is the exported Botsociety counterpart:

- story: 4 - welcome path
steps:
- intent: greet
- action: utter_greet
- action: utter_how_to_get_started
- intent: affirm
- action: utter_affirm
- intent: search_concerts
- action: utter_search_concerts

Two main differences here:

  • The name of the story generated by Botsociety is mutated from the name of your path (or paths) in your design
  • Since the stories generated by Botsociety are generated by combining your paths, they are longer and more complex
  • Given that Botsociety does not support the Rasa slot feature yet, you can see that the story in Botsociety does not set up the slot

Conclusion: The stories.yml can be used out of the box, either as an update to an existing project or as a new project, with the exception of the slot feature. In that case, you will need to add the slot settings in the stories.yml file.

Wrapping it up

This concludes the overview of every single file that Botsociety exports to Rasa. We are looking forward to adding more capabilities to these features, and we would love to hear your views about them.

You can sign up for free on Botsociety here.

Don’t forget to give us your 👏 !

https://medium.com/media/7078d8ad19192c4c53d3bf199468e4ab/href


Botsociety to Rasa export example: The Concertbot was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

Leave a Reply

Your email address will not be published. Required fields are marked *