I have created a guide for API.AI which uses examples of small, self-contained bots to explain different aspects of API.AI. This is a Table of Contents page in which I have assembled all the posts in sequence.
|1. Introducing the FAQ bot
This is the first part of a multi-part guide I am writing on API.AI. This series came about as a result of a question I saw on the API.AI forum, where someone asked if there were any step by step guides. When I began learning API.AI, I sometimes felt that many of the online resources do not really take a step by step approach – here, by step-by-step I mean an approach where they focus on one thing at a time as they teach. More...
|2. Preparing the FAQ list
As mentioned in the previous post, we will be building an FAQ bot which will answer questions about API.AI. So the first thing we need is a resource from where we can get answers about API.AI – and we have one ready: the API.AI documentation. More..
|3. Creating an agent from the FAQ list
Now that we have prepared an FAQ list as mentioned in the previous post, we are ready to create our first chatbot.
Log in to api.ai (you can use your Google account if you want). More..
|4. Intent Mapping
In the previous post, you used the interactive console on the right hand side to test your agent’s responses for different questions from the user.
In this post, I will give an overview of what is happening, and what is the expected behavior. More...
|5. The Wimbledon Finals bot
Hopefully you are familiar with the game of tennis and know something about the Wimbledon tournament, generally considered to be the most prestigious of the Grand Slam tournaments. Even if you are not, you certainly know the concept of a tournament winner and the tournament runner-up.
The WimbledonFinalsBot has only one purpose for its existence. More...
|6. Populating the entities
In the previous post, we learnt a little about the WimbledonFinalsBot (henceforth WFBot) we will be building.
You will start by creating a new agent just like for the FAQ bot. Once you have created an agent, the next step will be to declare the Intents. If you remember from the previous posts, the intents should be the different phrases you expect your user to ask. More...
|7. Declaring intents with entities
In the previous post, we populated the mens-winners entity with a list of values. When you see the Entity in the Editor mode (as opposed to the raw mode you used for uploading CSV), you will see the following: More...
|8. Completing the WFBot Intent definitions
You have seen that for the first type of question (who won the men’s Wimbledon in year X?), the agent is able to provide the correct response. All that is left to do to complete the bot is to
a) populate the remaining entities (womens-winners, men-runnersup, women-runnersup)
b) declare the corresponding intents. More...
|9. How Intent Mapping works under the hood
In the previous post you saw how the question “who won men’s Wimbledon in 1982” was correctly answered by the agent. At this point, it would be a good idea to take a little break from building the agent to go into a little detail about what is happening under the hood. It is my view that this knowledge will help you in three different ways. More...
|10. The Vending Machine bot
So we have seen two fundamental concepts of a chatbot framework – namely Intents and Entities.
A third important concept is the idea of context. To lay the groundwork for explaining contexts, I will start by describing the Vending Machine bot (VMBot for short). More...
|11. Using contexts to maintain state
In the last post we saw how the vending machine bot works. The main difference between the previous two chatbots (FAQ Bot and WimbledonFinalBot) and the current one is that we need to keep track of the user’s previous messages so that we can use that to decide the current action. More...
|12. Using input and output contexts to maintain state
We saw in the previous part that we would like to maintain the state of the current balance in the vending machine so that we can decide what the final balance would be when the user adds another 25c.
You need to remember that the Intent for both zero balance and 25c balance will be defined using more or less the same set of User says phrases (given that in both cases the user will be saying more or less the same phrase). More...
While the previous example bots were all self-contained (in the sense that all code was executed on the API.AI’s service), you will make use of webhooks when you wish to write custom logic which is not supported by API.AI.
My view is that it is unlikely you can build a very functional bot without using webhooks. More...
|14. The florist bot
One of the examples already provided in the API.AI documentation is an example bot for a florist shop. I really like this example as a teaching tool because it covers so many different features that you will use as you are building out your chatbots. But the biggest reason why I like this example is that someone made the effort to post the agent’s ZIP file online so you can download it, create your own agent with it and play around to get a better picture of the different concepts. More...
|15. Identifying intents in the florist bot
The process for identifying entities, in my view, is to start looking for the nouns in your flowchart. In the case of the florist bot, we see the following: red roses, and nouns for events (wedding, anniversary etc.). For this particular case, only the red roses (in general, flowers) are defined as entities since the event-based nouns are only used for static responses in the flowchart. More...
|16. How contexts help intent mapping
In the previous post, we looked at how the flowchart of the florist bot can be used to understand the entities and intents you will use to create your API.AI agent.
In this post, we will take a closer look at the contexts which have already been defined in the agent and how they influence the agent’s behavior. More...
|17. Follow up Intents
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. More...
|18. Dichotomous key bot
One of the best use cases which illustrates the use of follow up intents is the dichotomous key bot. Here is a definition of the Dichotomous Key: More...
|19. Creating the vending machine bot with follow up intents
If you remember, this is what the state diagram for the vending machine bot looked like. More...
If you like to learn from videos, check out my Intro to Dialogflow course:
New to API.AI?
Also check out my eBook which talks about the 10 features all API.AI developers MUST know.