Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alexa - catchall

I've got a chatbot which is plugged to backend and DialogFlow/ApiAI. I'm trying to set up a skill in Alexa so that I can catch everything that is said to my skill and then forward it to my backend so that i can use my existing infrastructure and convo design.

I've been struggling with Alexa to set up an intent that catch everything and just forward it. From what I understand, you are supposed to use AMAZON.SearchQuery, but I'm getting the following error when i try to set the intent up:

Build Failed Sample utterance "CATCH_ALL {any}" in intent "CATCH_ALL" must include a carrier phrase. Sample intent utterances with phrase types cannot consist of only slots. Error code: MissingCarrierPhraseWithPhraseSlot -

intent configuration

Does anyone know how to do so ? I tried to use AMAZON.Literal as well, but it seems to be deprecated and I cannot build the skill when i use it. I'm kinda stuck. It would be great if someone had a solution...

Thanks.

like image 387
JulienCoo Avatar asked Apr 20 '18 18:04

JulienCoo


2 Answers

I finally managed to do so by doing something like this:

    {
        "interactionModel": {
            "languageModel": {
                "invocationName": "test",
               "intents": [
                {
                "name": "AMAZON.CancelIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.StopIntent",
                    "samples": []
                },
                {
                    "name": "CATCHALL",
                    "slots": [
                        {
                            "name": "any",
                            "type": "AMAZON.LITERAL"
                        }
                    ],
                        "samples": [
                            "{hey|any}",
                            "{hey hey|any}",
                           "{hey hey hey|any}",
                            "{hey hey hey hey|any}",
                            "{hey hey hey hey hey|any}"
                        ]
                    }
                ],
                "types": []
            }
        }
    }

the samples for the intent CATCHALL indicates the number of word you want to catch. So lige this, i will catch any sentence between one and this 5 words.

I'm not sure if this is going to be a problem when I'll submit the app, though.

Note that AMAZON.LITERAL is not supported for any language other than English (US), so this is not a solution for me as it's a french and english chatbot. So i'm back again at the beginning...

edit: Here is the solution without LITERAL:

{ "interactionModel": { "languageModel": { "invocationName": "mon invocation", "intents": [ { "name": "AMAZON.CancelIntent", "samples": [] }, { "name": "AMAZON.HelpIntent", "samples": [ "que puis-je faire" ] }, { "name": "AMAZON.StopIntent", "samples": [ "je veux quitter" ] }, { "name": "CATCH_ALL", "slots": [ { "name": "any", "type": "ANYTHING" } ], "samples": [ "{any}" ] } ], "types": [ { "name": "ANYTHING", "values": [ { "name": { "value": "hey" } }, { "name": { "value": "hey hey" } }, { "name": { "value": "hey hey hey" } }, { "name": { "value": "hey hey hey hey" } }, { "name": { "value": "hey hey hey hey hey" } }, { "name": { "value": "hey hey hey hey hey hey" } }, { "name": { "value": "hey hey hey hey hey hey hey" } }, { "name": { "value": "hey hey hey hey hey hey hey hey" } }, { "name": { "value": "hey hey hey hey hey hey hey hey hey" } }, { "name": { "value": "hey hey hey hey hey hey hey hey hey hey" } }, { "name": { "value": "hey hey hey hey hey hey hey hey hey hey hey" } }, { "name": { "value": "hey hey hey hey hey hey hey hey hey hey hey hey" } } ] } ] } } }

like image 88
JulienCoo Avatar answered Nov 10 '22 13:11

JulienCoo


You can replace the AMAZON.SearchQuery with AMAZON.Person. Usually AMAZON.SearchQuery require a phrase along with the slot.Using AMAZON.Person there is no need of phrase along with the slot. It would accept any values that you pass to the Intent.

               {
                "name": "CATCH_ALL",
                "slots": [
                    {
                        "name": "any",
                        "type": "AMAZON.Person"
                    }
                ],
                "samples": [
                    "{any}"                      
                ]
            }
like image 27
Joby korah george Avatar answered Nov 10 '22 11:11

Joby korah george