vania-janet/multiturn-rag-retrieval-data huggingface dataset:
For the enrichment IDs for the prebuilt enrichments, see [Enrichment IDs](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-manage-enrichmentsenrichments-ids).
5. Add the enrichment that you want to apply.

For example, to add the Keywords enrichment, you can include the enrichment in the enrichments list. First, get its ID from the table.

The Keywords enrichment ID is 701db916-fc83-57ab-0000-000000000018. To indicate that you want to apply the Keywords enrichment to the content in the text field of the documents in the collection, you can represent it in JSON format as follows:

{
"enrichment_id" : "701db916-fc83-57ab-0000-000000000018",
"fields" : [ "text" ]
}

Any enrichments that you specify replace the default enrichments. Therefore, if you want to retain a default enrichment, don't forget to include it in the list of enrichments that you apply to the collection. For a list of default enrichments per project type, see [Default enrichments per project type](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-manage-enrichmentsenrichments-defaults).

For example, to retain the Entities enrichment and add the Keywords enrichment, you might specify the following in the request body.

The Part of Speech enrichment is included also because it is applied to all collection automatically.

"enrichments": [
{
"enrichment_id": "701db916-fc83-57ab-0000-000000000002",
"fields":
"text"
]
},
{
"enrichment_id": "701db916-fc83-57ab-0000-00000000001e",
"fields":
"text"
]
},
{
+ updated_at = (known after apply)

+ config {
+ params {
+ custom_headers = {
+ "authorization" = "secure"
}
+ sensitive_headers = [
+ "authorization",
]
+ url = "https://hello.demo.com/hello"
+ verb = "POST"
}
}
}

 ibm_en_subscription.subscription1 will be created
+ resource "ibm_en_subscription" "subscription1" {
+ description = "Subscribe to Android app"
+ destination_id = (known after apply)
+ destination_name = (known after apply)
+ destination_type = (known after apply)
+ from = (known after apply)
+ id = (known after apply)
+ instance_guid = (known after apply)
+ name = "Android app Subscription"
+ subscription_id = (known after apply)
+ topic_id = (known after apply)
+ topic_name = (known after apply)
+ updated_at = (known after apply)

+ attributes {
+ add_notification_payload = true
+ signing_enabled = true
}
}

 ibm_en_topic.topic1 will be created
+ resource "ibm_en_topic" "topic1" {
+ description = "Check the status of front door"
+ id = (known after apply)
+ instance_guid = (known after apply)
+ name = "Front Door Status"
+ source_count = (known after apply)
+ subscription_count = (known after apply)
+ subscriptions = (known after apply)
+ topic_id = (known after apply)
+ updated_at = (known after apply)
}

 ibm_resource_instance.terraform_demo will be created
