vania-janet/multiturn-rag-retrieval-data huggingface dataset:
Select Create intent.
3. In the Intent name field, type a name for the intent.



* The intent name can contain letters (in Unicode), numbers, underscores, hyphens, and periods.
* The name cannot consist of .. or any other string of only periods.
* Intent names cannot contain spaces and must not exceed 128 characters. The following are examples of intent names:



* weather_conditions
* pay_bill
* escalate_to_agent





A number sign is prepended to the intent name automatically to help identify the term as an intent. You do not need to add it.

Optionally add a description of the intent in the Description field.
4. Select Create intent to save your intent name.

![Screen capture that shows new intent definition](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/intent-create.png)
5. In the User example field, type the text of a user example for the intent. An example can be any string up to 1,024 characters in length. The following utterances might be examples for the pay_bill intent:



* I need to pay my bill.
* Pay my account balance
* make a payment



To learn about the impact of including references to entities in your user examples, see [How entity references are treated](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-intentsintents-entity-references).

Intent names and example text can be exposed in URLs when an application interacts with Watson Assistant. Do not include sensitive or personal information in these artifacts.
6. Click Add example to save the user example.

!
You can apply the indexOf method to the array of intents generated each time user input is evaluated to determine the array index number of a specific intent.

intents.indexOf("General_Greetings")

If you want to know the confidence score for a specific intent, you can pass the prior expression in as the index value to an expression with the syntax intents[index].confidence. For example:

intents[intents.indexOf("General_Greetings")].confidence





 JSONArray.join(String delimiter) 

This method joins all values in this array to a string. Values are converted to string and delimited by the input delimiter.

For this Dialog runtime context:

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

Dialog node output:

{
"output": {
"generic" : [
{
"values":
{
"text": "This is the array: <? $toppings_array.join(';') ?>"
}
],
"response_type": "text",
"selection_policy": "sequential"
}
]
}
}

Result:

This is the array: onion;olives;ham;

If a user input mentions multiple toppings, and you defined an entity named @toppings that can recognize topping mentions, you could use the following expression in the response to list the toppings that were mentioned:

So, you'd like <? @toppings.values.join(',') ?>.

If you define a variable that stores multiple values in a JSON array, you can return a subset of values from the array, and then use the join() method to format them properly.



 Collection projection 

A collection projection SpEL expression extracts a subcollection from an array that contains objects. The syntax for a collection projection is array_that_contains_value_sets.).get(0) ?>.value_of_interest]
You can apply the indexOf method to the array of intents generated each time user input is evaluated to determine the array index number of a specific intent.

intents.indexOf("General_Greetings")

If you want to know the confidence score for a specific intent, you can pass the earlier expression in as the index value to an expression with the syntax intents[index].confidence. For example:

intents[intents.indexOf("General_Greetings")].confidence





 JSONArray.join(String delimiter) 

This method joins all values in this array to a string. Values are converted to string and delimited by the input delimiter.

For this Dialog runtime context:

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

Dialog node output:

{
"output": {
"generic" : [
{
"values":
{
"text": "This is the array: <? $toppings_array.join(';') ?>"
}
],
"response_type": "text",
"selection_policy": "sequential"
}
]
}
}

Result:

This is the array: onion;olives;ham;

If a user input mentions multiple toppings, and you defined an entity named @toppings that can recognize topping mentions, you could use the following expression in the response to list the toppings that were mentioned:

So, you'd like <? @toppings.values.join(',') ?>.

If you define a variable that stores multiple values in a JSON array, you can return a subset of values from the array, and then use the join() method to format them properly.



 Collection projection 

A collection projection SpEL expression extracts a subcollection from an array that contains objects. The syntax for a collection projection is array_that_contains_value_sets.).get(0) ?>.value_of_interest]
In our simplified client app, we will use this capability to select from a list of the actions the assistant supports (greetings, displaying the time, and exiting). In addition to the three intents previously shown (hello, time, and goodbye), the example workspace supports a fourth intent: menu, which is matched when the use asks to see a list of available actions.

When the workspace recognizes the menu intent, the dialog responds with an option response:

