2

Giving I have a dialog tree for booking a rental car. The bot have a main Intent called "orderIntent" and a second intent called "colorIntent". In the "orderIntent" dialog the user will be asked to chose for a car category, date, and price (all of those have a separate slot in this intent).

I want that the at any given moment in the dialog the user will be able to call the "colorIntent" intent and set up a color as he desires and when this is finish, to return back to the same place in the tree dialog that he previously left.

For example, when the user will be asked to pick a date for the booking, and will reply with "I want to chose a green color for the car" this will invoke the "colorIntent" intent and the user will be able to chose a color.

Afterwards the user should return to the same part of the dialog that he partially fulfilled and will be asked again to pick the date of the booking. I want to achieve that while maintaining the information he already partially fulfilled in the main dialog about the car catagory and price he already picked and the new information about the color he picked from the "colorIntent" intent.

How can I configure such logic in the AWS Lambda of the bot ?

Ben J
  • 147
  • 2
  • 14

2 Answers2

0

https://github.com/awslabs/serverless-application-model/blob/master/examples/apps/lex-book-trip-python/lambda_function.py

Try seeing book_car function this will solve your problem. Because here they are taking some slot values of book_hotel and setting up in book_car.

s.dhruvi
  • 43
  • 11
  • From what I have seen, I think it's based on the BookTrip Lex blueprint.. In which case the intents sharing information but only if the intent was already fulfilled and finished. If you call the second intent in the middle of the dialog, the dialog won't be restored to the part when you left the first intent. – Ben J Jan 07 '19 at 21:42
0

Make use of sessionAttributes to achieve this because sessionAttributes remain across intents, while slots are only held within each intent.

Intent_A logic can run, filling slots as it goes, and the slot values should also be saved in sessionAttributes. Then at any point of IntentA, a user could trigger Intent_B.

Now Intent_A's slots are overwritten by Intent_B's slots but Intent_A's slot values are still saved in sessionAttributes.

Extra Information on how to change between intents:

You then have 2 choices:

(1) force the user to trigger IntentA again with a prompt like, "To continue booking the car, please say, book a car".

(2) use confirmIntent back to IntentA, but it will need to ask a confirmation question like, "Would you like to continue booking a car?" The response to that will go to Intent_A regardless, so inside of Intent_A you need to just check the confirmationStatus which will be either "Confirmed" or "Denied", based on how the user responded to that question. If confirmed, then you can continue Intent_A, and if denied, then you should close Intent_A.

(look into confirmIntent here under types of dialogAction)

After getting back into Intent_A, you should then check if any slot data is inside of sessionAttributes, and force this data back into the appropriate slots. Then your original logic can detect which slots are already filled, and continue where it left off.

Jay A. Little
  • 3,239
  • 2
  • 11
  • 32