Recently, API.AI announced a new feature called Follow Up Intents. You can add them from the Intents view and they allow you to create a hierarchy of intents.
What are the advantages? And when do you need them? Let us take a look.
What are follow up intents?
Follow up intents, as their name suggests, are intents you define to be a child intent of an existing intent. Creating a follow up intent is quite straight-forward. As you hover your mouse on any intent in the Intents view, you will see a link which says “Add follow-up intent”. Clicking on the link gives you the following options:
If you choose Custom fallback intent, you will be allowed to enter your own “user says” phrases. If you choose any of the other choices, you will be provided with a prepopulated list of appropriate “user says” phrases which you can then edit to your liking. For example, this is what the prepopulated list for “Yes” choice looks like:
Can we improve our previous bots with follow up intents?
The FAQ bot is too simple to need a follow up intent, given that it acts more or less like a search engine with questions followed by answers, without any need for context.
Wimbledon Finals Bot
Similar to the FAQ bot, the Wimbledon Finals bot also functions like a question and answer bot (although it includes and introduces the concept of entities). Here too, the bot is too simple to need follow up intents.
Vending Machine Bot
The simple Vending Machine Bot we created to understand contexts is definitely a use case for follow up intents. However, this is also because we had a somewhat oversimplified vending machine. Still, you can rewrite the vending machine bot to use follow up intents and simplify the chatbot quite a bit. In a future post of this series, I will discuss how to rewrite the vending machine bot using follow up intents.
The weather bot (Webhooks)
The weather bot introduced the concept of webhooks, and while there is a fair amount of code which goes into its business logic, the actual user facing portion is still a simple question and answer interface and doesn’t need follow up intents.
The florist bot
Here, it gets a little more interesting. On first glance, when you look at the flowchart for the florist bot, you might think follow up intents are very useful for the florist bot and should simplify the overall process a lot. There is a small catch however.
The problem is with the box marked number 6. It is actually a while loop, and using follow up intents, you cannot create a while loop where you don’t know how many times you will be entering the loop.
In the next post, we will consider a use case which is almost perfect for the follow up intents.