Almond builds on top of Thingpedia, an encyclopedia of applications for the Internet services and IoT devices. Just like how Wikipedia stores knowledge about the world, Thingpedia stores knowledge about devices in the world. Wikipedia is organized around articles; Thingpedia is organized around devices, such as Twitter, a light bulb, or a thermostat. It creates an interoperable web of devices and let users program them in natural language. (We use the term device to refer to both IoT devices and Internet services.)
A device in Thingpedia can have two types of functions: query and action. Queries are free of side-effects and can return results, and actions have side effects, and cannot return results. Users can connect different queries and actions to accomplish complicated tasks with a single command, such as "Get my latest Instagram picture and post it on Twitter".
Any Almond virtual assistant has two major components: the Almond agent communicates with the users in natural language, and the Almond engine runs the commands issued by the users. The following diagram illustrates how Almond works internally:
A user issues a command, say “get my recent tweets”, in English.
Almond agent translates the command to the corresponding ThingTalk program and send it to Almond engine.
If the user has Twitter set up in his Almond, go to step 6. Otherwise, Almond engine requests the Twitter interface from Thingpedia.
Thingpedia returns the Twitter interface, and Almond engine run the ThingTalk program with the interface returned.
If needed, Almond prompts to the user to do authentication. For Twitter, user will be redirected to OAuth page to link his account to Almond.
Then Almond engine will call the Twitter API and get the result from Twitter.
The result will be reported to Almond agent.
Almond agent will send the result to the user.
We prepared a series of tutorials to show you how to create devices in Thingpedia.
Two major components,
dataset.tt, are needed.
manifest.tt contains the manifest of the device, describing what the device does, including the
authentication method and the signature of the functions;
dataset.tt contains example command-utterance pairs for training the natural language