Design the Custom Slots for Your Skill

What custom slots are

You can create custom slots to collect words or phrases that represent variable information within your sample utterances. Slot values can be used in place of variable information within the sample utterances of an intent. This means you will avoid having to write out different variations of the sample utterance multiple times. Let’s imagine that you’re creating a horoscope skill, and you need to cover all 12 horoscopes. If you create sample utterances that cover these values, you may end up with something like this:

Intent name Sample utterance

HoroscopeIntent

i want the horoscope for capricorn
i want the horoscope for aries
i want the horoscope for sagittarius
i want the horoscope for pisces
i want the horoscope for leo

The final word in each of the utterances displayed above represent variables within the sample utterance. These are parts of the utterance that can accommodate a variety of different words or phrases a user might say . Rather than include lots of different variants of the same sample utterance, you can instead use a Custom slot. This allows you to cover all a wide variety of potentials with a single sample utterance. When creating the sample utterances for your Horoscope skill utilizing a custom slot, you may end up with something that looks like this:

Intent name Custom slot ZodiacSign contains Sample utterance

HoroscopeIntent

aries
taurus
gemini
cancer
leo
virgo
libra
scorpio
sagittarius
capricorn
aquarius
pisces

i want the horoscope for {ZodiacSign}
get me the horoscope for {ZodiacSign}
what is the horoscope for {ZodiacSign}
{ZodiacSign} horoscope please
tell me the {ZodiacSign} horoscope

Here, you’ve covered all 12 variants of the zodiac sign in your custom slot. All sample utterances within the intent have 12 different variants, without having to type out each of the 12 zodiac signs each time. This allowing you to focus on the diversity of sample utterance wording, rather than repeating utterances.

Best practices for custom slots

Coverage

  • You should aim to cover as wide a variety of customer phrasing as possible. If this is just a list of zodiac signs as above, then this won’t necessarily need to be a long list of values. If the list of possible inputs is much longer (such as a list of ingredients), ensure the values reflect expected word counts (e.g. cover “salt” as well as “sea salt”, “kosher salt”, and “table salt”). You can make use of suggested slot values when building the slot in the developer console.
  • Make use of slot synonyms to increase coverage. If there are different ways that a user could refer to a slot value, make use of synonyms to ensure variants are covered. For example, if your skill has the slot value “phone”, you may want to add synonyms like “mobile phone”, “mobile”, or “telephone”. This ensures these phrasings are covered in the interaction model, and will still route to the slot value “phone” if users use these variants.
  • Custom slot types should use more than one slot value. Synonyms of that slot value count towards the overall number of values for the slot. If the slot only contains one value, and you can’t add any more to it, use that value in the sample utterances of the instead.

Formatting

  • You should remove any unnecessary symbols such as parentheses, ampersands, and hyphens from values. Unlike sample utterances, acronyms in slot values can be represented with both capitalized lettering with no spaces or periods (USA) and lowercase lettering with periods and spaces (u. s. a.). In slot values, numbers can be written both as their numerical and word form (e.g. both “5“ and “five” are acceptable). Correct tokenization and spelling of all slot values is required to ensure that the slot is recognized correctly and functions as intended.
  • Do not include carrier phrasing in your slot values. Carrier phrasing, in this instance, covers any non-variable portion of the sample utterance. Let’s take the example phrase “what is the horoscope for {slot value}”. This utterance breaks down into two parts:
Carrier phrase Slot value

what is the horoscope for

capricorn

what is the horoscope for

leo

what is the horoscope for

taurus

None of the carrier phrase part of the utterance, which is the part of the utterance that never changes, should appear in the slot values of the slot type.

How to use custom slots in the interaction model

  • Keep different types of data in separate slots. For example, you'd want two separate slots for zip codes and city names. As a tip, try and give your slot a distinct definition for the values included within it. If you can’t give your slot a clear definition, it’s likely too broad, and you should consider splitting the data into different slot types.
  • As stated in Design the Sample Utterances and Intents for Your Skill, there should be no exactly matching sample utterances across intents. Therefore, ensure your slots do not cause overlapping sample utterances. Where possible, include different values in each slot. If a slot is used in multiple intents, ensure those intents have unique sample utterances where the slot is used. In cases where 2 different slots must contain the same value, take extra care to avoid overlapping sample utterances. For example, a pizza skill with a “Topping” slot that contains ingredients "(e.g. "pepperoni", "ham", "mushroom") and a “PizzaName” slot containing popular pizza types (“pepperoni”, “hawaiian”). Both slots contain the value “pepperoni”. Should these slots be used in different intents, you should ensure that any sample utterances utilizing them are unique (e.g. you could not have “I want {Topping}” and “I want {PizzaName}” in different intents. If the user said “i want pepperoni”, the skill cannot distinguish which intent to send the utterance to).
  • Slot types must be tied to a slot within the intents of the skill and used in the sample utterances. If the slot types are not tied to an intent and not used in sample utterances, users cannot access the content in the slot.
  • All slots must be used only once per sample utterance. For example, you cannot include a sample utterance in you skill such as “i want {ingredient} and {ingredient}”. Instead, you should name these slots differently, e.g. “i want {ingredient1} and {ingredient2}”. Both slots can still be tied to the same slot type as long as their names are different.

How to make the most out of custom slots

  • Make use of dynamic entities to improve coverage in your skill. Dynamic entities can be thought of as an extension to the interaction model (specifically its slot values) on the back end of the skill. You can personalize the Alexa skill experiences by adapting the interaction model at runtime without edits, builds, or re-certification. This allows your skill to handle customer, context, and conversational changes by updating or deactivating existing slot values from data structures in your code. For more information on dynamic entities, visit Use Dynamic Entities for Customized Interactions.
  • Use multiple-value slots (MVS) to capture multiple items separated with pauses, the conjunction "and", or a combination of the two. This means you don’t have to string together multiple slots to generate sample utterances, or make your skill ask multiple questions of the user to get a list of related items. For example, if a user says "order a pizza with pepperoni, mushrooms and black olives", these toppings are contained in the 'toppings' custom slot. You could cover this interaction with a sample utterance that uses the same slot type three times (e.g. "order a pizza with {topping1} {topping2} and {topping3}"). MVS negates the need for this and recognizes pauses or conjunctions to signal that the user is using multiple values from the same slot (e.g. "order a pizza with {topping}"). NOTE: MVS are only available in a limited number of locales. For more information on MVS, visit Collect Multiple Values in a Slot.
  • Utilize slot elicitation within your skill to gain slot input from a user. For example, in a horoscope skill, it is feasible that a user could simply say to the skill “give me my horoscope”. Using slot elicitation, you can deliver a prompt to the user, such as “Which horoscope would you like to hear?” and elicit the {ZodiacSign} slot. Slot elicitation creates a more fluid user experience, and negates the need for error messages should user input not be incomplete. For more information on slot elicitation, visit Dialog Interface Reference.