David_Hawken | 2022-02-03 12:03:01 UTC | #1
I currently have a decision node in a bot flow that's looking up keywords from a slot and if a keyword matches, take it down a certain path. I need to change this, so those keywords go down path 1 and new keywords go down path 2 and if they don't match, go down case 3. My currently decision expression is this:
If(IsSet(Slot.Reason) And IsSet("password"), Contains(Slot.Reason, "password", true), false) or If(IsSet(Slot.Reason) And IsSet("log on"), Contains(Slot.Reason, "log on", true), false) or If(IsSet(Slot.Reason) And IsSet("log in"), Contains(Slot.Reason, "log in", true), false) or If(IsSet(Slot.Reason) And IsSet("logging on"), Contains(Slot.Reason, "logging on", true), false) or If(IsSet(Slot.Reason) And IsSet("logging in"), Contains(Slot.Reason, "logging in", true), false) or If(IsSet(Slot.Reason) And IsSet("locked out"), Contains(Slot.Reason, "locked out", true), false) or If(IsSet(Slot.Reason) And IsSet("can't get into my laptop"), Contains(Slot.Reason, "can't get into my laptop", true), false) or If(IsSet(Slot.Reason) And IsSet("can't get onto my laptop"), Contains(Slot.Reason, "can't get onto my laptop", true), false)
So those keywords would be for path 1. I'd want new keywords to follow a new path. New keywords would be VPN, network and connection. I'm guessing I'd use a switch, but I'm not sure how to do this. Any advice would be appreciated.
Anton_Vroon | 2022-02-03 22:27:57 UTC | #2
If this was me, If those slots are part of the same intent and the other keywords is part of another intent, I could just use if Intent == "LoginQuery"
Otherwise I would Create a couple of booleans, IsLoginQuery, and IsSomeOtherQuery (you can skip this step but makes it easier to read). And then set IsLoginQuery to the expression you have already, and IsSomeOtherQuery is your new keywords.
Then just drop a Switch Action in Set to Take Path of first case that returns true, and add your boolean (or the full expression) as each case. Or if you didn't need to worry about IsSet, you could instead change it to Case that matches an expression, click the switch to string button that should appear once you enter Slot.Reason as the expression, and then case 1, 2 etc, is just Password, Case 2 is Login
I would also consider having a slot type of ReasonTypes, and have a list of values, Log In, Locked etc with synonyms, that way you wouldn't need to list all those variations.
Also as a side note you don't need the And IsSet("log in") in the first part of those if statements, that will always return true, since you are providing a set string value. And then I would just have if Slot.Reason == "SlotTypeValue" no need for contains if you have provided a set list of values the slot can be in the SlotType
David_Hawken | 2022-02-04 07:48:38 UTC | #3
At the point this is, we haven't had any intents yet. My flow starts with three ask for slots and in the third one, we have the above logic where we are looking for keywords. So it's just a free text but if they say things like password, Genesys picks it up. I'll see if I can get it working with the method you suggested - thanks very much Anton! Hopefully one day I'll understand this as well as you :grinningfacewithsmilingeyes:
David_Hawken | 2022-02-04 07:49:51 UTC | #4
This is how the flow looks today So the third ask for slot has the information I want to look up
Anton_Vroon | 2022-02-07 20:30:55 UTC | #5
I am still pretty new to Bots myself, so I'm really just throwing my own ideas out there and hope they help.
But modifying what you have would look like this:
Switch: expanded
And in the slot types I would have something like
Will see if I can get you an example of what it might look using Intent for the reason instead, which is basically the functionality that is being replicated here, so might as well use it.
Anton_Vroon | 2022-02-07 20:38:24 UTC | #6
As an Intent
Intents tab:
Utterance example for one of them
The intents you create automatically become the paths in the Ask for Intent Action, you can untick Intents if you don't want them included in that Ask for Intent Action if you have more intents you want captured elsewhere. And adding a new intent is a matter of just adding intent and utterances, and then ticking a box to include it in the Ask for Intent Action.
These are pretty simple Intents with no slots. But from here you can have slots as part of those utterances, and if then if you have the Ask for Slot in that intent path it will fill the slot, or if the customer has already given that slot as part of the Ask for Intent step, it won't ask again, which is pretty neat.
David_Hawken | 2022-02-07 20:46:42 UTC | #7
Ahhh, I can see how that would work now. That should work quite well I think, I'll need to do some testing to see how it deals with partial matches of phrases as that was one of the challenges I faced with the way I've designed it.
Really big thank you for your suggestions on this. I work primarily on my own so it's good to get a different viewpoint
Anton_Vroon | 2022-02-07 21:57:54 UTC | #9
Using Intents is definitely better for partial matching, since you can just add the partial utterance, and the NLU is decent (depending on language settings and confidence threshold settings) at figuring it out based on the utterances (you don't need to tell it every single possibility)
Harder for Slots (though you can add synonyms) as slots currently doesn't have any partial matching capability.
John_Carnell | 2022-02-07 21:59:39 UTC | #10
@Anton_Vroon thanks for the awesome response.
Manager, Developer Engagement
system | 2022-03-09 22:00:13 UTC | #11
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 13432