Error code: InvalidIntentSamplePhraseSlot -
Asked Answered
O

3

6

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}"
    ]
}
Oxeyed answered 20/2, 2018 at 19:37 Comment(0)
Z
9

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.

Zigrang answered 23/2, 2018 at 14:18 Comment(1)
This makes much sense to me. Thank you very much. I just wonder if this a kind of bug or they do this for a purpose.Oxeyed
E
1

The error is telling you that you have an Intent name in your Sample Utterance where it should only have Slots and it looks like you do.

"AddBookmarkIntent i am at {pageno} of {mybook}"

"AddBookmarkIntent" shouldn't actually be inside of the utterance. So turn your utterance into:

"i am at {pageno} of {mybook}"

I know that some of the documents show an example of the sample utterances with the Intent Name first, such as here. But that has a big warning near the top: enter image description here So you have to be careful about which documents you read and follow based on which way you are building your Alexa Skill.
Follow this if you are using the Skill Builder.

Equivocate answered 22/2, 2018 at 13:34 Comment(3)
Thanks for answering @Jay. However I don have AddBookmarkIntent in my utterance. Please see my update post for my JSON.Oxeyed
Ok thanks, yeah the updated JSON looks good to me. And you are not using "mybook" or "pageno" elsewhere as an intent name?Equivocate
No, I don't. The problem seems to be from this intent.Oxeyed
F
1

It unfortunately seems like an utterance can only reference 1 "Phrase" slot type.

For your specific case, it does look like there is now a non-phrase slot type AMAZON.Book in public beta; if you use that instead of AMAZON.SearchQuery it might work?

Src: https://developer.amazon.com/en-US/docs/alexa/custom-skills/slot-type-reference.html

Fell answered 21/3, 2021 at 18:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.