Rasa chatbot framework
Rasa Core (Dialogue Management)
Training the Dialogue Management Model
- Domain file: It defines "the universe of your bot" by specifying the following (see below):
Intents, Slots, Entities, Templates, Actions
- Stories: Every training example for the dialogue system is a story. This file contains multiple stories your bot is likely to experience with users. Based on these stories, Rasa’s dialogue management model is trained using a sequence model such as RNN.
- Actions: There are two types of actions a bot can take:
- Utterance action: The bot just sends a text message to the user. For example: replying with a greet message, asking the location, etc.
- Custom actions: Actions such as querying the database, sending emails to the user, etc. If you want the bot to perform a custom action, you need to add that action in your domain file as well.
Configuration elements to manage dialogues in a chatbot (Domain file)
- Slots: These are 'objects' you want to 'keep track of' during a conversation. For example, if a user says: ‘I want to book movie tickets for Raazi’, and the bots asks ‘For how many people?’, and the user responds 'Two'. Throughout this conversation, the bot needs to remember that ‘Raazi’ is the value of the entity movie_name and '2' is the value of the entity number_of_tickets, so it can be used to, for e.g., query a database. In other words, slots are the ‘memory’ of the bot. You can read more about slots here.
- Intents (NLU layer): These are strings (such as 'greet', 'weather_search'), which describe what the user (probably) intends to say. Intents are extracted using typical machine learning classifiers.
- Entities (NLU Layer): As you have already seen, entities are extracted using models such as (sklearn) CRF, spaCy etc. In most cases, entities are stored in slots; in cases when the entity is irrelevant for the dialogue flow, you don't need to assign it a slot (e.g. the name of the user).
- Templates: Templates define how the bot will utter a statement. For example, if the bot wants to ask for cuisine preference, the template can define how the bot can ask it: ‘What kind of cuisine would you like’, ‘Specify your cuisine preference’, etc. All these can be specified in the template section of the domain file. A random response from the template is picked so that your bot doesn’t sound robotic or bland.
- Actions: The 'actions' component enlists all the actions the bot can do - uttering a text message such as "Hi", looking up a database, making an API call, asking a question to the user etc. For example, an action named as 'actions.ActionSearchRestaurants' could look up a restaurant database to search for the restaurants given entities such as location and cuisine preferences. In this case, it looks up the 'ActionSearchRestaurants' class in the "actions.py" module.
No comments:
Post a Comment