Life of Apps

First Look at Google's API.AI

API.AI is a chatbot development platform bought by Google last September. This is one of the prominent chatbot development platforms along with Facebook's Wit.ai and Microsoft's BotFramework. What I found unique about API.AI is that you can build a basic bot without writing any code. All the development happens within the browser and you can test it there.

So, what does it take to build a bot in API.AI?

Here are the key concepts that you need to build a bot in API.AI.

Intents: Intents are actions that perform a task and are defining them is usually the first step to build a bot. If I were to build a bot that gives me recommendations on tourist attractions. I would define intents such as recommendations for beaches, hill stations etc. So, a typical conversation could be:

User: show me some beaches in India
Bot: Here are some nice beaches - (may show pictures)

Entities: From the user's sentence above, beach would be identified as an entity. Hill station could be another. These would then be abstracted as an entity type called tourist attraction. This makes the conversation extensible as more entities and corresponding intents can be added. When the user requests a recommendation on beaches, the bot understands beach as a type of tourist attraction entity and invokes the beach recommendation intent. Again, no code is required to do this, just point and click to link the two.

Training: Once the intents and entities are defined, the bot is to be trained. This can be done through the test console within the browser's "console", which is the DEV environment. Each conversation is logged, it can be reviewed and the erroneous responses corrected. Sometimes, the bots can behave pretty poorly. For instance,

User: show me hills in India (instead of hill stations)
Bot: I am sorry I did not understand that

To make the bot respond, hills need to be included in the synonym for the hill stations entity. All such synonyms need to be entered to ensure that the bot responds correctly. Once added, repeat the training and correct the errors till there are none.

Integration: Once the bot is ready, it can be integrated with Facebook Messenger, Skype, Twitter, Slack, Google Assistant and many other platforms. Before making the bot public, the integrations make it easy to test the bot on the go through a mobile device.

Prebuilt Agents: API.AI provides prebuilt agents that range from engaging in small talk to helping book restaurants, flights and control home appliances. These agents come with prebuilt intents and entities that you can use to start from instead of building from scratch.

Fulfillment: In order to extend the functionality of bots such as invoking external APIs to check weather, make hotel bookings etc., API.ai provides integration capabilities through web hooks. Web hooks can point to external endpoints such as third party APIs or your own API hosted elsewhere.

The bot can be hosted on API.AI itself or any other platform with support for node.js. The interaction with the bot could be using HTTP RESTful calls or through one of the many languages that are supported through the SDKs.

Overall, I am impressed with the ease of use of the API.AI platform and will continue spending time with it in building a bot that can keep me amused :) 

Danesh

Visit Pleb.in for apps developed by Danesh

No comments :

Post a Comment

Leave a Comment...