+ resource "ibm_resource_instance" "terraform_demo" {
+ account_id = (known after apply)
+ allow_cleanup = (known after apply)
+ created_at = (known after apply)
{2,6})([/w .-])/?$, e.g. [https://www.ibm.com](https://www.ibm.com)



3. Click Add value and repeat the process to add more entity values.



When you use pattern entities to find patterns in user input, you often need a way to store the part of the user input text that matches the pattern. To do so, you can use a context variable. For more information, see [Defining a context variable](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-runtime-contextdialog-runtime-context-var-define).

For example, your dialog might ask users for their email addresses. The dialog node condition will contain a condition similar to @contactInfo:email. You can use the following syntax in the dialog node's response section to define a context variable that captures and stores the user's email address text:



Saving a pattern

 Variable Value 

 email <? @contactInfo.literal ?> 



This syntax indicates that you want to find the part of the user input that matches the email pattern and save that subset of text into a context variable named email.



 Capture groups 

For regular expressions, any part of a pattern inside a pair of normal parentheses will be captured as a group. For example, the entity @ContactInfo has a pattern value named fullUSphone that contains three captured groups:



* (d{3}) - US area code
* (d{3}) - Prefix
* (d{4}) - Line number



Grouping can be helpful if, for example, you want your assistant to ask a user for a phone number, and then use only the area code of the provided number in a response.

To assign the user-entered area code as a context variable, use the following syntax in the dialog node's response section to capture the group match:



Saving a capture group

 Variable Value 

 area_code <? @ContactInfo.groups[1] ?>
- Prompt again (Default): Displays the prompt for the slot that the user was working with just before asking the off-topic question.
- Skip current slot: Displays the prompt associated with the slot that comes after the slot that the user was working with just before asking the off-topic question. And your assistant makes no further attempts to fill the skipped slot.
- Skip to response: Skips the prompts for all remaining empty slots including the slot the user was working with just before asking the off-topic question.

1. In the node-level response, add a condition that checks for a dummy value in one of the slot context variables. If found, show a final message such as, If you decide to make an appointment later, I'm here to help. If not found, it displays the standard summary message for the node, such as I am making a grooming appointment for your $animal at $time on $date.

Here's a sample of JSON that defines a handler for the pizza example. Note that, as described earlier, the context variables are all being set to dummy values. In fact, the $size context variable is being set to dummy. This $size value triggers the node-level response to show the appropriate message and exit the slots node.

 {: codeblock}
{
"conditions": "cancel",
"output": {
"text": {
"values": [
"Ok, we'll stop there. No pizza delivery will be scheduled."
],
"selection_policy": "sequential"
}
},
"context": {
"time": "12:00:00",
"size": "dummy",
"confirmation":"true"
}
}
Show more

Important: Take into account the logic used in conditions that are evaluated before this condition so you can build distinct conditions. When a user input is received, the conditions are evaluated in the following order:



* Slot handlers in the order they are listed.
* First slot condition.
* Current slot level Found conditions.
* starttime: Optionally specify a starttime string (any properly formatted [DateTime](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html)) for which to set the time series [TRS](https://cloud.ibm.com/docs/sql-query?topic=sql-query-TRS). If starttime is not indicated, and granularity is indicated, the starttime defaults to 1 January 1970 12 AM (midnight) GMT. However, if no granularity is indicated, a [TRS](https://cloud.ibm.com/docs/sql-query?topic=sql-query-TRS) is not associated with the created time series.
* granularity: Optionally specify a granularity string (a properly formatted ISO-8601 duration format) for which to set the time series reference system [TRS](https://cloud.ibm.com/docs/sql-query?topic=sql-query-TRS). If granularity is not indicated, and starttime is indicated, the default granularity is 1 millisecond. However, if no starttime is indicated, a [TRS](https://cloud.ibm.com/docs/sql-query?topic=sql-query-TRS) is not associated with the created time series.



The following examples show you how to use TIME_SERIES_FORMAT parameters for dynamic time series generation during the read process.

Create a time series per location, set the time series TRS with default start time and 1 ms granularity, and store with it with the name "ts".

SELECT
location,
ts
FROM cos://us-geo/sql/temperature_humidity.csv
USING TIME_SERIES_FORMAT(key="location", timetick="timestamp", value="humidity", granularity="PT0.001S") in ts
"command_info": {
"type": "configure",
"parameters": {
"update_strategy": "merge_once",
"narrowband_recognize": {
"language_customization_id": "ao45vohgFuxyOQRgztu-02I10ut7aJcM-AdInT-VWgj3V"
}
}
}
}
]
}

Show more









 Applying advanced settings to the Text to Speech service 

Use the text_to_speech response type to send configuration commands to the Text to Speech service instance used by the phone integration. By sending a text_to_speech response from an action step, you can dynamically change the Text to Speech configuration during a conversation.

By default, any Text to Speech configuration changes you make persist for the remainder of the conversation, or until you update them again. You can change this behavior by specifying the update_strategy property of the parameters object.

The format of the speech_to_text response type is as follows:

{
"generic": [
{
"response_type": "text_to_speech",
"command_info": {
"type": "<command type>",
"parameters": {
"parameter name": "parameter value",
"parameter name": "parameter value"
}
}
}
]
}



Each command type along with its related parameters are described in the following sections.



 command_info.type : configure 

Dynamically reconfigures the Text to Speech service by applying a set of configuration parameters, which can be based on the conversation flow. For example, you might want to choose a particular voice at a specific point in the conversation.



 parameter description required default 

 synthesize The Text to Speech service configuration to use when synthesizing audio. The parameters defined by this object are used when connecting to the Text to Speech service for speech synthesis requests.
You use the POST /v1/customizations/{customization_id}/grammars/{grammar_name} method to add a grammar file to a custom model.

customization_id (required string)
: Specify the customization ID of the custom model to which the grammar is to be added.

grammar_name (required string)
: Specify a name for the grammar. Use a localized name that matches the language of the custom model and reflects the contents of the grammar.



* Include a maximum of 128 characters in the name.
* Do not use characters that need to be URL-encoded. For example, do not use spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs, equals signs, questions marks, and so on in the name. (The service does not prevent the use of these characters. But because they must be URL-encoded wherever used, their use is strongly discouraged.)
* Do not use the name of a grammar or corpus that has already been added to the custom model.
* Do not use the name user, which is reserved by the service to denote custom words that are added or modified by the user.
* Do not use the name base_lm or default_lm. Both names are reserved for future use by the service.



Content-Type (required string)
: Use the request header to specify the format of the grammar:



* application/srgs for an ABNF grammar
* application/srgs+xml for an XML grammar



Pass the grammar text file as the body of the request. The following example adds the grammar file named confirm.abnf to the custom model with the specified ID. The example names the grammar confirm-abnf.

IBM Cloud

