flask-ask slot is always being mapped to None
Asked Answered
C

1

8

My slot for a custom intent is always being recognised as None.

I have an intents schema which looks like this:

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "name_of_app",
            "intents": [
                {
                    "name": "AMAZON.CancelIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.StopIntent",
                    "samples": []
                },
                {
                    "name": "EventsIntent",
                    "slots": [
                        {
                            "name": "eventCity",
                            "type": "AMAZON.GB_CITY"
                        }
                    ],
                    "samples": [
                        "whats on in {eventCity}",
                        "whats going on in {eventCity} ",
                        "tell me what events are in {eventCity}"
                    ]
                }
            ],
            "types": []
        }
    }
}

My code is in python, using the flask-ask framework. My main entrypoint looks something like this:

@ask.launch
def start_skill():
    welcome_message = 'Welcome to name_of_app, what do you want?'
    return question(welcome_message)

@ask.intent('EventsIntent', mapping={'city': 'eventCity'})
def weather(city):
    return statement('you have selected {}'.format(city))

Even this simple example however, does not work when the input is:

"whats on in London?"

I have tried with lowercase and with/without punctuation in the testing panel on the amazon developer console, however the return is always:

"you have selected None"

indicating that None is passed as 'eventCity'. Am I passing this slot incorrectly in either the intent schema or in the code?

Thanks

Cloe answered 23/4, 2018 at 20:39 Comment(1)
It works for me i.sstatic.net/pNKeA.png. How are you running the code?Carey
A
0

hey buddy following is the solution of your problem:

@ask.launch
def start_skill():
    welcome_message = 'Welcome to name_of_app, what do you want?'
    return question(welcome_message)

@ask.intent('EventsIntent', convert={'eventCity': str})
def weather(eventCity):
    return statement('you have selected {}'.format(eventCity))

I was also facing similar issue this thing resolved my issue.

Aurar answered 11/10, 2018 at 11:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.