vania-janet/multiturn-rag-retrieval-data huggingface dataset:
For information about how to update the value of a context variable when the value is a JSON object or JSON array data type, see [Updating a context variable value in JSON](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-runtime-contextdialog-runtime-context-update-json)





 How context variables are processed 

Where you define the context variable matters. The context variable is not created and set to the value that you specify for it until your assistant processes the part of the dialog node where you defined the context variable. In most cases, you define the context variable as part of the node response. When you do so, the context variable is created and given the specified value when your assistant returns the node response.

For a node with conditional responses, the context variable is created and set when the condition for a specific response is met and that response is processed. For example, if you define a context variable for conditional response #1 and your assistant processes conditional response #2 only, then the context variable that you defined for conditional response #1 is not created and set.

For information about where to add context variables that you want your assistant to create and set as a user interacts with a node with slots, see [Adding context variables to a node with slots](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-runtime-contextdialog-runtime-context-var-slots).





 Order of operation 

When you define multiple variables to be processed together, the order in which you define them does not determine the order in which they are evaluated by your assistant. Your assistant evaluates the variables in random order. Do not set a value in the first context variable in the list and expect to be able to use it in the second variable in the list, because there is no guarantee that the first context variable will be executed before the second one. For example, do not use two context variables to implement logic that checks whether the user input contains the word Yes in it.



Using two variables to get a value from user input

 Variable Value 

 user_input <? input.text ?> 
 contains_yes <?
This documentation is for the classic Watson Assistant experience. To see the documentation for the new Watson Assistant, please go [here](https://cloud.ibm.com/docs/watson-assistant).



 Expression language methods 

You can process values extracted from user utterances that you want to reference in a context variable, condition, or elsewhere in the response.



 Where to use the expression syntax 

To expand variable values inside other variables, or apply methods to output text or context variables, use the <? expression ?> expression syntax. For example:



* Referencing a user's input from a dialog node text response

You said <? input.text ?>.
* Incrementing a numeric property from the JSON editor

"output":{"number":"<? output.number + 1 ?>"}
* Checking for a specific entity value from a dialog node condition

@city.toLowerCase() == 'paris'
* Checking for a specific date range from a dialog node response condition

@sys-date.after(today())
* Adding an element to a context variable array from the context editor





 Context variable name Context variable value 

 toppings <? context.toppings.append( 'onions' ) ?> 



You can use SpEL expressions in dialog node conditions and dialog node response conditions also.

When a SpEL expression is used in a node condition, the surrounding <? ?> syntax is not required.

The following sections describe methods you can use to process values. They are organized by data type:



* [Arrays](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-methodsdialog-methods-arrays)
* [Date and Time](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-methodsdialog-methods-date-time)
* [Numbers](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-methodsdialog-methods-numbers)
"crash", "impacted", "overturned", "contacted", "against", "pushed", "passenger was [ejected]", "rolled over a quarter turn" -- the quarter turn indicating severity but being part of the incident, not an ACCIDENT_OUTCOME (do not annotate vehicle rotation). "came to final rest" in a place the vehicle does not belong, such as an embankment or in motion from an impact, or "departed the roadway" (not merely departing a lane, which may be a cause). 
 MANUFACTURER The company that makes the vehicle. Toyota, Mazda, General Motors 
 MODEL The specific kind of car, made by a specific manufacturer. Exclude any extra terms / trim line indicators like "LX", or "SE" (e.g., only annotate "Xterra" for the phrase "Xterra SE"). Camry 
 MODEL_YEAR The model year that is part of the name of the car. '99, 2001 
 PART_OF_CAR A part of a vehicle, either inside or outside of it, regardless of whether specifically involved in the incident. Exclude listings of capabilities of such parts. Include indications of where in the car the part is, or something which just refers to a portion of a car without being a specific part. Can be plural. Can include specification of position in the vehicle, such as "[driver airbag]", "[RF door]" (meaning right-front), "[RR] passenger", "[LF and RF air bags]", "[first row passive/automatic restraints]", "[safety system] with EDR capabilities". Include towed boats, tanks, etc., except semi-trailers, which have a distinct year/model/manufacturer. Cross-section, front plane, tire, steering wheel, airbag, etc. 
 PERSON Any person described in an accident scene in a report (could be a driver or a passenger/occupant of a vehicle, pedestrian, or witness). Don't annotate adjectives, so don't annotate "a [69-year-old] drove", but do annotate "a 69-year-old [male] drove".
* being_processed indicates that the service is still processing the grammar in response to a POST /v1/customizations/{customization_id}/grammars/{grammar_name} request.
* analyzed indicates that the service has successfully processed the grammar and added it to the custom model.
* undetermined means that the service encountered an error while processing the grammar. The information that is returned for the grammar includes an error message that offers guidance for correcting the error.

For example, the grammar might be invalid, or you might have tried to add a grammar with the same name as an existing grammar. You can try to add the grammar again and include the allow_overwrite parameter with the request. You can also delete the grammar and then try adding it again.





 List all grammars example 

The following example lists information about all grammars that have been added to the custom model with the specified customization ID.

IBM Cloud

curl -X GET -u "apikey:{apikey}" "{url}/v1/customizations/{customization_id}/grammars"

IBM Cloud Pak for Data

curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}/grammars"

