Create and Edit Custom Slot Types


This document describes how you create custom slot types and how you extend built-in slot types.

Overview of custom slot types

A custom slot type defines a list of representative values for the slot. You use custom slot types for lists of items that aren't covered by the built-in set of types. When you create a custom type, you define the type and its values, and specify the name of the type as part of the intent definition.

In the PlanMyTrip intent example, you might define a custom slot type of travel activities to use with the activity slot type. The type could be named LIST_OF_ACTIVITIES and have these values:

bicycling
bike
biking
camp
camping
hike
hiking
race
run
shop
shopping
ski
skiing
surf
surfing
swim
swimming

This would support utterances such as "I'm visiting Portland to go hiking," and "I'm visiting Portland to hike."

The set of custom values can be anything supported by your skill's handling of the slot as long as it can be spoken by a user, although words not found in a typical dictionary for the skill's language might not be recognized.

Slot values are sent to your skill in written format. For example, both "fire h. d. 7" and "fire h. d. seven" would be sent to your skill as "Fire HD7". For better recognition, acronyms and other phrases involving spoken letters should either be all caps ("HD") or separated by periods and a space ("h. d. "). Using lowercase for initialisms might lead to unreliable recognition because the spoken form might not correctly be detected. See examples.

A custom slot type is not the equivalent of an enumeration. Values outside the list are still returned if recognized by the spoken language understanding system. Although input to the slot type is weighted towards the values in the list, it is not constrained to just the items on the list. You can either perform validation and error checking in your own code, or define slot validation rules in your dialog model and then delegate the dialog to Alexa to prompt the user for acceptable values.

For recommendations for custom slot type values, see Recommendations for Custom Slot Type Values.

The same custom slot type can be used for multiple slots in the same skill.

View slot types used in your skill

The Slot Types section in the left-hand navigation displays all the slot types you've added to your skill. This includes the following:

To change a slot type name or update its values, select the slot type in the left-hand navigation to open the slot detail page. The Slots using section shows all of the slots and intents currently using that type.

Add or edit a custom slot type

Slot type names: The name of a custom slot type can contain alphabetic characters and the underscore ("_") only. The dot character (.) is allowed only for built-in types (such as AMAZON.City).

For limits on the number of slot types you can create in a single skill, see Interaction model limits.

To add a new custom slot type

  1. From the left-hand navigation, click Slot types.
  2. Click Add Slot Type.
  3. Select the Create a custom slot type with values option.
  4. Enter a name for the slot type and click Next.
  5. Enter each value and click the plus or press Enter.

  6. You can add slot value IDs and synonyms to a slot value after you save the value:
    • Click in the ID column for a value to edit its ID.
    • Click in the Synonyms column for a value to enter a synonym, then click the plus or press Enter to save it.

    For more about using IDs and synonyms for a slot type value, see Define Synonyms and IDs for Slot Type Values (Entity Resolution).

  7. Click Save to save your work as you make changes.

To edit slot type values

  1. Click the name of the slot type under Slot Types to open the detail page for the slot type.
  2. Enter each value and click the plus or press Enter. For recommendations for slot type values, see Custom Slot Type Values.
  3. Click in the ID column for a value to edit its ID.
  4. Click in the Synonyms column for a value to enter a synonym, then click the plus or press Enter to save it.
  5. Be sure to save your work as you make changes.

To change the name of a custom slot type

  1. Click the name of the slot type under Slot Types to open the detail page for the slot type.
  2. Click into the field for the slot type name. Edit the name and click Save.

Custom slot type values

The slot values provided in requests to your service are provided in standard written form.

For example, the following table illustrates some example slot type values and how they're converted to written form when provided to your service. In this table, the Slot Value is the value you would provide in your list of custom slot values. The Spoken Form represents what the user says, and the Slot Value Output is the data sent to your service in the request.

Slot Value Spoken Form & Slot Value Output
خمس تفاحات خمس تفاحات
اربع سنتمترات اربع سنتمترات
اربع نجوم اربع نجوم
amazon.com امازون دوت كوم
ahmed@company.com احمد ات كومباني دوت كوم
مليغرام مليغرام
كيلوغرام كيلوغرام
مية الف مية الف
وعنب وعنب
عنب عنب
القطة القطة
قطة قطة

