Earlier in the year, we introduced built-ins with 15 different intents (such as Stop, Cancel, Help, Yes, No) and 10 slot types (such as Date, Number, City, etc.) that made it easier for developers to create voice interactions. Today, the US preview of our new Alexa Skills Kit (ASK) built-in library is available to developers. This expands the library to hundreds more slots and intents covering new domains including books, video and local businesses. We chose these based on feedback from our developer community, as well as our own learnings with Alexa over the past year.
When you’re building a skill, it’s challenging to think of all the different ways your customers might ask the same question or express the same idea – all of which your skill would ideally need to understand. The new built-in intents and slots reduce your heavy-lifting by providing a pre-built model. For example, just including the following statement “SearchAction<object@LocalBusiness[telephone]>” makes your skill understand a customer’s request for phone numbers for local businesses.
Customer usage and your feedback is important for us to improve the accuracy of the library, which will increase over the course of the preview. To provide feedback during this developer preview or submit your questions, visit our Alexa Skills Kit developer forums, create a question, and use the “built-in library” topic. We appreciate your help!
The built-in intent library gives you access to built-in intents that fall into categories, such as the weather forecast which I will walk through below (check out the full list of categories here). You can use these intents to add functionality to your skill without providing any sample utterances. Using one of these new built-in intents in your skill is similar to using a standard built-in intent like AMAZON.HelpIntent:
The differences are:
Our weather example would have an intent schema like this:
{ "intents": [ { "intent": "AMAZON.SearchAction<object@WeatherForecast>" } ] }
Although no slots are defined in the above schema, an utterance like “what’s the weather today in Seattle” would send your skill a request with slots containing today’s date and the city “Seattle.”
These intents are designed around a set of actions, entities, and properties. The name of each intent combines these elements into an intent signature. In the above example the action is SearchAction, its property is object, and the entity is WeatherForecast.
In the current developer preview, built-in intents define a set of actions, entities, and properties. Similar to a programming language, the actions and entities have properties. These properties determine the intent signature and possible slots for the intent.
An action represents an action the user is trying to take, such as searching for information. For instance, SearchAction represents the “searching for information” action. An intent defined with SearchAction indicates that the user wants search or look up information.
Actions also have properties. Most actions operate on other entities. The object property identifies the entity on which it operates. In the case of SearchAction, the object property identifies the type of information the user wants to find.
An entity represents the objects that the actions can act on or use. Entities also have properties, which define attributes of the entity. For example, WeatherForecast is an entity that defines a weather forecast. It has properties such as location, duration, and temperature (among others). The properties are used both to pass data from the user’s utterance to your skill as slots, and to narrow the scope of the intent.
An intent signature starts with the action and sets the action’s properties to the entity types it acts on or uses with the following syntax:
AMAZON.Action<propertyName@Entity>
For example, to define the weather intent we described previously, the action is SearchAction, its property is object, and the entity is WeatherForecast:
AMAZON.SearchAction<object@WeatherForecast>
The @ sign in this context declares that the object property is of the type WeatherForecast. The syntax <object@WeatherForecast> means “object as WeatherForecast.”
This intent signature is telling Alexa to search for object as weather forecast. The intent signature corresponds to the intent name you use in your intent schema. In this weather forecast example, we would create the intent like this:
{ "intents": [ { "intent": "SearchAction<object@WeatherForecast>" } ] }
We would reference the intent in our cloud service as "SearchAction<object@WeatherForecast>". An example request object we would receive, would look like something like this:
{ "request": { "type": "IntentRequest", "intent": { "name": "SearchAction<object@WeatherForecast>", "slots": {} } }, }
Entity properties also have types. For some properties, the property type represents information that can map directly to AMAZON slot types. For example:
Some properties contain more complex information that must be sliced into finer-grained chunks to map to slot types. For example, the concept of “location” can mean many things. It could be a city, a state, a country, or even a specific street address. This is too broad to translate to a single slot. Therefore, the WeatherForecast.location property does not map directly to a slot type. Instead, WeatherForecast.location has a type representing a postal address. This type has its own properties representing the finer-grained parts of a location, such as city, region, and state. You can see a full list of WeatherForecast properties here.
You may also want to define intents that respond to more specific questions. For example, our weather skill can respond to generic requests for the forecast (“what is the weather”), but you might want to know when users ask more specific questions about the weather. For instance, you might want your skill to handle these utterances differently:
In the more specific utterance, the user has actually referred to the name of the WeatherForecast.temperature property.
You can use an intent signature that instructs Alexa to trigger a more specific intent when the user mentions a property name with this syntax:
Action<propertyName@Entity[propertyName]>
For example, if you put the intent signature SearchAction<object@WeatherForecast[temperature] in your intent schema, utterances that mention the property name temperature send this intent. More generic utterances that do not include this property name do not trigger the intent.
You can include multiple intents for the same entity. For instance, you can create the following schema to handle weather forecasts and temperatures:
{ "intents": [ { "intent": "AMAZON.SearchAction<object@WeatherForecast>" }, { "intent": "AMAZON.SearchAction<object@WeatherForecast[temperature]>" }, { "intent": "CustomIntent" } ] }
Currently, each entity has a fixed set of properties that can be used to scope an intent in this way. See the full list of intents for each entity here.
The Alexa Skills Kit built-in library offers hundreds of new interactions for your skills. It’s not just weather either! You can use the power of the built-in library to craft thousands of unique intents by combining Actions, Entities and Properties. We will continue to expand the available intents and slots in the built-in library over time and look forward to hearing your feedback during this developer preview.
For more information about getting started with the Alexa Skills Kit built-in library, check out the following:
Understanding the Structure of the Built-in Intent Library
-Dave (@TheDaveDev)