vania-janet/multiturn-rag-retrieval-data huggingface dataset:
To change the format in which the time value is stored in the $time context variable to use the hour, minutes and indicate AM or PM, click the Edit response![Edit response](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/edit-slot.png) icon for the @sys-time slot.
5. From the More![More icon](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/kabob.png) menu, select Open JSON editor, and then edit the JSON that defines the context variable so that it reads as follows:

{
"context": {
"time": "<? @sys-time.reformatDateTime('h:mm a') ?>"
}
}
6. Click Save.
7. Test the node again. Open the Try it out pane, and click Clear to delete the slot context variable values that you specified when you tested the node with slots earlier. To see the impact of the changes you made, use the following script:



Script details

 Speaker Utterance 

 You i want to make a reservation 
 Watson What day would you like to come in? 
 You Friday 
 Watson What time do you want the reservation to be made for? 
 You 5pm 
 Watson How many people will be dining? 
 You 6 



This time Watson responds with, OK. I am making you a reservation for 6 on Friday, December 29 at 5:00 PM.



You have successfully improved the format that the dialog uses when it references context variable values in its responses. The dialog now uses Friday, December 29 instead of the more technical, 2017-12-29. And it uses 5:00 PM instead of 17:00:00.
When configuring dynamically from Watson Assistant using the configure command, note that only the root level fields, such as narrowband or broadband, are updated. If these fields are omitted from the command, the original configuration settings persist. You can use the update_strategy values merge and merge_once to merge configuration parameters with the existing configuration.





 Using a custom language model 

When you set up the phone integration, you can configure the integration to use a custom language model all the time.

However, you might want to use a standard language model most of the time, and specify a custom language model to use only for specific topics that your assistant is designed to help customers with. For example, you might want to use a custom model that specializes in medical terms for an action that helps with medical bills only. You can apply a custom language model for a specific branch of the conversation.

For more information, about custom language models, see [Creating a custom language model](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-languageCreate).

To apply a custom language model to an action step, use the speech_to_text response type.

{
"generic": [
{
"response_type": "speech_to_text",
"command_info": {
"type": "configure",
"parameters": {
"narrowband_recognize": {
"x-watson-learning-opt-out": true,
"model": "en-US_NarrowbandModel",
"profanity_filter": true,
"smart_formatting": true,
"language_customization_id": "81d3630-ba58-11e7-aa4b-41bcd3f6f24d",
"acoustic_customization_id": "e4766090-ba51-11e7-be33-99bd3ac8fa93"
}
}
}
}
]
}
Show more
[More icon](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/kebab.png) menu, open the JSON editor.
6. Change the context variable value.

The value will look like this:

{
"context": {
"summary": "slot_in_focus"
}
}

Change the value that is saved in the $summary context variable. You want to capture and store whatever text the user submits. To do so, use a SpEL expression that captures the input text.

{
"context": {
"summary": "<? input.text ?>"
}
}
7. Save your changes.



The change you made to the context variable value is not reflected in the Check for field. You must reopen the JSON editor to see what will be saved.





 Replacing a slot context variable value 

If, at any time before the user exits a node with slots, the user provides a new value for a slot, then the new value is saved in the slot context variable, replacing the previously-specified value. Your dialog can acknowledge explicitly that this replacement has occurred by using special properties that are defined for the Found condition:



* event.previous_value: Previous value of the context variable for this slot.
* event.current_value: Current value of the context variable for this slot.



For example, your dialog asks for a destination city for a flight reservation. The user provides Paris. You set the $destination slot context variable to Paris. Then, the user says, Oh wait. I want to fly to Madrid instead. If you set up the Found condition as follows, then your dialog can handle this type of change gracefully.

When user responds, if @destination is found:

Condition: (event.previous_value != null) &&
(event.previous_value != event.current_value)
Response: Ok, updating destination from
<?
The following table shows some examples of how to define name and value pairs for different types of values:



Name and value pair examples

 Variable Value Value Type 

 dessert cake String 
 age 18 Number 
 toppings_array ["onions","olives"] JSON Array 
 full_name {"first":"John","last":"Doe"} JSON Object 



To subsequently refer to these context variables, use the syntax $name where name is the name of the context variable that you defined.

For example, you might specify the following expression as the dialog response:

The customer, $age-year-old <? $full_name.first ?>, wants a pizza with <? $toppings_array.join(' and ') ?>, and then $dessert.

The resulting output is displayed as follows:

