IBM Watson Assistant: How to retrieve input value from chosen dialog option? - ibm-cloud

I already followed these great instructions on how to dynamically create dialog node options from generic input and it's working like charm. But for now I cannot see how to hand over the chosen option value to the next node to process further. Is there any documentation how to pass the chosen option value to the child node?

You can store any selected option and other information in context variables. They are passed around and can be accessed in other nodes. The information is available until you unset or delete the context variable.

Related

Question regarding parameter store and Cloud formation integration

I was trying this scenario but I am not able to figure out
I have a name and value in parameter store in SSM, now I am running the CF template from CLI using code pipeline, and I want the CF template take values directly from parameter store and should not prompt
on screen asking me to give the value.
I tried this but it prompt me .
AWS::SSM::Parameter::value
this is prompting when I used to upload a template in screen. how to avoid it and make the script take the value from parameter store directly
You have two choices for that:
Provide a default value for the parameter.
Use ParameterOverrides in your CodePiepline to provide the required value for the parameter.

IBM Watson Assistant: How to set a 'jump to' target node dynamically (i.e. using context variables)

I want to jump from a dialog node to a node the ID of which is stored in a context variable.
I'm trying to solve a problem that has to do with a digression and which has been described here:
Conditionally return from digression in watson assistant
Especially this chart visualizes the problem:
In my opinion, A.H. posed a very reasonable and relevant question that has got no viable answer.
As far as I can see the problem can not be solved by digression settings. Either the root level node (triggered by matching the intent # Want_to_speak_to_someone) is set to 'return after digression' or it is not.
If the digression setting of this digression node is set to 'return' it will always return - no matter what happens further down in the dialog flow of this digression. Even if the user confirms that he wants to speak to a person (i.e. he does not want to return) the dialog will return to the node where the digression started.
This even happens when I jump from the yes-node (user confirms that he wants to speak to a person) out to any other node. As soon as the branch (or the branch the user jumped to) ends the dialog returns to the node where digression started.
If the digression setting of this digression node is set to 'does not return' however, a return is not possible - even if the user decides against speaking to a person and opts for returning to where he was.
What A.H. and I want is that the user can digress from a dialog flow and can still decide whether he wants to return or not. I think this is a pretty natural and important feature of a dialog. People like to reverse their decision or maybe they even digressed unintentionally from the given dialog flow.
Akaykay proposed to have two different nodes - a 'yes-node' which allows returning and a 'no-node' that does not allow returning. But this doesn't work, because before that I must have another node that asks the user for confirmation - and this 'confirmation-node' has to be set either to 'return' or 'does not return' (yielding the problems described above).
For this reason, I tried to figure out a workaround: I store the dialog node ID from which the dialog digresses in a context variable.
It is a context variable
"context": {
"last_node": "<? output.nodes_visited [0]?>",
...
},
which gets updated in every node of a dialog flow which allows digression.
In the example I could then jump back to the $last_node if the user wants to return and I could jump to another (fixed) node if the user wants to speak to a person - digressions settings of the 'digression node' would not interfere and could be set to 'does not return'.
Then I tried to edit the respective node (from which to return to the $last_node) in the json file of my skill:
"next_step": {
"behavior": "jump_to",
"selector": "user_input",
"dialog_node": "$last_node"
},
But when I reimport the skill-json-file again I get this error message:
I would be fine with either solution - one that uses digression settings or one that allows setting the 'jump to' target node dynamically. I deeply appriciate any help - thanks!
If you want to prevent Watson Assistent from returning from digression just call <? clearDialogStack() ?> function in the node where you don't want Watson Assistant to return from digression and that's it.
In your chart you would write "Ok, click here. <?clearDialogStack()?>" in the output text of the node "Ok, click here." and that should do the trick.
Here it is in the doc in this section: https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-runtime#dialog-runtime-digressions
Also note that currently it is not possible to create dynamic gotos with Watson Assistant. Only thing you can do is to create a dialog node with all the needed gotos conditioned by something underneath it and then you would goto this node. It is hard to create this manually but it can be generated automatically. For more magic with WA check out this project:
https://github.com/IBM/watson-assistant-workbench
It is possible to develop chatbots with WA completely without UI.

Change timezone in cloud sql

I have created a SQL instance on Google Cloud and I need to change the timezone. I already seen documentation, and I added the flag default_time_zone and set the value to 06:00, but the console doesn't let me write the semicolon.
How can I write the value? Thanks in advance.
The proper format for the default_time_zone flag is +/-HH:MM e.g. to set it to GMT+6 you would write the value +06:00. Don't forget the leading zero.
To modify the timezone, update the Google Cloud SQL flag named default_time_zone. This or any other database flag can be updated as follows:
1) In the Google Cloud Platform Console, open an existing project by selecting the project name.
2) Open the instance and click Edit.
3) Scroll down to the Flags section.
4) To set a flag that has not been set on the instance before, click Add item, choose the flag from the drop-down menu, and set its value.
5) Click Save to save your changes.
6) Confirm your changes under Flags on the Overview page.
When you add or modify these flags, your instance will automatically restart. Note that you cannot modify flags on failover replicas.
For further reading, see the documentation for setting Cloud SQL Flags.

IBM Chatbot Assistant - Array with same values

I have this piece of code in JSON editor of Watson:
"context": {
"array": "<? entities['spare_part'].![literal] ?>",
"array_size": "<?$array.size() ?>"
When the input of the user, for example, is "Hello, I need a valve, and the part number of the valve is 1234", the size of the array ends up being 2 since the user mentions the word "valve" twice in his input. Some nodes are being executed depending on size of the array. For instance if the size of the array is 1, some nodes will be ignored because they are only executed only if the size of the array is 2.
I want the array to store only the inputs with different values, which is basically I don`t want the array to store the values of the same type, in my case 2 valves. If it is possible somehow please show me a way.
All that can be done, but the best approach depends on the overall system architecture. Remember that Watson Assistant is a conversation service, not a data processing platform...
You can process JSON in either Watson Assistant directly using the built-in methods and SpEL, see these links to get started:
- https://console.bluemix.net/docs/services/conversation/expression-language.html#expressions-for-accessing-objects
- http://docs.spring.io/spring/docs/current/spring-framework-reference/html/expressions.html
- https://console.bluemix.net/docs/services/conversation/dialog-methods.html#expression-language-methods
That would require some coding within the dialog nodes. It could be ok. What I would recommend is to either process in your app that drives the dialog (you need that app anyway) or to code up small server actions to transform data.
If it is the word you are looking for, you can use contextual entities to train for this.
As an example I created the following intent (along with general intents from catalog).
For each example I highlighted the "valve" word that is the one I am interested in, and added to the entity.
Now when I test it I get the following.
All this was done in a couple of minutes. For production level you may want to add more examples, or think about how you want to annotate.

Rundeck implicit variable

Run dick gives us the ability to define options to be entered by the its GUI, is there any capability to have job variable based on the input without the end user of the job seeing it?
E.g, if the the user choose the product and the environment and the product behind LB, I want to use a script internally to define new job variable and assign it the port number that could be used later on within the job steps.
Yes, there is.
You can add a new option whith Allowed Values set to Remote URL, then put the URL to your script which will return the actual value based on other options.
For exmaple
http://localhost/cgi-bin/getPort.py?environment=${option.environment.value}&product=${option.product.value}
Rundeck Manual option-model-provider