As a reminder, the term ‘intent’ stands for ‘user intention’ which is meant to be understood by the App through the users’ voice command. In the Smart lights app you just forked, there are 3 intents for specific commands:
lightsTurnOff: intent to turn off the lights in the house or a specific room
lightsShift: intent to change the lights intensity by x% in the house or a specific room
lightsSet: intent to set the lights in the house or a specific room
You can keep these intents as they are, they’ll handle voice commands for which they have been trained for. You can also customize them. Let's have a look!
If you want to edit one of the intents of an app you forked, you will also have to fork the intent as well. To do so, go over the intent. You should see a little pen on the right (lightsTurnOff in the example below).
Click on the pen and fork the intent.
Once you forked the intent, you'll be redirected to the intent editor as showed below.
This intent editor enables you to customize your intent. To better grasp all you can do in the intent editor, let's create the lightsTurnOff intent from scratch.
In this example, we're going to create an intent that aims to understand a user expresses the intention of turning off the lights. Let's go!
First of all, you'll have to create the intent within your app. Click on Create New intent.
You will automatically be redirected to the intent editor.
In order to create a robust intent, we suggest the following process:
Choose an intent name that reflects what the user intention is about. We suggest a name using a camelCase format to keep it short and clean. In addition to the name, add a clear description to the intent. The description is very important as it will be one of the main guidelines to generate data. More on that later.
Here is an example of a clear name and description for your intent that aims to turn off the lights.
All enabled intents can be triggered when your start the Snips Platform on-device. A disabled intent on the other hand must be programmatically enabled first (refer to the Configure message of the Dialogue Manager API for further details). The
Enabled by default option allows you to configure this default behaviour. You might want to uncheck it for intents that will only be used in specific context such as confirmation or slot elicitation, which is out scope for this specific tutorial.
Now that your intent has a name and description, you're going to add the list of slots it should contain. A slot is an entity that must be extracted from your users' query to be understood. Each slot has a list of values that can be identified in a query.
Click on Add Slot.
You'll be prompted to enter the slot name and type. The slot type can be reused across all your other intents. See it as a reusable entity. The slot name is just a custom name for this given intent.
In this example, we're going to add a slot that lists the rooms of a house. So we'll enter house_room as a slot name and room as a slot type.
After you entered the slot type, you'll be redirected to the Slot Type Editor as show below.
Now you're going to enter a few values in Manual slot Type Values. In this example, we're adding a few room names as shown below.
The good news is you don't have to add every house rooms manually. These can be generated automatically! To do so, click on Generate Values.
If the values you previously entered are generic enough, some additional values will be suggested. 51 values in our example.
Click on Add this list and Save. Congrats! You now have 51 values added to your slot.
Once you're done, finish setting up your slot by adding a description. Go back to the intent editor and click on Edit slot description.
Just like the intent, enter a slot description that is clear so that training examples can easily be generated. Click on Update to proceed.
It's now time to add training examples to your intents to train the Automatic Speech Recognition (ASR) and the Natural Language Understanding (NLU) models. The models needs as much data as possible so that the user intention can be caught regardless the way people express their command.
Go to the training examples section and select the text field Type your training example....
We are going to add 5 training examples as different ways of expressing the same intention that is turning off the lights.
Now you'll need to tag the slot values within each training examples so that these entities are successfully extracted by your assistant.
In this example, we'll tag every word that is a house room. To finish, click on Save (bottom right of the intent editor).
Congrats! You created your first intent. When it comes to editing an existing intent, one that you forked for example, just stick to the same process.
You should manually add as many training examples as you can to feed the models and make your assistant more robust. However, this might be time consuming. Fortunately you can use our Data Generation service to automatically generate lots of training examples rapidly. Let's have a look!
You can use our service to save a lot of time and energy on building your intent. Click on Generate.
Review your intent and slot(s) description, and make sure they are clear.
Click on Next. A warning message will notify you if you haven't used each slot in at least 3 different training examples.
Click on Next. You will see a reminder that your slot should contains enough values to be more robust.
Click on Next. You'll be offered 3 different options. Choose the one that fits your needs and proceed with your payment.
Well done! You have all you need to create great intents!
You might have noticed them, but each app and intent now comes with a performance indicator. For apps, it is indicated with a colored text with the values: "Excellent Quality" (green), "Fair Quality" (yellow) and "Weak Quality" (red). The intents show the equivalent information using a coloured dot.
This indicator is there to give you a hint about your app quality and in turn your assistant quality. It is strongly recommended to add more training examples to intents that are still in the red/yellow quality area, until the quality indicator turns green.