So to my understanding, entities are supposed to be re-used amongst different slots to optimize for the fact that you may want to accept a user input info for similar data types i.e. two separate slots "what is your household income", "what is your spouse's household income" would both use the #sys-currency entity.
In my current dialog flow, I have two child nodes each with one slot that checks for the sys-currency entity type. I'm using two different context variables however to set the slot.
The problem is that after the user inputs an answer for the first child node ('household income'), the context variable is then set for the following one as well. They have the same entity, but different context variables. To my understanding, this shouldn't be happening. I can confirm the node is processed, but it immediately skips the prompt as if it's already been filled and delivers the response in the node.
You are telling it to jump to the next slot and look for that entity. The user does not get the chance to input anything because their last message contained that entity. You should try jump to and wait for user input
If one node is giving a jump-to to the other, this will happen. The reason is because the intent and the entities found on the user input will be evaluated against all nodes from the flow until a new "wait for user input", where they will be changed.
In those situations, i normally create a new entity with a value that would never be found (like 389jd8239d892d8h89hf32hdsa8hdj3), to force every input into the not-found node of the slot, and there i use the entity necessary, in this case it would be the #sys-currency. This way the question will aways show, even if in a previous input the user typed a valid currency. To me it's useful when dealing with flows that use a lot of #sys-numbers/#sys-currency/#sys-date, and there isen't a lot of text to use to differenciate the values.
Another option would be to remove the slot and use a single node, with his own flow to get the answer. Personally i prefer to use slots, since it's easy to treat multiple possibilities. I would even put both questions on the same node, just using conditions to check if the slot should be evaluated or not.
I have searched for a way to clear the intent/entity recognized from the input in a previous node, but at no success.
So... I know this is a year and 3 months late, but I'll provide an answer in case anyone else is experiencing this issue.
The root cause is the "Divorce - Household Income" node sets the input.text to a value that the #sys-currency entity matches so any nodes you jump to that matches based on #sys-currency will automatically have their context variables set to the input.text without prompting the user.
Unfortunately, I haven't seen any documentation from IBM that allows you to set the input.text to null.
To solve this issue, you need the user to provide some other value that won't match #sys-currency.
Thankfully, the solution is simple to implement and users may actually prefer you follow my outline below.
Simply have your "Divorce - Household Income" node jump to a node that asks them to confirm their entry. Options such as Yes and No are perfect since they'll set input.text to "Yes" or "No", respectively.
Finally, jump to the "Divorce - Spouse Income" node. Since #sys-currency won't match the user's input.text, the node will properly prompt the user to fill the $spouse_annual_income slot.
Related
I have an Alexa skill that at one point asks for names, and at another point asks for numbers. The names are being mapped to a slot of type AMAZON.FirstName and the numbers to a slot of type AMAZON.NUMBER. The problem is that Alexa is aggressively interpreting even number values as names. (e.g. Saying "eight" is likely to be cast as the name "Tate.")
From what I can tell, Dialog Delegation is useful only if you know exactly how many of each type you need to capture. But in my case there are a variable number of times I will need to capture a name, so I can't just fill that slot once and be done with it.
Ideally I would like a way to programmatically turn the slots on and off. So when I prompt the user for a name, any utterance CAN ONLY BE MAPPED TO A NAME or else rejected (obviously HELP and EXIT, etc would still work). And then when I ask for a number, any utterance WILL ONLY BE MAPPED TO A NUMBER, it won't even try to cast it into the type AMAZON.FirstName.
Is there any way to achieve that? Or are there any other workarounds for scenarios like this?
I'd change the approach you're taking. You have a great tool for validation before even getting to code itself. Click the slot you're trying to validate, then click on the "validations" tab.
Right there, you can add either one or two rules. If you do one, you can add the "not within a set of values" and you can type "one", "two", etc. in order to avoid getting those numeric values inside your name slot.
If you take the two rule validation, you will need to add a "Value within slot types' slot values". That way, you will only accept values inside the AMAZON.FirstName slot type.
You don't really need to enable/disable a slot, you can simply take both in the same utterance. Just make sure you're validating your slots properly and that way you'll avoid unvalid data from getting into your skill :)
Read more: https://developer.amazon.com/es-mx/docs/custom-skills/validate-slot-values.html
I'm using IBM Watson Assistant for creating a chatbot. I'm using the web interface with the intents, entities and dialog flow|tree (I don't know how it is called, I'm just calling it web interface). I have four problems and hope that someone can help with it.
I have created two intens: #how_are_you with an example "How are you?" and intent #feeling_good with example "I'm good". Of course I have much more examples for these two intents. In the dialog I have now a parent node looking for #feeling_good and a child node looking for #how_are_you (skipping user input in-between). When a user now inputs the sentence "I'm good. How are you?" then only #feeling_good is triggered but not #how_are_you. How can I trigger both intents with only one user input?
I would like to have one node in the dialog which waits for say 100s and then sends another message to the user. Waiting is no problem (using pause) but how can I do it that only a message is sent after the 100s if the user did not send another message during the waiting period? That means when the user sends a message the waiting node should be canceled.
I have a node which checks for a certain intent. When the intent does not match I'm jumping back to the parent node. The problem is that the text from the parent node is repeated each time. How can I prevent this repetition when jumping back?
The last question is perhaps a bit more tricky. I would like to define an array of the numbers [1,2,3,4,5]. Then one node should sample a random number without replacement from that array (e.g. 2), i.e. the remaining array is then [1,3,4,5]. After some time another node should pick another number at random from the array (say 4). And so on. How can this be implemented? I know about variables (e.g. $var) but I don't know how to represent arrays and sample random numbers.
Thank you so much for your answers in advance. And happy new year to everybody.
1) In Watson Assistant always the intent with the highest confidence is used first. Hence processing multiple intents triggered by one sentence is tricky. The "best" solution is to use composite intent - #HELLO_HOW_ARE_YOU. Alternatively you can create conditions that would check if the first two intents returned are a comination of #HELLO and #HOW_ARE_YOU
2) Waiting and sending messages due to inactivity should be ideally handled by the client implementing the chat console in your interface. WA is not well suited for these types of operations, while there is some support, better way how to handle these is get your client application - when inactivity detected - to send something that will be mapped to #INACTIVITY_INTENT and WA will respond with your message coupled with that intent.
3) Don't jump to the node but jump to the first child of that node and use wait for user input.
4) This is possible. WA expression language supports getting random number, getting the size of an array and removing elements from the array.
E.g. <? $array.remove(new Random().nextInt(3))?>
I am developing an app and everything is working good. One condition are there where I have set the utterances but if user is speaking something else, I am throwing it to the fallbackIntent. One of my utterance is {name} so user can speak any name. But I have define range of name as well that user is allowed only these names. So my problem is if the user is choosing defined names, everything working great and if user said something else like what is weather of chicago, it is going to fallbackIntent as well but the issue is if user speak some name which is not in the list, then too it is coming into defined intent. What i want that if user speak something which is correct but not in my defined name then too redirect it to the fallbackIntent. Is there any way I can call intent in giving condition? I am using php.
When you define a custom slot, Alexa take it's values as samples. So values which are not in the slot-value-list will also be passed to you. And with respect your intent, those slot values are valid, hence that intent is triggered.
The solution is to validate the slot values at your backend and return an appropriate response.
In your case, if u get any other names other than those you have defined, respond back with an error or give FallbackIntent's response.
When you create a custom slot type, a key concept to understand is
that this is training data for Alexa’s NLP (natural language
processing). The values you provide are NOT a strict enum or array
that limit what the user can say. This has two implications
1) words and phrases not in your slot values will be passed to you,
2) your code needs to perform any validation you require if what’s
said is unknown.
I have created a dialog which checks for some Intent and entity to trigger the response, I have also added slots to capture the missing entities. But when user enter the slot value it changes the intent thus causing change in final response. I have tried adding context variable also and deleting it after response but it gets deleted before response and I am getting empty context variable in response.
Like I have added a slot for capturing missing color values in an Intent say 'looking' and color values are like 'I, G, H' and there's also an Intent let's say Goodbye which is also trained for values like 'G or H'. So, when a user fills the slot value with 'G or H' it also overrides the previous intent 'looking' to 'Goodbye' and my final response value changes. What is the best way to handle this kind of flow?
The current intent is based on the latest utterance by the end user. So when someone types in a follow up to a slot, the intent will change and this is intended.
A common confusion is that this impacts the dialog tree. Because when you test it in "Try it out" you see the intent change. Unless your dialog tree is explicitly looking for it after the slot, then it has no impact what-so-ever.
If you do need it to stay the same, then you can send back the intent object in your context. This will disable Watson Assistant from trying to guess the intent.
The danger here is you need to be mindful that what you send back might not reflect what the user has entered. For example, they may ask something that has to trigger the handler of a slot. Doing this will disable that ability.
SITUATION :
I have an application where i have to issue a gift cupon kind of a thing when the user reaches a certain score say 'x'.
I want to create a coupon with a unique QRcode, at the time the user reaches the score 'x' so that he can download it on his iphone and use it. Once it is used , the cupon should be invalidated. this applies to any user using the application. Meaning a coupon is created once the score is reached and deleted or invalidated once it is used.
ISSUE :
I'm not able to figure out how to create a cupon everytime any user reaches the score. Ofcourse, i did go through a lot of documentations and links like http://www.raywenderlich.com/20734/beginning-passbook-part-1. I also tried using pass-source but the valid account requires you to pay minimum about 8$.
As suggested in raywenderlich tutorials, i can create passes but thats not created through the application.
Also i didn't see any method where we can be notified when a user uses his issued coupon so that we can invalidate it.
Am i missing something here?
"Using" a QR code on a coupon means it is scanned by something else. That something else has to take responsibility to report the activity back to you, so you could then update the pass with an "Expired" flag in your database, re-sign and rebuild the pass, issue the push notification so that it would eventually update on the device. You'd also probably want that scanner-thingie to check with you to see that the code is valid before accepting it. So, yeah, not Apple's problem.