Three grammars were successfully added to the custom model: confirm-xml, confirm-abnf, and list-abnf.

{
"grammars": [
{
"out_of_vocabulary_words": 0,
"name": "confirm-xml",
"status": "analyzed"
},
{
"out_of_vocabulary_words": 0,
"name": "confirm-abnf",
"status": "analyzed"
},
{
"out_of_vocabulary_words": 8,
"name": "list-abnf",
"status": "analyzed"
}
]
}
Show more





 List a specific grammar example 

The following example shows information about the specified grammar, list-abnf:

IBM Cloud
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.

For example, to create a copy of the values of an array at a certain point of the dialog flow, add a new array that is populated with the values for the existing array. To do so, you can use the following syntax:

{
"context": {
"var2": "<? output.var2?:new JsonArray().append($var1) ?>"
}
}
rule_context_model = {
'attributes': [rule_context_attribute_model],
}

resource_attribute_account_id_model = {
'name': 'accountId',
'value': account_id,
}

resource_attribute_service_name_model = {
'name': 'serviceName',
'value': service_name,
}

resource_model = {
'attributes': [resource_attribute_account_id_model, resource_attribute_service_name_model],
}

rule = context_based_restrictions_service.create_rule(
contexts=[rule_context_model],
resources=[resource_model],
description='this is an example of rule',
enforcement_mode='enabled'
).get_result()

print(json.dumps(rule, indent=2))

ruleContextAttributeModel := &contextbasedrestrictionsv1.RuleContextAttribute{
Name: core.StringPtr("networkZoneId"),
Value: core.StringPtr(zoneID),
}

ruleContextModel := &contextbasedrestrictionsv1.RuleContext{
Attributes: []contextbasedrestrictionsv1.RuleContextAttribute{ruleContextAttributeModel},
}

