Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error code: InvalidIntentSamplePhraseSlot -

I got the error code Error code: InvalidIntentSamplePhraseSlot when I built the model using the new skills console. The full error message is

Sample utterance "AddBookmarkIntent i am at {pageno} of {mybook}" in intent "AddBookmarkIntent" cannot include both a phrase slot and another intent slot. Error code: InvalidIntentSamplePhraseSlot - 

where {pageno} is AMAZON.NUMBER and {mybook} is AMAZON.SearchQuery

What is the error about and how can I solve it?

edit: add the JSON for the intent

{
    "name": "AddBookmarkIntent",
    "slots": [
        {
            "name": "mybook",
            "type": "AMAZON.SearchQuery"
        },
        {
            "name": "pageno",
            "type": "AMAZON.NUMBER"
        }
    ],
    "samples": [
        "i am at {pageno} of the book {mybook}",
        "save page {pageno} to the book {mybook}",
        "save page {pageno} to {mybook}",
        "i am at {pageno} of {mybook}"
    ]
}
like image 771
TinyEpic Avatar asked Jan 29 '23 15:01

TinyEpic


1 Answers

It's not allowed to have a slot of the type AMAZON.SearchQuery in the same Utterance with another slot, in your case AMAZON.NUMBER.

Mark one of the slots as required and ask for them separately.

A little example:

Create the Intent put in the utterances and slots:

"intents": [
    {
      "name": "AddBookmarkIntent",
      "samples": [
        "I am at {pageno}"
      ],
      "slots": [
        {
          "name": "mybook",
          "type": "AMAZON.SearchQuery",
          "samples": [
            "For {mybook}"
          ]
        },
        {
          "name": "pageno",
          "type": "AMAZON.NUMBER"
        }
      ]
    }

Mark the specific slot as required so Alexa will automatically ask for it:

"dialog": {
  "intents": [
    {
      "name": "AddBookmarkIntent",
      "confirmationRequired": false,
      "prompts": {},
      "slots": [
        {
          "name": "mybook",
          "type": "AMAZON.SearchQuery",
          "elicitationRequired": true,
          "confirmationRequired": false,
          "prompts": {
            "elicitation": "Elicit.Intent-AddBookmarkIntent.IntentSlot-mybook"
          }
        }
      ]
    }
  ]
}

and create the prompts to ask for the slot:

"prompts": [
  {
    "id": "Elicit.Intent-AddBookmarkIntent.IntentSlot-mybook",
    "variations": [
      {
        "type": "PlainText",
        "value": "For which book you like to save the page?"
      }
    ]
  }
]

This is probably much easier with the skill builder BETA and not its editor because it will automatically create the JSON in the background.

like image 84
Genfood Avatar answered Feb 12 '23 09:02

Genfood