{
"output": {
"generic": [
{
"title": "What do you want to do?",
"options":
{
"label": "Send greeting",
"value": {
"input": {
"text": "hello"
}
}
},
{
"label": "Display the local time",
"value": {
"input": {
"text": "time"
}
}
},
{
"label": "Exit",
"value": {
"input": {
"text": "goodbye"
}
}
}
],
"response_type": "option"
}
],
"intents": [
{
"intent": "menu",
"confidence": 0.6178638458251953
}
],
"entities": []
},
"user_id": "faf4a112-f09f-4a95-a0be-43c496e6ac9a"
}
Show more

The option response contains multiple options to be presented to the user. Each option includes two objects, label and value. The label is a user-facing string identifying the option; the value specifies the corresponding message input that should be sent back to the assistant if the user chooses the option.

Our client app will need to use the data in this response to build the output we show to the user, and to send the appropriate message to the assistant.
* Strings that begin with a number sign (#) in the context or output objects of a message are no longer treated as intent references.

Previously, these strings were treated as intents automatically. For example, if you specified a context variable, such as "color":"FFFFFF", then the hex color code (FFFFFF) would be treated as an intent. Your assistant would check whether an intent named FFFFFF was detected in the user's input, and if not, would replace FFFFFF with false. This replacement no longer occurs.

Similarly, if you included a number sign (#) in the text string in a node response, you used to have to escape it by preceding it with a back slash (). For example, We are the #1 seller of lobster rolls in Maine. You no longer need to escape the symbol in a text response.

This change does not apply to node or condtional response conditions. Any strings that begin with a number sign (#) which are specified in conditions continue to be treated as intent references. Also, you can use SpEL expression syntax to force the system to treat a string in the context or output objects of a message as an intent. For example, specify the intent as <? intent-name ?>.







 25 February 2019 

Slack integration enhancement
: You can now choose the type of event that triggers your assistant in a Slack channel. Previously, when you integrated your assistant with Slack, the assistant interacted with users through a direct message channel. Now, you can configure the assistant to listen for mentions, and respond when it is mentioned in other channels. You can choose to use one or both event types as the mechanism through which your assistant interacts with users.





 11 February 2019 

Integrate with Intercom
: Intercom, a leading customer service messaging platform, has partnered with IBM to add a new agent to the team, a virtual Watson Assistant. You can integrate your assistant with an Intercom application to enable the app to seamlessly pass user conversations between your assistant and human support agents. This integration is available to Plus and Premium plan users only.
The confidence property is a decimal percentage that represents your assistant's confidence in the recognized intent.

While testing your dialog, you can see details of the intents that are recognized in user input by specifying this expression in a dialog node response:

<? intents ?>

For the user input, Hello now, your assistant finds an exact match with the #greeting intent. Therefore, it lists the #greeting intent object details first. The response also includes the 10 other intents that are defined in the skill regardless of their confidence score. (In this example, its confidence in the other intents is set to 0 because the first intent is an exact match.) The top 10 intents are returned because the Try it out pane sends the alternate_intents:true parameter with its request. If you are using the API directly and want to see the top 10 results, be sure to specify this parameter in your call. If alternate_intents is false, which is the default value, only intents with a confidence above 0.2 are returned in the array.

[!{"intent":"greeting","confidence":1},
{"intent":"yes","confidence":0},
{"intent":"pizza-order","confidence":0}]

The following examples show how to check for an intent value:



* intents[0] == 'Help'
* intent == 'Help'



intent == 'help' differs from intents[0] == 'help' because intent == 'help' does not throw an exception if no intent is detected. It is evaluated as true only if the intent confidence exceeds a threshold. If you want to, you can specify a custom confidence level for a condition, for example, intents.size() > 0 && intents[0] == 'help' && intents[0].confidence > 0.1





 Accessing input 

The input JSON object contains one property only: the text property. The text property represents the text of the user input.



 Input property usage examples 

The following example shows how to access input:
[Shows the results from a search for intents](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/intent-search-results.png)







 Exporting intents 

You can export a number of intents to a CSV file, so you can then import and reuse them for another Watson Assistant application.



1. Go to the Intents page.



* To export all intents, meaning the intents listed on this and any additional pages, do not select any individual intents. Instead, click the Export all intents icon. ![Export option](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/export-c10.png)
* To export the intents that are listed on the current page only, select the checkbox in the header. This action selects all of the intents on the current page. Click Export.
* To export one or more specific intents, select the intents that you want to export, and then click Export.

![Shows that two intents are selected and the export icon is in focus](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/intent-export.png)



2. Specify the name and location in which to store the CSV file that is generated.







 Importing intents and examples 

If you have a large number of intents and examples, you might find it easier to import them from a comma-separated value (CSV) file than to define them one by one. Be sure to remove any personal data from the user examples that you include in the file.



1.
2. In the Try it out pane, enter a question or other text string and press Enter to see which intent is recognized. If the wrong intent is recognized, you can improve your model by adding this text as an example to the correct intent.

If you have recently made changes in your skill, you might see a message that indicates that the system is still retraining. If you see this message, wait until training completes before testing:

![Screen capture showing retraining message](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/training.png)

The response indicates which intent was recognized from your input.

![Screen capture of testing intents](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/test_intents.png)
3. If the system does not recognize the correct intent, you can correct it. To correct the recognized intent, select the displayed intent and then select the correct intent from the list. After your correction is submitted, the system automatically retrains itself to incorporate the new data.

![Screen capture of correcting a recognized intent](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/correct_intent.png)
4. If the input is unrelated to any of the intents in your application, you can teach your assistant that by selecting the displayed intent, and then clicking Mark as irrelevant.

!
[Shows that two intents are selected and the export icon is in focus](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/intent-export.png)



2. Specify the name and location in which to store the CSV file that is generated.







 Importing intents and examples 

If you have a large number of intents and examples, you might find it easier to import them from a comma-separated value (CSV) file than to define them one by one. Be sure to remove any personal data from the user examples that you include in the file.



1. Collect the intents and examples into a CSV file, or export them from a spreadsheet to a CSV file. The required format for each line in the file is as follows:

<example>,<intent>

where <example> is the text of a user example, and <intent> is the name of the intent you want the example to match. For example:

Tell me the current weather conditions.,weather_conditions
Is it raining?,weather_conditions
What's the temperature?,weather_conditions
Where is your nearest location?,find_location
Do you have a store in Raleigh?,find_location

Important: Save the CSV file with UTF-8 encoding and no byte order mark (BOM).
2. From the Intents page, click the Import icon ![Import icon](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/importGA.png), and then drag a file or browse to select a file from your computer.

Important: The maximum CSV file size is 10 MB. If your CSV file is larger, consider splitting it into multiple files and importing them separately.

The file is validated and imported, and the system begins to train itself on the new data.
Migrating intents and entities 

You can migrate your intents and entities from the classic Watson Assistant experience to the new Watson Assistant experience.



 Downloading intents 

You can download intents to a CSV file, so you can then upload and reuse them as actions or example phrases in the new Watson Assistant experience.



1. Go to the Intents page.
2. Select the intents that you want to download, and then click the Download icon ![Download icon](https://cloud.ibm.com/docs-content/v1/content/ca9232b3702768f24bb897f48f10778fcda28718/watson-assistant/images/download-icon.png).

If you plan to use a downloaded intent file to upload example phrases for a specific action, download only a single intent. In the new experience, only one intent can be uploaded per action.
3. Specify the name and location in which to store the CSV file that is generated, and click Save.



You can now perform the following tasks to migrate information to the new Watson Assistant:



* Upload intents as actions. For more information, see [Uploading intents as actions](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-upload-download-actionsupload-download-actions-upload-intents).
* Upload the examples from a single intent as example phrases for a specific action. For more information, see [Uploading phrases](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-understand-questionsunderstand-questions-uploading-examples).







 Downloading entities 

You can download a number of entities to a CSV file, so you can then upload and reuse them as saved customer responses in the new Watson Assistant experience.



1. Go to the Entities page.
2. Select the entities that you want to download, and then click the Download icon !
Repeat the previous steps to resolve other intents with conflicts.







 Deleting intents 

You can select a number of intents for deletion.

IMPORTANT: By deleting intents that you are also deleting all associated examples, and these items cannot be retrieved later. All dialog nodes that reference these intents must be updated manually to no longer reference the deleted content.



1. Go to the Intents page



* To delete all intents, meaning the intents listed on this and any additional pages, do not select any individual intents. Instead, click the Delete all intents icon. ![Delete option](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/delete-c10.png)
* To delete the intents that are listed on the current page only, select the checkbox in the header. This action selects all of the intents that are listed on the current page. Click Delete.
* To delete one or more specific intents, select the intents that you want to delete, and then click Delete.

![Shows that an intent was selected and the delete icon is in focus](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/intent-delete.png)
Test the intent by checking whether user utterances that are similar to, but not exactly the same as, the examples you added to the training data have successfully trained your assistant to recognize input with an about_restaurant intent.



1. Click the ![Try it](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/ask_watson.png) icon to open the "Try it out" pane.
2. Enter, I want to learn more about your restaurant.

Your assistant indicates that the about_restaurant intent is recognized, and returns a response with the image and text that you specified for the dialog node.

![Shows the Try it out pane recognizing the #about_restaurant intent and showing the image and text response.](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/gs-ass-test-about-restaurant.png)



Congratulations! You have added a custom intent, and a dialog node that knows how to handle it.

The about_restaurant intent is designed to recognize a variety of general questions about the restaurant. You added a single node to capture such questions. The response is long, but it is a single statement that can potentially answer questions about all of the following topics:



* The restaurant owners
* The restaurant history
* The philosophy
* The number of sites
* The days of operation
* The meals served
* The fact that the restaurant bakes cakes to order



For general, low-hanging fruit types of questions, a single, general answer is suitable.







 Step 4: Manage cake orders 

Customers place orders in person, over the phone, or by using the order form on the website. After the order is placed, users can cancel the order through the virtual assistant. First, define an entity that can recognize order numbers.
Action overview 

Learn more about IBM Cloud® Functions actions, web actions, and sequences.

What is an action?

An action is a small piece of code that can be invoked or set to automatically run in response to an event. In either case, each run results in a record that is identified by a unique activation ID. The input and the result of an action can be seen as key-value pairs. The key is a string and the value is a valid JSON value. An action can be written in the language of your choice and provided to the service as either source code or a Docker image. The action code runs when it is directly invoked by the Cloud Functions API, CLI, or iOS SDK. An action can automatically respond to events from IBM Cloud or third-party services. For more information about actions, see [Creating actions](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-actions).

Why would I use an action?

By using actions, you control the amount of time that your code is running, which lowers your costs.

For example, you can use actions to detect faces in an image, respond to changes in a database, aggregate a set of API calls, or even post a tweet.

Can I use more than one action at a time?

Yes! You can use actions to call other actions, or you can string actions together to [create sequences](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-sequences). To make this work, the output of one action is the input for another action, which would provide an output that can be used to trigger another action and so on. You can even bundle the group of actions that you create to form a package. With a package, you can reuse common actions or sequences by calling the package instead of configuring the action or sequence again.

What is a sequence?

A set of actions can be chained together into a sequence without having to write any code. A sequence is a chain of actions, invoked in order, where the output of one action is passed as input to the next action.
In the "Try it out" pane, enter a question or other text string and press Enter to see which intent is recognized. If the wrong intent is recognized, you can improve your model by adding this text as an example to the correct intent.

If you have recently made changes in your skill, you might see a message that indicates that the system is still retraining. If you see this message, wait until training completes before testing:

![Screen capture showing retraining message](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/training.png)

The response indicates which intent was recognized from your input.

![Screen capture of testing intents](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/test_intents.png)
3. If the system does not recognize the correct intent, you can correct it. To correct the recognized intent, select the displayed intent and then select the correct intent from the list. After your correction is submitted, the system automatically retrains itself to incorporate the new data.

![Screen capture of correcting a recognized intent](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/correct_intent.png)
4. If the input is unrelated to any of the intents in your application, you can teach your assistant that by selecting the displayed intent, and then clicking Mark as irrelevant.

!