question

newuser-50f645bb-c539-4cff-8635-2e212915d484 avatar image

How do I get dialogs working?

I have the following intent:

"intents": [

{

"name": "setLocationIntent",

"slots": [

{

"name": "deviceLocation",

"type": "AMAZON.SearchQuery",

"samples": [

"Location is {deviceLocation}",

"{deviceLocation}",

"set location to {deviceLocation}"

]

}

],

"samples": [

"set location to {deviceLocation}"

]

},


The intent is chained to when a user initiates a launch request but the device is not in a dynamo db I have set up. The chaining to 'setLocationIntent' works but then when try to respond to the prompt with the slot value it will only accept the one utterance "set location to {deviceLocation}" that was set up with the intent instead of the utterances set up with the slot in 'dialogs'.

I have tried this with both 'ElicitSlotDirective' and 'DelegateDirective' in the relevant lambda function but neither appear to be working. Lambda section included below.

speech = ("Location of Alexa device has not been set.")


"""

location_directive = ElicitSlotDirective(

slot_to_elicit = "deviceLocation",

updated_intent = Intent(

name = "setLocationIntent",

confirmation_status = IntentConfirmationStatus.NONE,

slots = {

"deviceLocation": Slot(

name= "deviceLocation",

confirmation_status = SlotConfirmationStatus.NONE

)

}

)

)

"""


location_directive = DelegateDirective(updated_intent = "setLocationIntent")


(handler_input.response_builder

.speak(speech)

.add_directive(location_directive))

return handler_input.response_builder.response

interaction modeldialog modelutterancesdialog directive
10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

newuser-50f645bb-c539-4cff-8635-2e212915d484 avatar image
newuser-50f645bb-c539-4cff-8635-2e212915d484 answered

Here's the code in a more readable format.

Just to re-iterate. Alexa won't accept the first list of "samples" within "slots". It only accepts the single sample "set location to {deviceLocation}".

The 3 samples were created in the 'User utterances' section of the slots dialog page in the dev console.

            "intents": [
                {
                    "name": "setLocationIntent",
                    "slots": [
                        {
                            "name": "deviceLocation",
                            "type": "AMAZON.SearchQuery",
                            "samples": [
                                "Location is {deviceLocation}",
                                "{deviceLocation}",
                                "set location to {deviceLocation}"
                            ]
                        }
                    ],
                    "samples": [
                        "set location to {deviceLocation}"
                    ]
                },
            speech = ("Location of Alexa device has not been set.")
            
            """
            location_directive = ElicitSlotDirective(
                slot_to_elicit = "deviceLocation",
                updated_intent = Intent(
                    name = "setLocationIntent",
                    confirmation_status = IntentConfirmationStatus.NONE,
                    slots = {
                        "deviceLocation": Slot(
                            name= "deviceLocation",
                            confirmation_status = SlotConfirmationStatus.NONE
                        )
                    }
                )
            )
            """
            
            location_directive = DelegateDirective(updated_intent = "setLocationIntent")

            (handler_input.response_builder
                .speak(speech)
                .add_directive(location_directive))
            return handler_input.response_builder.response
10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Anand@Amazon avatar image
Anand@Amazon answered

Hi there,

Can you also share skill ID for further debugging?

10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.