The customer, 18-year-old John, wants a pizza with onions and olives, and then cake.

You can use the JSON editor to define context variables also. You might prefer to use the JSON editor if you want to add a complex expression as the variable value. See [Context variables in the JSON editor](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-runtime-contextdialog-runtime-context-var-json) for more details.





 Common context variable tasks 

To store the entire string that was provided by the user as input, use input.text:



Capturing user input

 Variable Value 

 repeat <?input.text?> 



For example, the user input is, I want to order a device. If the node response is, You said: $repeat, then the response would be displayed as, You said: I want to order a device.

To store the value of an entity in a context variable, use this syntax:



Capturing an entity mention

 Variable Value 

 place @place 



For example, the user input is, I want to go to Paris. If your @place entity recognizes Paris, then your assistant saves Paris in the $place context variable.
contexts {
attributes {
name = "networkZoneId"
value = ibm_cbr_zone.cbr_zone_k8s.id
}
}
contexts {
attributes {
name = "networkZoneId"
value = ibm_cbr_zone.cbr_zone_homezone.id
}
}

description = "restrict COS access, limit to cluster"
enforcement_mode = var.cbr_enforcement_mode
resources {
attributes {
name = "accountId"
value = data.ibm_iam_account_settings.team_iam_account_settings.account_id
}
attributes {
name = "serviceInstance"
operator = "stringEquals"
value = var.cos.guid
}
attributes {
name = "serviceName"
operator = "stringEquals"
value = "cloud-object-storage"
}
}
}
Show more





 Deploy the Terraform resources 

With the understanding of the CBR-related Terraform resources, it is time to deploy them on top of the existing resources to create zones and rules.



