George Anton
George Anton

Reputation: 46

Lex V2 switching Intents after fulfillment

I've seen a similar question asked on here before but with either no answers or in regards to Lex V1. I have three intents for my Lex bot, one is Greetings with output context "contextGreetings". The other two are "ReplaceCard" and "CheckBalance". Each have their own context output, and each have "contextGreetings" as their input context and the other's own output context as input; i.e. ReplaceCard intent has input context "contextGreetings" and "contextCheckBalance".

I'm rather new to Lex and Lambdas, so i'm doing this on Lambdas using python. To run through the procedure, this is to simulate a bank call. The client starts with a Hello, the bot responds "Hello, welcome to Example Bank." and then elicits for first name. The slot is filled, and the fulfillment message is "Hello {firstName} how may I help you today?". The response from the user should elicit the next intent, such as "I need to replace my card" or "I would like to check my balance". But all this response garners is either FallBack Intent or new session.

After Greetings Intent, I would like the option to go onto either ReplaceCard or CheckBalance intent depending on user response. And after those intents, I would like them to have the option to go to the other respective intent. Reading the documentation, it seems context attributes would be the way to go but I'm not sure how to successfully use/apply it. Would I return those attributes in close() with state='Fulfilled', or do I call elicit_intent() followed by delegate()? Elicit_intent() would require a specific intent, but that would depend on user-response.

Thanks for any help

Upvotes: 1

Views: 1073

Answers (1)

chamburger
chamburger

Reputation: 209

Hey you’re on the right track.

At my shop we use a meta data approach where each phase of a convo is a stage and each stage has a set of actions some of which are Elicit a slot if we’re in an intent and at a point where we need more info, or in case of needing to go to a new intent, elicitintent. We send this stage info using and filled slots and other data pieces using the complex attributes you referred to and move through the convo in this way.

Upvotes: 1

Related Questions