Alexa - catchall
Asked Answered
P

4

9

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.

Paulitapaulk answered 20/4, 2018 at 18:58 Comment(0)
P
6

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" } } ] } ] } } }

Paulitapaulk answered 21/4, 2018 at 8:12 Comment(2)
I would like to achieve the same thing as you but I don't understand all those hey hey. it will just catch hey sentences in the end....Keheley
Well, as there is no other matching pattern, the 'hey hey' will always be the closest it will find. Finally, i generated x sentences with random words, it achieve the same things, but it's easier to understand when you read. The key thing is to have sentences with always one word more than the previous. otherwise, it won't catch the whole sentence.Paulitapaulk
S
6

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}"                      
                ]
            }
Sniffy answered 10/4, 2019 at 6:49 Comment(1)
"AMAZON.SearchQuery require a phrase along with the slot" - this is the key!Splendent
H
3

Unfortunately, there is no solution at this time. Alexa doesn't support a way to get all the text the way you're looking to do.

Housecarl answered 20/4, 2018 at 20:35 Comment(2)
found a solution, I edited the response with the solutionPaulitapaulk
@Paulitapaulk yes, but that's not a "catchall" solution.Emrick
L
0

You can create a custom slot with some random words.

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "demo",
            "intents": [
                {
                    "name": "AMAZON.CancelIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.StopIntent",
                    "samples": []
                },
                {
                    "name": "EveryThingIntent",
                    "slots": [
                        {
                            "name": "EveryThingSlot",
                            "type": "BAG_OF_WORDS"
                        }
                    ],
                    "samples": [
                        "{EveryThingSlot} "
                    ]
                }
            ],
            "types": [
                {
                    "name": "BAG_OF_WORDS",
                    "values": [
                        {
                            "name": {
                                "value": "Hello World"
                            }
                        }
                    ]
                }
            ]
        }
    }
}
Larkins answered 10/7, 2018 at 9:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.