curl -X POST -u "apikey:{apikey}" --header "Content-Type: application/srgs" --data-binary @confirm.abnf "{url}/v1/customizations/{customization_id}/grammars/confirm-abnf"

IBM Cloud Pak for Data
: Some PVC settings, such as the reclaimPolicy, fstype, or the volumeBindingMode can't be set in the Kubernetes secret and must be set in the storage class. As the cluster admin, if you want to enable your cluster users to override your default settings, you must ensure that you set up enough customized storage classes that reference a generic Kubernetes secret so that your users can provision Block Storage for VPC with different reclaimPolicy, fstype, and volumeBindingMode settings.





 Enabling every user to customize the default PVC settings 



1. As the cluster admin, follow the steps to [create a customized storage class](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-blockvpc-customize-storage-class). In the customized storage class YAML file, reference the Kubernetes secret in the metadata.parameters section as follows. Make sure to add the code as-is and not to change variables names.

csi.storage.k8s.io/provisioner-secret-name: ${pvc.name}
csi.storage.k8s.io/provisioner-secret-namespace: ${pvc.namespace}
2. As the cluster user, create a Kubernetes secret that customizes the default settings of the storage class.

apiVersion: v1
kind: Secret
type: vpc.block.csi.ibm.io
metadata:
name: <secret_name>
namespace: <namespace_name>
stringData:
iops: "<IOPS_value>"
zone: "<zone>"
tags: "<tags>"
encrypted: <true_or_false>
resourceGroup: "<resource_group>"
data
encryptionKey: <encryption_key>

name
: Enter a name for your Kubernetes secret.

namespace
: Enter the namespace where you want to create your secret. To reference the secret in your PVC, the PVC must be created in the same namespace.
For more information, see [Processing user input](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-api-clientapi-client-process-input).
3. In the step editor, click And then.
4. Click Use an extension.
5. In the Extension setup window, specify the following information:



* In the Extension field, select the extension you want to call.
* In the Operation field, select the operation you want to perform. (An operation is a method or function supported by the extension.)



6. Specify values for each of the required input parameters. A parameter is an input value sent to an operation, such as the ID of a customer record you want to retrieve or the location to use for a weather forecast.

To assign a value to a parameter, click the input field for the value. You can then select from the list of available variables or write an expression to specify the value.

![Setting a parameter value](https://cloud.ibm.com/docs-content/v1/content/ca9232b3702768f24bb897f48f10778fcda28718/watson-assistant/images/extension-set-parameter.png)

Each parameter has a data type (such as number or string). The variable you select must be compatible with the data type of the parameter; for more information, see [Compatible variables for parameters](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-call-extensionparameter-variable-types).

You must specify values for all required parameters before you can proceed.
7. If you want to specify a value for any optional parameters, click Optional parameters. You can then repeat this process for each optional parameter you want to use.
8. Click Apply. (If the Apply button is not available, check to make sure you have specified values for all required parameters.)



The And then section of the step editor now shows an overview of the call to the extension:

!
If a valid response is provided, it saves the preference information to $seating_preferences. However, by choosing this action as the Not found response next step, you instruct your assistant to stop trying to fill this slot if the user does not provide a valid value for it.
* Skip to response: If, when the condition you define is met, you no longer need to fill any of the remaining slots in this node, choose this action to skip the remaining slots and go directly to the node-level response next. For example, if after capturing the one-way flight information, the slot prompt is, Are you buying round-trip tickets? the Not found condition can check for #No. If #No is found, use this option to skip the remaining slots that capture information about the return flight, and go straight to the node-level response instead.



Click Back to return to the edit view of the slot.
5. To add another conditional response, click Add a response, and then enter the condition and the response to display if the condition is met.

Be sure to add at least one response that will be displayed no matter what. You can leave the condition field blank for this catch all response. Your assistant automatically populates the empty condition field with the true special condition.
6. Click Save to save your changes, close the edit view of the slot, and return to the edit view of the node.







 Moving on after multiple failed attempts 

You can provide users with a way to exit a slot if they cannot answer it correctly after several attempts by using Not found conditional responses. In the catchall response, open the JSON editor to add a counter context variable that will keep track of the number of times the Not found response is returned. In an earlier node, be sure to set the initial counter context variable value to 0.

In this example, your assistant asks for the pizza size. It lets the user answer the question incorrectly 3 times before applying a size (medium) to the variable for the user. (You can include a confirmation slot where users can always correct the size when they are asked to confirm the order information.)

Check for: @size Save as: $size Not found catchall condition:

{
"output": {
"text": {
Value: core.StringPtr(accountID),
},
{
Name: core.StringPtr("serviceName"),
Value: core.StringPtr(serviceName),
},
},
Tags: []contextbasedrestrictionsv1.ResourceTagAttribute{
{
Name: core.StringPtr("tagName"),
Value: core.StringPtr("tagValue"),
},
},
}

createRuleOptions := contextBasedRestrictionsService.NewCreateRuleOptions()
createRuleOptions.SetDescription("this is an example of rule")
createRuleOptions.SetContexts([]contextbasedrestrictionsv1.RuleContext{ruleContextModel})
createRuleOptions.SetResources([]contextbasedrestrictionsv1.Resource{resourceModel})
createRuleOptions.SetEnforcementMode(contextbasedrestrictionsv1.CreateRuleOptionsEnforcementModeEnabledConst)
rule, response, err := contextBasedRestrictionsService.CreateRule(createRuleOptions)
if err != nil {
panic(err)
}
b, _ := json.MarshalIndent(rule, "", " ")
fmt.Println(string(b))

// Request models needed by this operation.

// RuleContextAttribute
const ruleContextAttributeModel = {
name: 'networkZoneId',
value: zoneId,
};

// RuleContext
const ruleContextModel = {
attributes: [ruleContextAttributeModel],
};

// ResourceAttribute
const resourceAttributeAccountIdModel = {
name: 'accountId',
value: accountId,
};
Value: core.StringPtr("169.23.56.234"),
}