resourceModel := &contextbasedrestrictionsv1.Resource{
Attributes: []contextbasedrestrictionsv1.ResourceAttribute{
{
Name: core.StringPtr("accountId"),
Value: core.StringPtr(accountID),
},
{
Name: core.StringPtr("serviceName"),
Value: core.StringPtr(serviceName),
},
},
Tags: []contextbasedrestrictionsv1.ResourceTagAttribute{
{
Name: core.StringPtr("tagName"),
ln 

ln(expr)
: Returns the natural logarithm (base e) of expr.
: Example of an SQL function usage fragment

> SELECT ln(1)
: Result value

0.0





 locate 

locate(substr, str[, pos])
: Returns the position of the first occurrence of substr in str after position pos. The indicated pos and return value are 1-based.
: Example of an SQL function usage fragment

> SELECT locate('bar', 'foobarbar')
: Result value

4
: Example of an SQL function usage fragment

> SELECT locate('bar', 'foobarbar', 5)
: Result value

7
: Example of an SQL function usage fragment

> SELECT POSITION('bar' IN 'foobarbar')
: Result value

4





 log 

log(base, expr)
: Returns the logarithm of expr with base.
: Example of an SQL function usage fragment

> SELECT log(10, 100)
: Result value

2.0





 log10 

log10(expr)
: Returns the logarithm of expr with base 10.
: Example of an SQL function usage fragment

> SELECT log10(10)
: Result value

1.0





 log1p 

log1p(expr)
: Returns log(1 + expr).
: Example of an SQL function usage fragment u

> SELECT log1p(0)
: Result value

0.0





 log2 

log2(expr)
: Returns the logarithm of expr with base 2.
: Example of an SQL function usage fragment

> SELECT log2(2)
: Result value

1.0





 lower 

lower(str)
: Returns str with all characters that are changed to lowercase.
: Example of an SQL function usage fragment

> SELECT lower('SparkSql')
: Result value

sparksql





 lpad
* [Understanding disconnected usage](https://cloud.ibm.com/docs/satellite?topic=satellite-disconnected-useunderstand-disconnected)
* [Setting the disconnected usage time](https://cloud.ibm.com/docs/satellite?topic=satellite-disconnected-usedisconnect-time)
* [Disconnected usage by component](https://cloud.ibm.com/docs/satellite?topic=satellite-disconnected-usedisconnect-usage-component)



* [Cluster management disconnected usage](https://cloud.ibm.com/docs/satellite?topic=satellite-disconnected-usecluster)
* [Apps disconnected usage](https://cloud.ibm.com/docs/satellite?topic=satellite-disconnected-useapps)
* [IBM Cloud Catalog disconnected usage](https://cloud.ibm.com/docs/satellite?topic=satellite-disconnected-useibm-cloud-catelog)
* [Identity and access management disconnected usage](https://cloud.ibm.com/docs/satellite?topic=satellite-disconnected-useidentity-access)
* [Secret management disconnected usage](https://cloud.ibm.com/docs/satellite?topic=satellite-disconnected-usesecret-management)
* [Logging and monitoring disconnected usage](https://cloud.ibm.com/docs/satellite?topic=satellite-disconnected-uselog-monitor)
* [Config management disconnected usage](https://cloud.ibm.com/docs/satellite?topic=satellite-disconnected-useconfig-management)
* [Networking disconnected usage](https://cloud.ibm.com/docs/satellite?topic=satellite-disconnected-usenetworking)









 IBM Cloud Satellite notices 

[IBM Cloud Satellite notices](https://cloud.ibm.com/docs/satellite?topic=satellite-sat-noticessat-notices)



* [Creative Commons Attribution Share Alike 4.0 Generic](https://cloud.ibm.com/docs/satellite?topic=satellite-sat-noticescc-40-generic)







 Version history
Multiple apps are separated by commas.
* <LEVELS> represents the list of levels for which data is included in the view. Multiple levels are separated by commas, for example, levels=normal,critical.
* <TIMEFRAME> represents the timeframe that you apply to the data that is displayed through the view. For example, look at the following samples:

When you specify a timeframe of July 12, the value is t=July%2012.

When you specify a timeframe of July 12, 2020, the value is t=July%2012%2C%202020.

When you specify a timeframe of July 12, 2020 to July 15,2020, the value is t=July%2012%2C%202020%20to%20July%2015%2C2020.
In each case, we see the array before the action, the action, and the array after the action has been applied.



* Append: To add values to the end of an array, use the append method.

For this Dialog runtime context:

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

Make this update:

{
"context": {
"toppings_array": "<? $toppings_array.append('ketchup', 'tomatoes') ?>"
}
}

Result:

{
"context": {
"toppings_array": ["onion", "olives", "ketchup", "tomatoes"]
}
}
* Remove: To remove an element, use the remove method and specify its value or position in the array.



* Remove by value removes an element from an array by its value.

For this Dialog runtime context:

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

Make this update:

{
"context": {
"toppings_array": "<? $toppings_array.removeValue('onion') ?>"
}
}

Result:

{
"context": {
"toppings_array": ["olives"]
}
}
* Remove by position: Removing an element from an array by its index position:

For this Dialog runtime context:

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

Make this update:

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

Result:

{
"context": {
Usage in the enterprise is invoiced through the enterprise account. As with all billable accounts, usage is invoiced monthly, and the invoice is due on the billing date for your account. During each billing cycle, a single invoice with the usage costs from all accounts is made available in the enterprise account. The invoice contains costs for all platform and infrastructure usage as a single-line item in your invoice. If all of the credit in the credit pool is used, the invoice contains a line item for any overage charges.

Because all usage is invoiced through the enterprise account, child accounts within the enterprise don't receive separate invoices.

You can analyze usage costs for each account or account group on the Usage page in the enterprise account. For details, see [Viewing usage in an enterprise](https://cloud.ibm.com/docs/billing-usage?topic=billing-usage-enterprise-usage).





 Access management for enterprise billing and usage 

As with other enterprise management roles, access to enterprise billing and usage is managed through the enterprise account. Users must be invited to the enterprise account and assigned an access policy with a role on the relevant service.

In an enterprise, billing access and usage access are assigned separately.



* Billing access is provided by assigning enterprise users a role on the Billing account management service. For example, you can assign the Viewer role to an enterprise user so that they can view the amount of available subscription credit in the credit pool. If you would like an enterprise user to be able to add new subscriptions or manage payment methods, you can assign the Editor or Administrator role to them.
* Usage access is provided by assigning enterprise users the Usage Reports Viewer, Editor, or Administrator role on the Enterprise account management service. You can assign this access for the entire enterprise or for specific account groups and accounts.



If you want your billing administrator to be able to view costs by account or account group, assign them the appropriate access on both the Enterprise service and Billing service.

For more information, see [Assigning access for enterprise management](https://cloud.ibm.com/docs/secure-enterprise?topic=secure-enterprise-assign-access-enterprise).
"avg_temp": (${temp_1} + ${temp_2}) / 2
}

To refer to a child object contained in a JSON value, use dot notation to express the path to the object (for example, ${customer}.name.lastname).

If you need to refer to a child of an object that might or might not be defined, use the safe navigation operator (?). For example, the expression ${customer}.name?.lastname evaluates to null if customer.name is null. (Without the safe navigation operator, an error would result.)





 Methods 

Use expression language methods to manipulate values (for example, formatting a string or appending an item to an array). For more information about the supported methods for each data type, see [Expression language methods for actions](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-expression-methods-actions).
"input_length": "<? input.text.length() ?>"
}
}

Results in this output:

{
"context": {
"input_length": 5
}
}





 String.matches(String regexp) 

This method returns true if the string matches the input regular expression.

For this input:

"Hello".

This syntax:

{
"conditions": "input.text.matches('^Hello$')"
}

Result: The condition is true because the input text matches the regular expression ^Hello$.





 String.startsWith(String) 

This method returns true if the string starts with the input substring.

For this input:

"What is your name?".

This syntax:

{
"conditions": "input.text.startsWith('What')"
}

Results: The condition is true.





 String.substring(Integer beginIndex, Integer endIndex) 

This method gets a substring with the character at beginIndex and the last character set to index before endIndex. The endIndex character is not included.

For this Dialog runtime context:

{
"context": {
"my_text": "This is a text."
}
}

This syntax:

{
"context": {
"my_text": "<? $my_text.substring(5, $my_text.length()) ?>"
}
}

Results in this output:

{
"context": {
"my_text": "is a text."
}
}





 String.toLowerCase() 

This method returns the original String converted to lowercase letters.

For this input:

"This is A DOG!"

This syntax:

{
"context": {
"input_lower_case": "<? input.text.toLowerCase() ?>"
}
VPC gives you the security of a private cloud, with the agility and ease of a public cloud. See [IBM Cloud® Virtual Private Cloud Gen 2](https://cloud.ibm.com/docs/vpc?topic=vpc-getting-started).

The following table lists VPC infrastructure services that send auditing events:



Table 13. List of VPC infrastructure services (generation 2)

 Service CRN service name Events 

 [Storage resources](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-about) is.volume [Location-based events](https://cloud.ibm.com/docs/vpc?topic=vpc-at-eventsevents-storage) 
 [Compute resources](https://cloud.ibm.com/docs/vpc?topic=vpc-about-advanced-virtual-servers) is.instance [Location-based events](https://cloud.ibm.com/docs/vpc?topic=vpc-at-eventsevents-compute) 
 [Network resources](https://cloud.ibm.com/docs/vpc?topic=vpc-about-networking-for-vpc) is.subnet [Location-based events](https://cloud.ibm.com/docs/vpc?topic=vpc-at-eventsevents-network) 
 [Load Balancer](https://cloud.ibm.com/docs/vpc?topic=vpc-load-balancers) is.load-balancer [Location-based events](https://cloud.ibm.com/docs/vpc?topic=vpc-at-eventsevents-load-balancers) 
 [VPN](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn) is.vpn [Location-based events](https://cloud.ibm.com/docs/vpc?topic=vpc-at-eventsat-events)
[File shares](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-vpc-encryption) provide a customer-managed encryption option similar to Block Storage for VPC volumes.





 Advantages of customer-managed encryption 

Customer-managed encryption has several advantages over IBM-managed encryption.

You control your keys:



* Because you bring your own keys (BYOK) to the cloud, you control encryption of your Block Storage for VPC volumes, file shares, and custom images.
* You grant the IBM VPC service access to use your root keys to encrypt your data. You can revoke access at any time for any reason.
* Your data is protected while in transit from the storage system to the hypervisor and host within the VPC, and at rest in Block Storage for VPC and File Storage for VPC.



Encrypt boot and data volumes:



* Your Block Storage for VPC data is always encrypted with your own keys both at rest and in motion.
* Each boot and data volume is encrypted at rest with a unique master encryption key. If the key is compromised, no other Block Storage for VPC volume is impacted because the compromised key protects only a single volume.
* Primary boot volumes that are created from Linux or Windows stock images are encrypted by default with IBM-managed encryption. If you create an instance from a stock image and specify customer-managed encryption for data volumes, the data that is written to those volumes is protected by customer-managed encryption.
* You control the number and usage of root keys to use for envelope encryption at the volume level. For example, you can choose to encrypt your boot volume with one root key and data volumes with a different root key.
* Snapshots that are created from boot and data volumes inherit the customer-managed encryption from the source volume.



Encrypt file shares:



* File share data is always encrypted with your own keys at rest.
* You control the number and usage of root keys to use for envelope encryption at the file shares level. That is, you can choose to encrypt all your file shares with same root key or each file share with different keys.
Using Virtual Private Endpoints with Code Engine 

All IBM Cloud® Code Engine projects offer integration with IBM Cloud® Virtual Private Endpoints (VPE) for Virtual Private Cloud (VPC). This support gives you the ability to connect from your VPC network to Code Engine applications by using the IP addresses of your choosing, which are allocated from a subnet within your VPC.

With Code Engine, you can use the following types of VPEs:



* [Virtual Private Endpoints to manage project resources](https://cloud.ibm.com/docs/codeengine?topic=codeengine-regionsendpoints-project). There is one static VPE per region.
* [Virtual Private Endpoints to access applications](https://cloud.ibm.com/docs/codeengine?topic=codeengine-regionsendpoints-app). There is one VPE per Code Engine project. All apps within the project can be accessed by using this VPE.



Private endpoints provide a connection to your project resources and applications on the IBM Cloud Private network. When you connect through a virtual private endpoint, all traffic is routed to hardware that is dedicated to Code Engine applications and remains on the IBM Cloud Private network. There are no additional charges for all traffic to and from this endpoint on the condition that the traffic remains in IBM Cloud.

A Code Engine project is automatically configured with both a public and a virtual private endpoint.

You can control the [visibility](https://cloud.ibm.com/docs/codeengine?topic=codeengine-application-workloadsoptionsvisibility) of Code Engine applications and specify whether to expose the application to public or private endpoints. An application that is configured for the private network can be accessed through the VPE or by other Code Engine applications. Applications that are accessed through the VPE do not leave the IBM network and stay within the IBM Cloud network.



 Using your VPE to manage project resources securely 

Before you begin, you must have an [IBM Cloud account](https://cloud.ibm.com/registration).



1. Create an IBM Cloud® Virtual Private Cloud.