# Amazon Alexa

## Summary


Amazon Alexa is cloud-based voice service to bring natural voice experiences to users. It can seen as a virtual assistant with the capability to interact with users using voice rather than traditional computer interfaces of keyboard, mouse or monitor.

Initially, Alexa was released as the backend support service for Amazon's Echo device, a voice-activated connected speaker. Since then, Alexa has become smarter. It's been interfaced to a number of products beyond Amazon's Echo series of devices. It's moved from being just a smart speaker to central controller of your smart home.

## Discussion

### What are typical uses of Amazon Alexa?

When Amazon Echo was released in 2014, Alexa could answer basic questions, add items to a shopping cart or play your favourite music album. Today, developers can add new capabilities to Alexa. Capabilities exist for managing chores, telling stories, quizzing, and gaming. 

Alexa can integrate with web services for ordering something, getting information, etc. It can control or query smart devices connected to the cloud. For example, you can ask to see the feed from a remote camera or dim the lights. In fact, Alexa's importance in the smart home is set to grow as it aims to handle complete home automation. 

In terms of some specific examples, Xbox One console will soon support Alexa so that gamers can issue voice commands. A number of lighting solutions can be controlled via Alexa: Philips Hue LED, Lifx, TP-Link, Osram, Stack LED. In healthcare space, Alexa has been used to get information on drug side-effects, medication schedule or gather patient survey. 


### As a developer, what can I build with Alexa?

With Alexa, three things are possible: 

    + Develop capabilities to Alexa for new use cases. These capabilities are called *skills*. **Alexa Skills Kit (ASK)** is a set of APIs, tools and documentation to help you develop skills.
    + If you wish to create a hands-free voice interface in your own products, use the **Alexa Voice Service (AVS)**. Your products can then leverage Alexa's features. A simple example is to make your Raspberry Pi work with Alexa as explained in a detailed tutorial.
    + Let your customers control their connected devices in smart homes and other gadgets. Devices can reach Alexa via the Internet or via a local hub. Developers need to use **Smart Home Skill API** and **Gadgets API**.

### What are the languages supported by Alexa?

As of August 2018, Alexa's skills can support English, French, German, Italian, Japanese and Spanish. A device (such as Echo) when set to a particular language can access any skill available in that language. As a developer, you can publish your skill in multiple languages to target a wider user base. 

From a programming perspective, if the business logic of your skill is deployed on AWS Lambda, then any programming language that Lambda supports can be used: Node.js, Java, Python, or C#. Or you can deploy it as a web service on any cloud infrastructure. This means that you can code in any language, though the data is JSON via REST. 


### What's the architecture of Alexa?

Alexa resides in the cloud. Access is via the Alexa Voice Service API. Alexa receives requests as speech streams. Alexa analyzes the speech and identifies the requested skill. A structured representation of the skill and intent is created. 

Now there are two possible paths. If the skill code is deployed in AWS Lambda, that service will be triggered within AWS. If it's a web service accessed via HTTPS then the REST API call is made. In either case, Alexa will receive the response as text. Optionally, the response may have images. Alexa will convert the text into speech, which gets streamed to the user via their current device. Images will be served where the device has a display. 

A skill is identified by an *invocation name* and mapped to a backend service. A skill can be designed to do multiple things, each of which is called an *intent*. Each intent can be identified by one or more words or phrases, each of which is called an *utterance*. For example, you may create a travel-related skill that has three intents: rent a car, book a flight, or book a hotel.


### Could you define some Alexa-specific terminology?