Where grammatically appropriate, include particles such as و (and), ل (to), لل (to the) and عال (on the) in the skill's slot values. Particles cannot precede a slot in a carrier phrase as they must be attached to the following word. Depending on the content of the slot, you may need to include more or fewer variations.

English sample utterance Arabic (SA) sample utterance Arabic (SA) example Slot values to include in interaction model Slot value Output

add itemOne and itemTwo to my shopping list

ضيفي

  • ItemOne
  • ItemTwo

ضيفي عنب وتفاح لعربة التسوق حقي

  • عنب
  • وتفاح
  • عنب
  • وتفاح

add itemOne and itemTwo to my shopping list

ضيفي

  • ItemOne
  • ItemTwo

ضيفي تفاح وعنب لعربة التسوق حقي

  • تفاح
  • وعنب
  • تفاح
  • وعنب

play Animal sound

شغلي صوت Animal

شغلي صوت قطة

  • قطة
  • قطة

play the Animal sound

شغلي صوت Animal

شغلي صوت القطة

  • القطة
  • القطة
Slot value Spoken form Slot value output
DJ d. j. DJ
PJ Harvey p. j. harvey PJ Harvey
five apples five apples 5 apples
four inch four inch 4"
4 inch four inch 4"
four star four star 4 star
4-star four star 4 star
all-in-one all in one all in 1
first amendment first amendment 1st amendment
John's john's John's
Ford Motor co. ford motor company ford motor company
Cambridge Univ. cambridge university Cambridge university
Seattle, Washington seattle washington Seattle Washington
R&B r. and b. R&B
r. and b. r. and b. R&B
amazon.com amazon dot com amazon dot com
joe@example.com joe at example dot com joe at example dot com
Fire HD fire h. d. fire HD
Fire h. d. fire h. d. fire HD
Fire HD7 fire h. d. seven fire HD7
Fire HD 7 fire h. d. seven fire HD7
ounces ounces ounces
milligrams milligrams milligrams
kilograms kilograms kilograms
KG k. g. KG
k. g. k. g. KG
eighth eighth eighth
mr mister mister
100000 one hundred thousand 100000
Slot Value Spoken Form Slot Value Output in de-de
kevin kevin kevin
ABC a. b. c. ABC
29 neun und zwanzig 29
1 2 3 eins zwei drei 123
29000 neun und zwanzig tausend 29000
1,8 / 1.8 eins punkt acht / eins komma acht 1,8
8 8 8 acht acht acht 888
1907 neunzehn hundert und sieben 1907
90er neunziger 90er
2. zweiter 2.
BBC2 / NDR1 b. b. c. two / n. d. r. eins BBC2 / NDR1
kindermusik kinder musik kindermusik
Fire HD
Fire HD7 / Fire HD 7
fire h. d.
fire h. d. sieben
fire HD
fire HD7
Dr. Oetker doktor oetker doktor oetker
gramm gramm gramm
g. g. G
G g. G
milligramm milligramm milligramm
m. g. m. g. MG
MG m. g. MG
kilogramm kilogramm kilogramm
KG k. g. KG
k. g. k. g. KG

Note that acronyms and initialisms are indicated using all caps. Alternatively, use lowercase letters separated by spaces and periods. Using lowercase without periods (such as "fire hd") might lead to unreliable recognition because the spoken form might not be correctly detected.

In all other cases, capitalization doesn't matter. You can use uppercase or lowercase. Numbers can be either spelled out or numeric (such as "seven" or "7").

Note that Umlauts (ä, ü, ö) and sharp S (ß) must not be spelled differently. For example, use "büro" not "buero", and "fußball" not "fussball", to prevent unreliable recognition. Different spellings might even change the meaning of words, for example "masse" vs. "maße".

Also see Recommendations for Custom Slot Type Values.

Synonyms and unique identifiers for slot type values

Each value in a custom slot type can have a unique identifier and a set synonyms. This lets you tie multiple possible utterances together and get a common ID and value in the IntentRequest, regardless of which value the user says. For example, for a MEDIA_TYPE slot intended to collect a particular type of media, a user might say "song", "track", or "single". All three of these utterances can be tied to the single slot value "song" with the unique identifier SONG.