1. In the browser, navigate to the [IBM Cloud Schematics workspaces](https://cloud.ibm.com/schematics/workspaces). Select the workspace with the existing resources from the earlier setup.
2. Click on Settings. In the list of Variables and locate the row with deploy_cbr. Its value should be false, the default.
3. In the dot menu for the variable select Edit. Then, in the pop-up form, uncheck Use default to be able to change the value. Type true in the field for Value of the variable called: deploy_cbr. Thereafter, finish the update by clicking Save.
4. Once the settings page has updated, continue with Generate plan in the top. The plan output should indicate that CBR zones and rules would be created.
5. Create the CBR objects by using the Apply plan button.
* [Setting default parameters for a package or action](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_obstoragepkg_obstorage_param_bind)



* [Writing an object to a bucket](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_obstoragepkg_obstorage_write)



* [Writing an object to a bucket with the console](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_obstoragepkg_obstorage_write_ui)
* [Writing an object to a bucket with the CLI](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_obstoragepkg_obstorage_write_cli)



* [Reading objects from a bucket](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_obstoragepkg_obstorage_read)



* [Reading an object with the console](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_obstoragepkg_obstorage_read_ui)
* [Reading an object with the CLI](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_obstoragepkg_obstorage_read_cli)
* [Reference for Object Storage and Cloud Functions](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_obstoragepkg_obstorage_actions)





[Slack](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_slackpkg_slack)
For this Dialog runtime context:

{
"context": {
"toppings_array": ["onion", "olives"]
}
}

Make this update:

{
"context": {
"toppings_array": "<? $toppings_array.remove(0) ?>"
}
}

Result:

{
"context": {
"toppings_array": ["olives"]
}
}



* Overwrite: To overwrite the values in an array, simply set the array to the new values:

For this Dialog runtime context:

{
"context": {
"toppings_array": ["onion", "olives"]
}
}

Make this update:

{
"context": {
"toppings_array": ["ketchup", "tomatoes"]
}
}

Result:

{
"context": {
"toppings_array": ["ketchup", "tomatoes"]
}
}



See [Expression language methods](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-methodsdialog-methods-arrays) for more information about methods you can perform on arrays.







 Setting one context variable equal to another 

When you set one context variable equal to another context variable, you define a pointer from one to the other. If the value of one of the variables subsequently changes, then the value of the other variable is changed also.

For example, if you specify a context variable as follows, then when the value of either $var1 or $var2 subsequently changes, the value of the other changes too.



 Variable Value 

 var2 var1 



Do not set one variable equal to another to capture a point in time value. When dealing with arrays, for example, if you want to capture an array value stored in a context variable at a certain point in the dialog to save it for later use, you can create a new variable based on the current value of the variable instead.
After you apply the search query to the Everything view or to an existing custom view, complete the following steps to save the outcome as a custom view:



1. In the web UI, click Unsaved View.
2. Select Save as new view / alert. The Create new view page opens.
3. Enter a name for the view in the Name field.
4. Optionally, add a category. Enter a name and then click Add this as new view category.
5. Optionally, attach an alert. A new section is displayed for you to configure the alert.
6. Click Save View







 Step 4. Customize how event lines are displayed through a view 

There are different options to customize how you see data in a view:



* You can modify the properties of a view.
* You can rename a view, add or modify its description, and apply a specific line format.
* You can change the log format in the User preferences section.
* You can apply a line template from the Tools section. Notice that this overrides any other line configuration. If you select Persist these settings, all views in the UI will show data per the line format that is specified in this section.
* You can apply color to terms or strings by setting Highlight Terms in the Tools section.





 Change the line format through the view properties page 

Complete the following steps to modify the format of an event line in a single view:



1. In your view, select Edit View Properties. The Edit View Properties page opens.
2. Enter a custom line format in the Custom %LINE Template section. The default is set to {{line}}.

For more information about the line template guidelines, see [Guidelines](https://cloud.ibm.com/docs/services/activity-tracker?topic=activity-tracker-viewsviews_line).
3. Click Save properties.







 Change the line format through the user preferences section 

In the User preferences section, you can modify the order of the data fields that are displayed per line.

Complete the following steps to modify the format of an event line:



1.
If you're using multiple conditioned responses, you must click the Customize response icon ![gear icon](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/customize-response-icon.png) to see the menu that is associated with the response.
3. Click Open context editor.

![Shows the Open context editor menu option selected from the list](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/open-context-editor.png)
4. Add the variable name and value pair to the Variable and Value fields.



* The name can contain any upper- and lowercase alphabetic characters, numeric characters (0-9), and underscores.

You can include other characters, such as periods and hyphens, in the name. However, if you do, then you must specify the shorthand syntax $(variable-name) every time you subsequently reference the variable. See [Expressions for accessing objects](https://cloud.ibm.com/docs/assistant?topic=assistant-expression-languageexpression-language-shorthand-syntax) for more details.
* The value can be any supported JSON type, such as a simple string variable, a number, a JSON array, or a JSON object.





The following table shows some examples of how to define name and value pairs for different types of values:



 Variable Value Value Type 

 dessert cake String 
 age 18 Number 
 toppings_array ["onions","olives"] JSON Array 
 full_name {"first":"John","last":"Doe"} JSON Object 



To subsequently refer to these context variables, use the syntax $name where name is the name of the context variable that you defined.

For example, you might specify the following expression as the dialog response:
As you collect answers from the user per slot, they are saved in context variables. You can use the context variables to pass the information to another node or to an application or external service for use. However, after passing the information, you must set the context variables to null to reset the node so it can start collecting information again. You cannot null the context variables within the current node because your assistant will not exit the node until the required slots are filled. Instead, consider using one of the following methods:



* Add processing to the external application that nulls the variables.
* Add a child node that nulls the variables.
* Insert a parent node that nulls the variables, and then jumps to the node with slots.





Give it a try! Follow the step-by-step [tutorial](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-tutorial-slots).





 Slots usage tips 

The following slot properties can help you check and set values in slot context variables.



Slot properties

 Property name Description 

 all_slots_filled Evaluates to true only if all of the context variables for all of the slots in the node have been set. See [Preventing a Found response from displaying when it is not needed](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-slotsdialog-slots-stifle-found-responses) for a usage example. 
 event.current_value Current value of the context variable for this slot. See [Replacing a slot context variable value](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-slotsdialog-slots-found-handler-event-properties) for a usage example for this property and the event.previous_value property. 
 event.previous_value Previous value of the context variable for this slot. 
 has_skipped_slots True if any of the slots or slot handlers that are configured with a next step option that skips slots was processed.
You might need to experiment with results to ensure that the features do not interfere with how your custom words are displayed. You might also need to add custom words to accommodate the effects.

For instance, suppose that you add the custom word one with a display_as field of one. Smart formatting changes the word one to the number 1, and the display-as value is not applied. To work around this issue, you could add a custom word for the number 1 and apply the same display_as field to that word.

For more information about working with these features, see [Smart formatting](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-formattingsmart-formatting) and [Numeric redaction](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-formattingnumeric-redaction).







 What happens when I add or modify a custom word? 

How the service responds to a request to add or modify a custom word depends on the fields and values that you specify. It also depends on whether the character sequences of the word exist in the base model's character sequences.



* Omit both the sounds_like and display_as fields:



* The service sets the display_as field to the value of the word field. The service does not attempt to set the sounds_like field to a pronunciation of the word.



* Specify only the sounds_like field:



* If the sounds_like field is valid, the service sets the value of the sounds_like field to the specified value. The service also sets the display_as field to the value of the word field.
* If the sounds_like field is invalid:



* The POST /v1/customizations/{customization_id}/words method adds an error field to the word in the model's words resource.
* The PUT /v1/customizations/{customization_id}/words/{word_name} method fails with a 400 response code and an error message. The service does not add the word to the words resource.





* Specify only the display_as field:
Click the Customize slot![Customize slot](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/edit-slot.png) icon for the slot to which you want to add conditional Found and Not found responses.
2. From the More![More icon](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/kebab.png) menu, select Enable conditional responses.
3. Enter the condition and the response to display if the condition is met.

Found example: A slot is expecting the time for a dinner reservation. You might use @sys-time in the Check for field to capture it. To prevent an invalid time from being saved, you can add a conditional response that checks whether the time provided is before the restaurant's last seating time, for example, @sys-time.after('21:00:00'). The corresponding response might be something like, Our last seating is at 9PM.

Not found example: The slot is expecting a @sys-number entity for the number of pizzas in a takeout order. The Not found condition of true might be used to display a message prompting the user, just in case a number isn't provided in the conversation (for example, We need to know how many pizzas you want.).
4. If you want to customize what happens next if the condition is met, then click the Edit response![Edit response](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/edit-slot.png) icon.
Configuring suggestions 

Suggestions give your customers a way to try something else when the current exchange with the assistant isn't delivering what they expect. A question mark icon ![Question mark icon](https://cloud.ibm.com/docs-content/v1/content/ca9232b3702768f24bb897f48f10778fcda28718/watson-assistant/images/question-mark.png) is displayed in the web chat that customers can click at any time to see other topics that might be of interest or, if configured, to request support. Customers can click a suggested topic to submit it as input or click the X icon to close the suggestions list.

If customers select a suggestion and the response is not helpful, they can open the suggestions list again to try a different suggestion. The input generated by the first choice is submitted and recorded as part of the conversation. However, any contextual information that is generated by the initial suggestion is reset when the subsequent suggestion is submitted.

The suggestions are shown automatically in situations where the customer might otherwise become frustrated. For example, if a customer uses different wording to ask the same question multiple times in succession, and the same action is triggered each time, then related topic suggestions are shown in addition to the triggered action's response. The suggestions that are offered give the customer a quick way to get the conversation back on track.

The suggestions list is populated with actions that are relevant in some way to the matched action. The actions are ones that the AI model considered to be possible alternatives, but that didn't meet the high confidence threshold that is required for an action to be listed as a disambiguation option. Any action can be shown as a suggestion, unless its Ask clarifying question setting is set to Off. For more information about the Ask clarifying question setting, see [Asking clarifying questions](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-understand-questionsunderstand-questions-ask-clarifying-question).

To configure suggestions, complete the following steps:



1. Open the Suggestions tab.

Suggestions are enabled automatically for new web chat integrations.
To change the format in which the time value is stored in the $time context variable to use the hour, minutes and indicate AM or PM, click the Edit response![Edit response](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/edit-slot.png) icon for the @sys-time slot.
5. From the More![More icon](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/kebab.png) menu, select Open JSON editor, and then edit the JSON that defines the context variable so that it reads as follows:

{
"context": {
"time": "<? @sys-time.reformatDateTime('h:mm a') ?>"
}
}
6. Click Save.
7. Test the node again. Open the "Try it out" pane, and click Clear to delete the slot context variable values that you specified when you tested the node with slots earlier. To see the impact of the changes you made, use the following script:



Script details

 Speaker Utterance 

 You i want to make a reservation 
 Watson What day would you like to come in? 
 You Friday 
 Watson What time do you want the reservation to be made for? 
 You 5pm 
 Watson How many people will be dining? 
 You 6 



This time Watson responds with, OK. I am making you a reservation for 6 on Friday, December 29 at 5:00 PM.



You have successfully improved the format that the dialog uses when it references context variable values in its responses. The dialog now uses Friday, December 29 instead of the more technical, 2017-12-29. And it uses 5:00 PM instead of 17:00:00.