Using OOB Tags in AIML: Part I
Suppose you are building an Intelligent Virtual Agent or Virtual Personal Assistant (VPA) that uses a Pandorabot as the natural language processing engine. You might want this VPA to be able to perform tasks such as sending a text message, adding an event to a calendar, or even just initiating a phone call. OOB tags allow you to do just that!
OOB stands for “out of band,” which is an engineering term used to refer to activity performed on a separate, hidden channel. For a Pandorabot VPA, this translates to activities which fall outside of the scope of an ordinary conversation, such as placing a phone call, checking dynamic information like the weather, or searching wikipedia for the answer to some question. The task is executed, but does not necessarily always produce an effect on the conversation between the Pandorabot and the user.
What does an OOB tag look like?
OOB tags are used in AIML templates and are written in the following format: <oob>command</oob>. The command that is to be executed is specified by a set of tags which occur within the <oob> tags. These inner OOB tags can be whatever you like, and the phone-related actions they initiate are defined in your applications code.
To place a call you might see something like this: <oob><dial>some phone number</dial></oob>. The <dial> tag within the <oob> tag sends a message to the phone to dial the number specified. When your client indicates they want to dial a number, your application will receive a template containing the command specified inside the OOB tag. Within your application, this inner command will be interpreted and the appropriate actions will be executed.
It is useful to think of the activities initiated by oob tags as falling into one of two categories, based on whether they return information to the user via the chat interface or not.
The first category, those that do not return information, typically involve activities that interrupt the conversation. If you ask your VPA to look up restuarants on a map, it will open up your map application and perform a search. Similarly, if you ask your bot to make a phone call, it will open the dialer application and make a call. In both of these examples, the activity performed interrupts the conversation and displays some other screen.
The second category, those that do return information to the user via the chat interface, are generally actions that are executed in the background of the conversation. If you ask your Pandorabot to look up the “Population of the United States” on Wikipedia, it will perform the search, and then return the results of the search to the user via the chat window. Similarly, if you ask your Pandorabot to send a text message to the friend, it will send the text, and then return a message to the user via the chat window indicating the success of the action, i.e. “Your text message was delivered!”
In this second set of examples, it is useful to distinguish between those activities whose results will be returned directly to the user, like the Wikipedia example, and those activities whose successful completion will simply be indicated to the user through the chat interface, as with the texting example.
Here is an example of a category that uses the phone dialer on android.
<category> <pattern>DIAL *</pattern>
<template>Calling <star/>. <oob><dial><star/></dial></oob> </template>
Here is an example interaction this category would lead to:
Human: Dial 1234567.
Robot: Calling 1234567.
Here is a slightly more complicated example involving the oob tag, which launches a browser and performs a google search:
<pattern>SEARCH THE WEB FOR *</pattern>
<template> <srai>RANDOM SEARCH PHRASE</srai> <oob><search><star/></search></oob> </template>
Human: Look up Pandorabots.
Robot: Searching…Searching… Please stand by.
Note: not shown in the previous example is the category RANDOM SEARCH PHRASE, which delivers a random selection from a short list of possible replies, each indicating to the user that the bot correctly interpreted their search request.
Be sure to look out for the upcoming post “Using OOB Tags in AIML: Part II”, which will go over a basic example of how to intrepret the OOB tags received from the Pandorabots server within the framework of your own VPA application.
Originally published at blog.pandorabots.com on October 9, 2014.