Debug an Alexa Conversations Skill Model

To test user utterances and improve your Alexa Conversations skill model, you can use the debugging capability of the Alexa Simulator in the developer console.

Overview

In the developer console, you can interact with your skill by using the Alexa Simulator. In the Alexa Simulator, you can see how your Alexa Conversations skill model resolves to the Alexa Conversations model prediction (slots and actions).

The Alexa Simulator displays the resolved slots and actions in the Device Log section of the Alexa Simulator as a SkillDebugger.CaptureDebuggingInfo directive. When an utterance doesn't resolve to the correct slots or actions, you can update your Alexa Conversation model, build the model, and try again.

Debug your Alexa Conversations skill model

You can debug your Alexa Conversations skill model by using the Alexa Simulator in the developer console.

To debug your Alexa Conversations skill model

  1. Log in to the developer console, and then navigate to your Alexa Conversations skill.
  2. If you haven't built the skill model yet, do so. For details, see Build the Skill Model for Your Alexa Conversations Skill.
    You can't test your skill until the "light" Alexa Conversations model builds successfully.
  3. At the top, click the Test tab.
  4. On the left, at the top, for Test is disabled for this skill, select Development.
  5. Select the Device Log check box.
  6. In the Alexa Simulator, click Type or click and hold the mic, and then type open <invocation name>.
    If you don't remember the invocation name of your skill, you can view it on the Build tab.
  7. Interact with your skill by speaking or typing.
  8. In the Device Log section of the Alexa Simulator, click a SkillDebugger.CaptureDebuggingInfo directive to view the Alexa Conversations model prediction (resolved slots and actions).

    For the structure and fields of the SkillDebugger.CaptureDebuggingInfo directive, see Directive structure.

  9. (Optional) Refresh the page periodically so that you aren't sifting through accumulated data from previous turns.

Example output

The following screenshot shows an example model prediction for an Alexa Conversations weather skill.

Testing an Alexa Conversations Skill in the Alexa Simulator.

Directive structure

The SkillDebugger.CaptureDebuggingInfo directive of type ConversationsModelPrediction has the following format.

{
   "header": { ... },
   "payload": {        
       ...        
       "type": "ConversationsModelPrediction",
       "content": {
          "phrasesToSlots": [
             {
                "phrase": string,
                "slotType": string,
                "index": {
                   "start": integer,
                   "end": integer
                 }
             }
          ],
          "actions": [
             {
                "type": string enum ["API", "RESPONSE"],
                "name": string,
                "input": object,
                "output": object
             }
          ]
      }
   }
}

Parameters

The following table shows the parameters of a SkillDebugger.CaptureDebuggingInfo directive of type ConversationsModelPrediction.

Field Description

payload.type

Type of the payload in the SkillDebugger.CaptureDebuggingInfo directive.
Possible values: ConversationsModelPrediction.

payload.content.phrasesToSlots

Recognized phrase to slot mapping for user utterance.

payload.content.phrasesToSlots[n].phrase

Recognized phrase mapped to the slot in the user utterance.

payload.content.phrasesToSlots[n].slotType

Slot mapped to the phrase in the user utterance.

payload.content.phrasesToSlots[n].index

Index of the mapping.

payload.content.phrasesToSlots[n].index.start

Index start.

payload.content.phrasesToSlots[n].index.end

Index end.

payload.content.actions

Action sequence that Alexa runs for the user utterance.

payload.content.actions[n].type

Action type.
Possible values: API, RESPONSE

payload.content.actions[n].name

Action name.

payload.content.actions[n].input

Action input JSON.

payload.content.actions[n].output

Action output JSON.

Example model prediction

The following example shows a SkillDebugger.CaptureDebuggingInfo directive of type ConversationsModelPrediction (that is, the model prediction) for the user utterance, "I want to know the weather for Seattle today."

{
    "header": {
        "namespace": "SkillDebugger",
        "name": "CaptureDebuggingInfo",
        "messageId": "d78069b1-df34-4624-b9c1-EXAMPLE"
    },
    "payload": {
        "skillId": null,
        "timestamp": "2020-07-06T21:42:46.869Z",
        "dialogRequestId": "2705e572-7506-4f51-9bc9-EXAMPLE",
        "skillRequestId": "amzn1.echo-api.request.EXAMPLE",
        "type": "ConversationsModelPrediction",
        "content": {
            "phrasesToSlots": [
                {
                    "phrase": "seattle",
                    "slotType": "cityName",
                    "index": {
                        "start": 7,
                        "end": 8
                    }
                },
                {
                    "phrase": "today",
                    "slotType": "AMAZON.DATE",
                    "index": {
                        "start": 8,
                        "end": 9
                    }
                }
            ],
            "actions": [
                {
                    "type": "API",
                    "name": "GetWeather",
                    "input": {
                        "date": "today",
                        "city": "seattle"
                    },
                    "output": {
                        "lowTemp": 56.5,
                        "highTemp": 70.1,
                        "cityName": "seattle"
                    }
                },
                {
                    "type": "RESPONSE",
                    "name": "notify_api_response_GetWeather",
                    "input": {
                        "returnedWeatherResult": {
                            "lowTemp": 56.5,
                            "highTemp": 70.1,
                            "cityName": "seattle"
                        }
                    },
                    "output": {
                        "speech": {
                            "text": "In seattle, it's a high of 70.1 degrees and a low of 56.5 degrees.",
                            "phrasesToInputParameters": [
                                {
                                    "phrase": "70.1",
                                    "inputParameter": "returnedWeatherResult.highTemp",
                                    "index": {
                                        "start": 6,
                                        "end": 7
                                    }
                                },
                                {
                                    "phrase": "56.5",
                                    "inputParameter": "returnedWeatherResult.lowTemp",
                                    "index": {
                                        "start": 12,
                                        "end": 13
                                    }
                                },
                                {
                                    "phrase": "seattle",
                                    "inputParameter": "returnedWeatherResult.cityName",
                                    "index": {
                                        "start": 1,
                                        "end": 2
                                    }
                                }
                            ]
                        }
                    }
                }
            ]
        }
    }
}