Here are a few essential terms and more are available in the Alexa Skills Kit Glossary: 

    + **Skills**: A capability of Alexa. Alexa comes with built-in skills, such as playing music. Developers can also build new skills.
    + **Intents**: The main request or action associated with the user's command for a custom skill.
    + **Slots**: Arguments to an intent that provide Alexa more information. These can be required or optional.
    + **Utterances**: Words users say to convey what they want Alexa to do or in response to a question.
    + **Interaction Model**: The words and phrases users can say to make a skill do what they want. It determines the requests the skill can handle and the words users say to invoke those requests.
    + **Invocation**: The act of beginning an interaction with a particular Alexa ability.
    + **Wake word**: A word that "wakes up" Alexa for a task. Typically, this word is "Alexa".
    + **Cards**: Elements displayed in a visual interface to describe or enhance voice interaction.

### What technologies power Alexa under the hood?

Two fundamental technologies required to make Alexa work are speech-to-text and text-to-speech conversions. To make these work reliably, Alexa employs deep learning algorithms. More specifically, we have two technologies, both of which were opened for developers in November 2016: 

    + **Amazon Lex**: This does the speech-to-text conversion using techniques of *Automatic Speech Recognition* and *Natural Language Understanding*. It can be used independently of Alexa to build conversational interfaces (such as chatbots) using a mix of voice and text.
    + **Amazon Polly**: This does the text-to-speech conversion by synthesizing speech in various languages and accents. In May 2018, Alexa developers got access to eight different voices from Amazon Polly. In fact, we can use *Speech Synthesis Markup Language (SSML)* to generate natural-sounding speech. One researcher showed how SSML can be used to teach Alexa to speak with a Boston accent.

### What resources are available to learn about programming for Alexa?

A good place to start is the Voice Design Guide. This includes a design checklist and a glossary. There are also guides on using Amazon Skill Builder.

As a tutorial, you can start with this 6-step tutorial to build a fact skill. An easier way to get started is to use Alexa Skill Blueprints. These are templates that you can customize to make your own skill. Alexa on GitHub contains open source code.

There are some useful developer tools. There are also open source frameworks for building voice apps. Two such frameworks are Jovo and Violet. These frameworks are cross-platform; that is, from a single codebase they can target Amazon Alexa, Google Assistant, etc. Though not open source, Alexa Flow is a tool to easily create, manage and host your custom skills without coding knowledge. An alternative is Storyline that offers a visual drag-n-drop design interface, previews, deployment and analytics. Many more tools, SDKs and platforms are listed in Wolter's blog.

Blogs specific to Alexa are useful to get latest news or learn best practices. From the main Alexa website you can access all Alexa-specific documentation.

## Milestones

Nov  
2014

**Amazon Echo** becomes available by invite only to select Amazon Prime customers. This is a voice-activated connected speaker that can act on user requests or answer basic questions. It's actually powered in the cloud by a virtual assistant called **Alexa**. 

Jun  
2015

To enable third-party integration of Alexa into their connected devices, **Alexa Voice Service (AVS)** is released. In April 2016, Invoxia becomes the first maker to release Alexa service on a non-Amazon device. Called *Triby*, it's a kitchen device that can set timers, play music or read sports scores. 

Apr  
2016

The **Alexa Smart Home API** is launched. In May 2017, with the **Smart Home Skill API**, both users and developers can use appliance categories (camera, light, smartlock, etc.) to easily identify device types. 

Apr  
2017

Amazon brings out the **Alexa Skill Builder**, a more intuitive interface to build skills including the interaction model and multi-turn dialogues. Work on this started back in October 2016. 

Apr  
2018

Amazon releases **Alexa Skill Blueprints**. These are skill templates that you can customize rather than develop custom skills from scratch. 

May  
2018

Developers cannot sell Alexa skills but Amazon enables **In-Skill Purchasing (ISP)**. If a skill drives user engagement, Amazon also offers rewards to developers. Amazon releases a preview in which developers can choose any of eight U.S. English voices to narrate skills. This is powered by **Amazon Polly**. 

Aug  
2018

Amazon releases **Alexa Auto SDK** on GitHub. Automobile makers can integrate Alexa directly into their vehicles. Amazon announces **Quick Start Templates** to accelerate skill development for popular skill samples.