t0mhan avatar image
t0mhan asked

How can we say list of ten item to user and get response only from voice in slot (first one, second one or last)

I have this many list of Items/room types and I want to select one type of room(he/she says first one, last one, the third one, or say the complete name(Twin bedroom non-smoking) something like this)

We have following room types available for you Type 1 : French bedroom smoking with 55 Euros per night per room, Type 2 : Twin bedroom non-smoking with 62 Euros per night per room, Type 3 : Twin bedroom smoking with 65 Euros per night per room, Type 4 : Family room non-smoking with 82 Euros per night per room, please select one of the options available.

In my lambda function how can I get correct item number and what should be the slot type

lambdahow-tovoice-user interfaceresponseask cli
10 |5000

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

1 Answer

Rokas avatar image
Rokas answered

Yes, that is possible. I would add an intent called something like: 'RoomTypeIntent'. To it I would add AMAZON.NUMBER slot, if user would decide to choose room by its type number. In this case I would add utterance like: 'I choose type {number}', 'I want type {number} room' etc.

Then I would create a custom slot with values like you said: 'Twin bedroom non-smoking', 'Family room non-smoking' etc. To them I would assign an id equal to their type number. So let's say 'Twin bedroom non-smoking' id would be 1. In this case in the backend I wouldn't have to add a lot of custom logic to resolve from the slot value what type of room is 'Twin bedroom non-smoking'. Just by looking at id I would know, that this room is of type 1. And I would also add this created custom slot, let's call it 'RoomTypes', to my intent 'RoomTypeIntent'. I would also add similar utterances to it as I did before with number slot: 'I want {roomType}', 'I choose {roomType} room' etc.

Now because of this structure, backend bit shouldn't be too difficult. On launch you just list all of the possible options. You can save options either in your skill in some variable or a file, or use external service like database. After listing the options you just ask user to choose one of the options. If 'RoomTypeIntent' is invoked, you look into slot values, what did arrive. Is it a number or a roomType and handle it your code accordingly.

10 |5000

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