Amexon alexa development InvalidIntentSamplePhraseSlot issue

286 Views Asked by At

I'm getting an error: cannot include both a phrase slot and another intent slot. Error code: InvalidIntentSamplePhraseSlot while building Alexa skill.

Sample JSON is as follows,

{
"name": "HackathonListIntent",
"slots": [
    {
        "name": "resultCount",
        "type": "AMAZON.NUMBER"
    },
    {
        "name": "search1",
        "type": "AMAZON.SearchQuery"
    },
    {
        "name": "search2",
        "type": "AMAZON.SearchQuery"
    }
],
"samples": [
    "{resultCount} for {search1} from {search2}",
]}

resultCount: skill fetch thousands of result from backend this parameter will restrict result length as per users convenience.

search1 and search2 are different independent search parameter which user may ask.

FYI: I have tried this

2

There are 2 best solutions below

0
On

For the InvalidIntentSamplePhraseSlot issue, according to Amazon's documentation, you can only use one AMAZON.SearchQuery slot per intent.

"Make sure that your skill uses no more than one AMAZON.SearchQuery slot per intent."

https://developer.amazon.com/docs/custom-skills/slot-type-reference.html#amazonsearchquery

Also, for your sample entry make sure the array with one item does not include a comma. It will cause an Invalid JSON error.

"samples": [
    "{resultCount} for {search1} from {search2}"
]}
0
On

AMAZON.SearchQuery are limited to 1 slot per intent and also it will need a phrase along with the slot. I would suggest you to use AMAZON.Person as it can take any value and dose not need a phrase.

              {
                "name": "HackathonListIntent",
                "slots": [
                    {
                        "name": "resultCount",
                        "type": "AMAZON.NUMBER" 
                    },
                    {
                        "name": "search2",
                        "type": "AMAZON.Person"
                    },
                    {
                        "name": "search2",
                        "type": "AMAZON.Person"
                    }
                ],
                "samples": [
                    "{resultCount} for {search1} from {search2}"
                ]
            }