For more about how synonyms and IDs work, see Define Synonyms and IDs for Slot Type Values (Entity Resolution).

Edit or upload slot type values in bulk

You can use bulk edit to quickly enter or edit slot type values. This can be useful for copying and pasting values from other files.

When editing in bulk edit or importing values, each row becomes a separate slot value. You can use a comma-separated values format to provide identifiers and synonyms:

Slot value,identifier,synonym,synonym,...

You can provide any number of synonyms for a given slot value.

For example, this file would import two slot values: "driving", with the ID DRIVE and four synonyms, and "flying" with the ID FLY and two synonyms:

driving,DRIVE,auto,automobile,taking a road trip,road trip
flying,FLY,fly,airplane

To bulk edit or import sample values:

  1. Click the name of the slot type under Slot Types to open the detail page for the slot type.
  2. Click Bulk Edit.
  3. Either edit the values in the edit box, or drag a CSV file to the window to import the contents.

    • Enter one slot value per line.
    • Importing a CSV file replaces the existing slot values shown in the edit box.
    • Select The CSV below contains headers to omit the top line shown in the text field.
    • Your changes to the values aren't saved until you click Submit.
  4. Click Submit.
  5. Click Save to save the changes to the slot type values.

Extend a built-in slot type with additional values

You can add your own custom values to a subset of the built-in list slot types. This action appends the values you provide to the built-in values defined by Amazon. For example, AMAZON.City provides recognition for cities. If you must collect additional cities – such as smaller towns that might not be included – you could add them to the list by extending the type. The slot would then recognize both the original set of values as well as the custom ones you added.

You can also define synonyms and identifiers for values you add to a built-in slot type. For details, see Entity Resolution for Built-in Slot Types.

Extending a built-in slot type only applies to the specific skill. For instance, if you extend AMAZON.City with additional cities for one skill, those changes don't apply to any other skills that also use AMAZON.City.

Before you can extend a built-in type, you must add it to your skill. In the left-hand navigation, view the types under Slot Types. If the slot type to extend isn't included, add it to your skill:

To add the slot type to extend

  1. On the Build page, navigate to Custom > Assets > Slot Types.
  2. Click + Add Slot Type.
  3. Select the Use an existing slot type from Alexa's built-in library option.
  4. Find the built-in slot type you want to add.
    You can filter the slot types by name.
  5. For each built-in type to add, click +Add Slot Type.
  6. To save your changes, click Save Model.

To extend a built-in slot type, add values to it just as you would a custom type.

To add values to a built-in slot type

  1. On the Build page, under Custom > Assets > Slot Types, select the slot type to edit.
  2. For Slot Values, enter a value, and then click the plus sign (+) or press Enter.
  3. To save your changes, click Save.

JSON for slot types (interaction model schema)

You can see and edit the JSON representation of all of your slot types in the JSON Editor. The interactionModel.languageModel.types property contains an array of slot type objects. Each custom slot type and each extended built-in type is represented in this array.

This example shows the types property for a custom type (LIST_OF_TRAVEL_MODES) and a built-in type that has been extended (AMAZON.City). For brevity, other properties within interactionModel and languageModel aren't shown. For details about the interaction model JSON, see Interaction Model Schema.

{
  "interactionModel": {
    "languageModel": {
      "types": [
        {
          "name": "LIST_OF_TRAVEL_MODES",
          "values": [
            {
              "id": "TRAIN",
              "name": {
                "value": "taking the train",
                "synonyms": [
                  "train",
                  "train ride"
                ]
              }
            },
            {
              "id": "FLY",
              "name": {
                "value": "flying",
                "synonyms": [
                  "jet",
                  "fly",
                  "on an airplane"
                ]
              }
            },
            {
              "id": "DRIVE",
              "name": {
                "value": "driving",
                "synonyms": [
                  "auto",
                  "automobile",
                  "taking a road trip",
                  "road trip"
                ]
              }
            }
          ]
        },
        {
          "name": "AMAZON.City",
          "values": [
            {
              "name": {
                "value": "custom city"
              }
            },
            {
              "name": {
                "value": "small town"
              }
            }
          ]
        }
      ]
    }
  }
}

Was this page helpful?

Last updated: Jan 16, 2024