Migrate Slot Types that Used AMAZON.LITERAL


Migrate AMAZON.LITERAL to a custom slot type

Custom slot types provide a better way to define possible values and use them within utterances. They also reduce the number of sample utterances you need, since the values are not defined within the utterances.

  1. Go to https://developer.amazon.com/alexa/console/ask.
  2. Click Skills.

    The developer console opens and displays any skills you have already created.

  3. Edit the skill to update.
  4. Create a new custom slot type for the slot that currently uses AMAZON.LITERAL.
  5. Add all your sample values from your LITERAL slot to the new custom slot type.

    The sample slot values are in your utterances, to the left of the | character.

  6. Edit the intent that uses the slot with LITERAL and change the slot type to the new custom slot type.
  7. Remove the sample values within the utterances.
  8. Remove any duplicate sample utterances.
  9. Save and build your model.

You can also use the JSON Editor to make the changes directly to the interaction model JSON.

Example of AMAZON.LITERAL converted to a custom slot type

The following example shows the difference between AMAZON.LITERAL and a custom slot type for a simple interaction model.

This model uses the custom slot type LIST_OF_SIGNS as the type for the Sign slot.

{
  "interactionModel": {
    "languageModel": {
      "intents": [
        {
          "name": "GetHoroscope",
          "slots": [
            {
              "name": "Sign",
              "type": "LIST_OF_SIGNS"
            }
          ],
          "samples": [
            "give me the horoscope for {Sign}",
            "what is the horoscope for {Sign}",            

            "...additional unique utterances showing different phrasing"
          ]
        }
      ],
      "types": [
        {
          "name": "LIST_OF_SIGNS",
          "values": [
            {"name":{"value":"sagittarius"}},
            {"name":{"value":"scorpio"}},
            {"name":{"value":"libra"}},
            {"name":{"value":"virgo"}},
            {"name":{"value":"leo"}},
            {"name":{"value":"cancer"}},
            {"name":{"value":"gemini"}},
            {"name":{"value":"taurus"}},
            {"name":{"value":"aries"}},
            {"name":{"value":"pisces"}},
            {"name":{"value":"aquarius"}},
            {"name":{"value":"capricorn"}}
          ]
        }
      ]
    }
  }
}

This model uses the deprecated AMAZON.LITERAL slot type. Note the need for duplicate sample utterances to specify the different values for the Sign slot.

{
  "interactionModel": {
    "languageModel": {
      "intents": [
        {
          "name": "GetHoroscope",
          "slots": [
            {
              "name": "Sign",
              "type": "AMAZON.LITERAL"
            }
          ],
          "samples": [
            "give me the horoscope for {capricorn|Sign}",
            "give me the horoscope for {aquarius|Sign}",
            "give me the horoscope for {pisces|Sign}",
            "give me the horoscope for {aries|Sign}",
            "give me the horoscope for {taurus|Sign}",
            "give me the horoscope for {gemini|Sign}",
            "give me the horoscope for {cancer|Sign}",
            "give me the horoscope for {leo|Sign}",
            "give me the horoscope for {virgo|Sign}",
            "give me the horoscope for {libra|Sign}",
            "give me the horoscope for {scorpio|Sign}",
            "give me the horoscope for {sagittarius|Sign}",

            "what is the horoscope for {capricorn|Sign}",
            "what is the horoscope for {aquarius|Sign}",

            "...ten more instances of this phrase, one for each sample value",

            "...more phrasing varieties, each repeated 12 times to include each value"
          ]
        }
      ]
    }
  }
}

For more about custom slot types, see Create and Edit Custom Slot Types.


Was this page helpful?

Last updated: Nov 28, 2023