replaceZoneOptions := contextBasedRestrictionsService.NewReplaceZoneOptions(
"testString",
"testString",
)
replaceZoneOptions.SetName("an example of zone")
replaceZoneOptions.SetAccountID("12ab34cd56ef78ab90cd12ef34ab56cd")
replaceZoneOptions.SetDescription("this is an example of updated zone")
replaceZoneOptions.SetAddresses([]contextbasedrestrictionsv1.AddressIntf{addressModel})

outZone, response, err := contextBasedRestrictionsService.ReplaceZone(replaceZoneOptions)
if err != nil {
panic(err)
}
b, _ := json.MarshalIndent(outZone, "", " ")
fmt.Println(string(b))

// Request models needed by this operation.

// AddressIPAddress
const addressModel = {
type: 'ipAddress',
value: '169.23.56.234',
};

const params = {
zoneId: 'testString',
ifMatch: 'testString',
name: 'an example of zone',
accountId: '12ab34cd56ef78ab90cd12ef34ab56cd',
addresses: [addressModel],
description: 'this is an example of zone',
};

contextBasedRestrictionsService.replaceZone(params)
.then(res => {
console.log(JSON.stringify(res.result, null, 2));
})
.catch(err => {
console.warn(err)
});
(https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/slots-prompt-for-everything.png)



1. Back in the node edit view, scroll down to the newly-added If no slots are pre-filled, ask this first field. Add the following initial prompt for the node, I can make a reservation for you. Just tell me the day and time of the reservation, and how many people it is for.
2. Click ![Close](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/close.png) to close the node edit view.
3. Test this change from the "Try it out" pane. Open the pane, and then click Clear to nullify the slot context variable values from the previous test.
4. Enter i'd like to make a reservation.

The dialog now responds with, I can make a reservation for you. Just tell me the day and time of the reservation, and how many people it is for.
5. Enter, it's for Saturday. There will be 2 of us coming in at 8pm

The dialog responds with, OK. I am making you a reservation for 2 on Saturday at 8:00 PM.

![Shows the Try it out pane when the user provides everything in one input.](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/slots-everything-tested.png)



If the user provides any one of the slot values in their initial input, then the prompt that asks for everything is not displayed.
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?topic=assistant-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?topic=assistant-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?topic=assistant-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.
Behind the scenes, the [Snapshot for VPC](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about) service is used to create a point-in-time copy of your data. When the first backup snapshot is taken, the entire contents of the volume are copied and retained in IBM Cloud® Object Storage. Subsequent backups of the same volume capture the changes that occurred since the previous backup. You can take up to [750 backups of a volume](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about&interface=uisnapshots_vpc_considerations).

You can [restore](https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-aboutbackup-service-restore-concepts) data from a backup snapshot to a new, fully provisioned volume. If the backup is of a boot volume, you can use it to provision a new instance. However, when you provision an instance by restoring a boot volume from a bootable backup snapshot, you can expect degraded performance in the beginning. During the restoration process, the data is copied from IBM Cloud® Object Storage to Block Storage for VPC, and thus the provisioned IOPS cannot be fully realized until that process finishes.

You can copy a backup snapshot from one region to another region, and later use that snapshot to restore a volume in the new region. The [cross-regional copy](https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-aboutbackup-service-crc) can be used in disaster recovery scenarios when you need to turn on your virtual server instance and data volumes in a different region. The remote copy can be created automatically as part of a backup plan, or manually later.

With the fast restore feature, you can cache snapshots in a specified zone of your choosing. This way, volumes can be restored from snapshots nearly immediately and the new volumes operate with full IOPS instantly. The fast restore feature can achieve a