IBM Watson, Optional Slots, When Context Variable not present - ibm-watson

In the IBM Watson, with Optional Slots where the Context variable might not be present, the condition of true is not catching it, it seems that it is not even executing the condition. So what condition should I put, or alternatively how do you handle a case where the context variable is not detected? Look at the image:
Optional slot for city location
The problem starts when the user is not entering the location. In that case, under the multi-conditioned response, what do you add under "If assistant recognizes"? I tried 'true' without quotes, and it did not work as if the multi-conditional if statement is not executed.

Related

Fail entire SSIS Package in case of Exception

I have a SSIS package with lots of containers and logic. I am running an additional task (which I want to run independently) let's say it acts as an Event Listener. When this separate task is errored, I want to error out the entire package. I thought, it should work by default but to my surprise, it's not:-
I have tried setting both FailPackageOnFailure & FailParentOnFailure properties on both the parent container & the child container but it's not working.
I was about to ask exactly the content of your last comment.
Failure of one piece of a package won't make another, unconnected piece stop executing. Once the executing piece is done, the package will fail, but Sequence Container 3 has no way to know what's happening in Sequence Container 2.
Which, honestly, is what we want. If Sequence Container 3 is doing DML, you could leave your data in an unfortunate state if an unrelated failure elsewhere in the package suddenly made everything come to a screeching halt.
If you don't want Sequence Container 3 to run if Sequence Container 2 fails, then just run a precedence constraint from Sequence Container 2 to Sequence Container 3, #3 won't execute until #2 succeeds and the Execute SQL Task succeeds.
I completely agree with Eric's answer. Let me explain to you why raising a flag on error won't work.
I redesign the package so it includes the flag check.
Let's say we have a success flag as user variable which is by default False.
Now we set this variable as True at the end of sequence 2 execution marking the success of all the other tasks in that sequence.
The second part is put into a for loop which runs only once(if at all). It checks if the success variable is true and only then run the inner tasks. It looks like below:
The problem is, the success variable check at the start of the for loop will always have the inital value which is false(because it runs in parallel with seq 2 and doesn't wait till seq 2 ends). Hence the second part is never executed. Now change the initial value of success variable to true and run the package again. Play by disabling the error prone tasks and run the package. You will understand how it works.

Re-using entities in Watson Assistant results in automatically filled context variables

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.

Adding slot changing the intent

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.

GAE MemCache behaviour of put() + ADD_ONLY_IF_NOT_PRESENT

The put(...) method of GAE's memcahe API accepts as an argument (in one of it's overloaded implementations) a SetPolicy argument. In the Javadocs here it sais that if you chose "ADD_ONLY_IF_NOT_PRESENT" as policy it's, and I quote:
"useful to avoid race conditions."
My questions are:
what happends with an expired value that was set with the same key? If I add to memcache something like (key=1, value=whatever), then this entry expires, and then I try to add (key=1, value=whatever2) using ADD_ONLY_IF_NOT_PRESENT is whatever2 added to cache or not?
What does it mean "useful for race conditions"? More specifically, does it mean that if I use put(...) with ADD_ONLY_IF_NOT_PRESENT SetPolicy I am no longer required to use getIdentifiable and putIfUntouched in order to avoid race conditions when adding stuff concurrentlly to the memcache?
If the value expires, it's not in memcache anymore, so the RPC will set it.
If you do a get, then do a put only if nothing was there, you've introduced a race condition whereby someone else might've put the data while you were checking. Doing a single operation avoids this.

How to programmatically change the work flow between SSIS control flow tasks?

I have an SSIS package, which depending on a boolean variable, should either go to a Script Task or an Email task.(Note: the paths are coming from a Script Task)
I recall in the old dts designer there was a way to do this via code. What is the proper way to accomplish this in SSIS?
Isn't a Conditional Split a data flow
task, which takes a row of data and
pushes it in one of two directions
according to some property of the
data???
Oops, that is correct. I found this blog entry which explains how to do proper control flow conditional branching based on boolean values.
In control flow, drag the green arrow to the email task, then right-click on it and you will see you can set it from 'Completed' to 'Conditional', then you can set an expression on the condition. The arrow will then turn blue. You should then be able to drag another arrow to the other script, and set that to conditional.
I have this set-up often, many times you want to email if a certain condition applies. The standard syntax for the conditional constraints is something like:
#[User::SendEmail] == True
Assuming your SendEmail variable is a boolean. If you use anything else, just construct an expression that evaluates to either true or false.
Remember to set the conditionals to OR instead of AND, otherwise it won't complete unless it can take both routes!
A Conditional Split task does what you want. Add the Conditional Split task, add in an additional output (a default output is provided), and set up the Condition for that output. Then just tie the outputs (default and new) to the Script and Email tasks as appropriate.

Resources