vania-janet/multiturn-rag-retrieval-data huggingface dataset:
if (typeof evt.data === string) {
messages += evt.data;
} else {
console.log('Received ' + evt.data.size() + ' binary bytes');
audioStream += evt.data;
}
}

function onClose(evt) {
// The service's response is complete.
}





 WebSocket return codes 

The service can send the following return codes to the client over the WebSocket connection:



* 1000 indicates normal closure of the connection, meaning that the purpose for which the connection was established has been fulfilled.
* 1002 indicates that the service is closing the connection due to a protocol error.
* 1006 indicates that the connection closed abnormally.
* 1009 indicates that the frame size exceeded the 4 MB limit.
* 1011 indicates that the service is terminating the connection because it encountered an unexpected condition that prevents it from fulfilling the request, such as an invalid argument. The return code can also indicate that the input text was too large.



If the socket closes with an error, the service sends the client an informative message of the form {"error": "Specific error message"} before closing. The service can also send non-fatal warning messages for unknown parameters. For more information about WebSocket return codes, see the Internet Engineering Task Force (IETF) [Request for Comments (RFC) 6455](https://tools.ietf.org/html/rfc6455).

The WebSocket implementations of the SDKs can return different or additional response codes.



 Example error and warning messages 

The following examples show error responses. They include a JSON text message and a formatted message from the client's onClose() callback method. The formatted messages begin with the boolean true because the connection is closed. They also include the WebSocket error code that caused the closure.



* This example shows error messages for an invalid argument for the accept parameter:

{
"error": "Unsupported mimetype.
* Video: This response type embeds a native video from various file formats in the response. A title and description are not displayed, whether or not you specify them.
* iframe: This response type inserts an embeddable third-party link in the response that displays interactive content (such as forms or maps). A title is displayed in the preview card. A description is not displayed, whether or not you specify it.
* Option: This response type shows a list of options that the user can choose from.



* A title is required and is displayed before the list of options.
* A description is not displayed, whether you specify one or not.
* After a user clicks one of the buttons, the button choices disappear and are replaced by the user input that is generated by the user's choice. If the assistant or the user enters new input, then the button-generated input disappears. Therefore, if you include multiple response types in a single response, position the option response type last. Otherwise, content from subsequent responses, such as text from a text response type, will replace the button-generated text.



* Pause: This response type pauses the assistant's activity in the Messenger. However, activity does not resume after the pause unless another response type is triggered after it. Whenever you include this response type, add another, different response type, such as a text response, and position it after this one.



See [Rich responses](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overviewdialog-overview-multimedia) for more information about response types.





 Chatting with the assistant 

To start a chat with the assistant, complete the following steps:



1. Open Facebook Messenger.
2. Type the name of the page you created earlier.
3. After the page comes up, click it, and then start chatting with the assistant.



The Welcome node of your dialog is not processed by the Facebook Messenger integration. The welcome message is not displayed in the Facebook chat like it is in the "Try it out" pane or in the assistant preview. It is not triggered from here because nodes with the welcome special condition are skipped in dialog flows that are started by users.
You can change it to something else, such as I need something else or These aren't what I want. Or, you can remove the text to omit offering this choice. 



3. If you enable response modes, you can modify this text:



Response modes settings

 Field Default text Description 

 One action matches Something else If an assistant prioritizes one action that it thinks matches the customer need, it can clarify the match by asking the customer to confirm. This choice accompanies the single action in case the customer needs something else. You can change it to something else, such as I need something else or This isn't what I want. 
 Connection to support Connect to support The assistant can include a choice to connect to other support in the list of clarifying questions. If the customer picks this choice, the assistant uses your Fallback action. You can change it to something else, such as Talk to a live agent or Search for the answer. 



4. Click Save, and then click Close.
5. Publish a new version of your assistant to the live environment to apply the customizations. For more information, see [Publishing your content](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-publish).







 Disabling clarifying questions 

You can disable clarifying questions for all actions.

To disable clarification for all actions:



1. From the Actions page of the assistant, click Global settings![Gear icon](https://cloud.ibm.com/docs-content/v1/content/icons/settings.svg).
2. On the Clarifying questions tab, ensure that the Response modes switch is set to Off.
3. Set the Enable disambiguation switch to Off.
4. Click Save, and then click Close.
5. Publish a new version of your assistant to the live environment to disable clarification. For more information, see [Publishing your content](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-publish).







 Excluding an action from clarifying questions
Configuring the home screen 

On the Home screen tab, you can configure the contents of the home screen, which welcomes customers and helps them start the conversation with the assistant. The home screen replaces any greeting that would otherwise be sent by the Greet customer system action.

![An example of the home screen](https://cloud.ibm.com/docs-content/v1/content/ca9232b3702768f24bb897f48f10778fcda28718/watson-assistant/images/home-screen.png)

If you prefer to use a Greet customer system action instead of the home screen, you can disable it by clicking the toggle switch on the Home screen tab.

If you use the home screen, you must configure it to show content that is relevant to your customers:



*  In the Greeting message field, type a greeting that is engaging and invites the user to interact with your assistant. This greeting is the first message your customers will see when they open the web chat window.
*  In the Conversation starters section, specify the conversation starter messages you want to be displayed on the home screen.

These messages are displayed on the home screen as options that customers can click to start the conversation (for example, I need to reset my password or What is my account balance?). Specify conversation starters that are likely to be useful to your customers, and that your assistant knows how to handle.

Be sure to test each conversation starter. Use only messages that your assistant understands and knows how to answer well. Conversation starters cannot be longer than 35 characters.

You can specify up to 5 conversation starters.



The messages you specify are immediately reflected by the web chat preview that is shown on the page, and you can click the conversation starters to see how your assistant responds. However, no configuration changes are applied to the environment until you click Save and exit.
After you save the header value, the string is replaced by asterisks and can't be viewed again.



Your webhook details are saved automatically.





 Removing the webhook 

If you decide you do not want to log messages with a webhook, complete the following steps:



1. In your assistant, go to Environments and open the environment where you want to remove the webhook.
2. On the Environments page, click the ![Environment settings icon](https://cloud.ibm.com/docs-content/v1/content/ca9232b3702768f24bb897f48f10778fcda28718/watson-assistant/images/gear-icon-black.png) icon beside the environment title to open the environment settings.
3. On the Environment settings page, click Webhooks > Log webhook.
4. Do one of the following things:



* To change the webhook that you want to call, click Delete webhook to delete the currently specified URL and secret. You can then add a new URL and other details.
* To stop calling a webhook to log every message and response, click the Log webhook switch to disable the webhook altogether.









 Webhook security 

To authenticate the webhook request, verify the JSON Web Token (JWT) that is sent with the request. The webhook microservice automatically generates a JWT and sends it in the Authorization header with each webhook call. It is your responsibility to add code to the external service that verifies the JWT.

For example, if you specify purple unicorn in the Secret field, you might add code similar to this:

const jwt = require('jsonwebtoken');
...
const token = request.headers.authentication; // grab the "Authentication" header
try {
const decoded = jwt.verify(token, 'purple unicorn');
} catch(err) {
// error thrown if token is invalid
}





 Webhook request body
See [Fuzzy matching](https://cloud.ibm.com/docs/assistant?topic=assistant-entitiesentities-fuzzy-matching) for details.





 13 June 2017 

User conversations
: The Improve panel now includes a User conversations page, which provides a list of user interactions with your chatbot that can be filtered by keyword, intent, entity, or number of days. You can open individual conversations to correct intents, or to add entity values or synonyms.

Regex change
: The regular expressions that are supported by SpEL functions like find, matches, extract, replaceFirst, replaceAll and split have changed. A group of regular expression constructs are no longer allowed, including look-ahead, look-behind, possessive repetition and backreference constructs. This change was necessary to avoid a security exposure in the original regular expression library.





 12 June 2017 

Updates
: This release includes the following updates:



* The maximum number of workspaces that you can create with the Lite plan (formerly named the Free plan) changed from 3 to 5.
* You can now assign any name to a dialog node; it does not need to be unique. And you can subsequently change the node name without impacting how the node is referenced internally. The name you specify is treated as an alias and the system uses its own internal identifier to reference the node.
* You can no longer change the language of a workspace after you create it by editing the workspace details. If you need to change the language, you can export the workspace as a JSON file, update the language property, and then import the JSON file as a new workspace.







 6 June 2017 

Learn
: A new Learn about IBM Watson® Assistant page is available that provides getting started information and links to service documentation and other useful resources. To open the page, click the icon in the page header.

Bulk export and delete
: You can now simultaneously export a number of intents or entities to a CSV file, so you can then import and reuse them for another Watson Assistant application. You can also simultaneously select a number of entities or intents for deletion in bulk.

Updates to Korean
Show more

When you test the webhook in the preview panel, you can submit Buenos días, and the assistant responds as if you said Good morning in English. In fact, when you check the Analyze page of your assistant and open Conversations, the log shows that the user input was Good morning.

You can add a postmessage webhook to translate the message's response back into the customer's native language before it is displayed. For more information see [Example 2](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-webhook-postwebhook-post-example-translate-back).





 Removing the webhook 

If you decide you do not want to preprocess customer input with a webhook, complete the following steps:



1. From the assistant overview page, click the ![Overflow menu](https://cloud.ibm.com/docs-content/v1/content/ca9232b3702768f24bb897f48f10778fcda28718/watson-assistant/images/kebab.png) icon, and then choose Settings.
2. Click Webhooks > Pre-message webhook.
3. Do one of the following things:



* To change the webhook that you want to call, click Delete webhook to delete the currently specified URL and secret. You can then add a new URL and other details.
* To stop calling a webhook to process every incoming message, click the Pre-message webhook switch to disable the webhook altogether.
On the Change conversation topic tab, click the Confirmation section.



Settings that you can change are:



Confirmation settings

 Setting Description 

 Ask a confirmation question Change the toggle to Off to disable the confirmation question for all actions. 
 Assistant says By default, the assistant asks Do you want to return to your previous topic? and uses the system variable Digressed from to include the name of the previous action. Use the editor to modify the confirmation question. 
 Validation message By default, the assistant says Please reply back with yes or no if the customer doesn't answer Yes or No. Use the editor to modify the validation message. 
 Show confirmation buttons The assistant includes clickable Yes and No buttons with the confirmation question. Click the toggle to Off to disable the Yes and No buttons.
To avoid the timeout with the WebSocket interface, request interim results ("interim_results": "true") in the JSON for the start message to initiate the request. You can discard the interim results if you do not need them. This issue will be resolved in a future update.





 19 January 2016 

New profanity filtering feature
: The service was updated to include a new profanity filtering feature on January 19, 2016. By default, the service censors profanity from its transcription results for US English audio. For more information, see [Profanity filtering](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-formattingprofanity-filtering).





 17 December 2015 

New keyword spotting feature
: The service now offers a keyword spotting feature. You can specify an array of keyword strings that are to be matched in the input audio. You must also specify a user-defined confidence level that a word must meet to be considered a match for a keyword. For more information, see [Keyword spotting](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-spottingkeyword-spotting). The keyword spotting feature is beta functionality.

New word alternatives feature
: The service now offers a word alternatives feature. The feature returns alternative hypotheses for words in the input audio that meet a user-defined confidence level. For more information, see [Word alternatives](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-spottingword-alternatives). The word alternatives feature is beta functionality.

New UK English and Arabic models
: The service supports more languages with its transcription models: en-UK_BroadbandModel and en-UK_NarrowbandModel for UK English, and ar-AR_BroadbandModel for Modern Standard Arabic. For more information, see [Previous-generation languages and models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-models).
"context" : params.payload.context,
"input" : {
"text" : res.translations[0].translation,
"options" : {
"export" : true
}
},
},
},
};
return response
})
}
return {
body : params
}
};
Show more

When you test the webhook in the preview panel, you can submit Buenos días, and the assistant responds as if you said Good morning in English. In fact, when you check the Analytics>User conversations page, the log shows that the user input was Good morning.

You can add a postmessage webhook to translate the message's response back into the customer's native language before it is displayed. For more information see [Example 2](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-webhook-postwebhook-post-example-translate-back).





 Removing the webhook 

If you decide you do not want to preprocess customer input, complete the following steps:



1. From the assistant overview page, click the ![Overflow menu](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/kebab.png) icon, and then choose Settings.
2. Click Webhooks > Pre-message webhook.
3. Do one of the following things:



* To change the webhook that you want to call, click Delete webhook to delete the currently specified URL and secret. You can then add a new URL and other details.
* To stop calling a webhook to process every incoming message, click the Pre-message webhook switch to disable the webhook altogether.
[Editing the welcome node response](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/gs-edit-welcome-node.png)
4. Click ![Close](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/close.png) to close the edit view.



You created a dialog node that is triggered by the welcome condition. (welcome is a special condition that functions like an intent, but does not begin with a .) It is triggered when a new conversation starts. Your node specifies that when a new conversation starts, the system should respond with the welcome message that you add to the response section of this first node.





 Testing the start node 

You can test your dialog at any time to verify the dialog. Let's test it now.



* Click the ![Try it](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/try-it.png) icon to open the "Try it out" pane. You should see your welcome message.







 Adding nodes to handle intents 

Now let's add nodes between the Welcome node and the Anything else node that handle our intents.



1. Click Add node.
2. In the node name field, type Greet customers.
3. In the If assistant recognizes field of this node, start to type General_Greetings. Then, select the General_Greetings option.
4. Add the response text, Good day to you!

![Editing the general greeting node.]
If the socket closes with an error, the client receives an informative message of the form {"error":"{message}"} before the socket closes. Use the onerror event handler to respond appropriately. For more information about WebSocket return codes, see [IETF RFC 6455](https://tools.ietf.org/html/rfc6455).

The WebSocket implementations of the SDKs can return different or additional response codes. For more information, see the [API & SDK reference](https://cloud.ibm.com/apidocs/speech-to-text).
[Close](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/close.png) to close the edit view.



Now, when you test, you can provide a set of number or a mix of numbers and text as input, and the dialog reminds you of the correct order number format. You have successfully tested your dialog, found a weakness in it, and corrected it.

Another way you can address this type of scenario is to add a node with slots. See the [Adding a node with slots to a dialog](https://cloud.ibm.com/docs/assistant?topic=assistant-tutorial-slots) tutorial to learn more about using slots.







 Step 5: Add the personal touch 

If the user shows interest in the bot itself, you want the virtual assistant to recognize that curiosity and engage with the user in a more personal way. You might remember the General_About_You intent, which is provided with the General content catalog, that we considered using earlier, before you added your own custom about_restaurant intent. It is built to recognize just such questions from the user. Add a node that conditions on this intent. In your response, you can ask for the user's name and save it to a $username variable that you can use elsewhere in the dialog, if available.



 Add a node that handles questions about the bot 

Add a dialog node that can recognize the user's interest in the bot, and respond.



1. Click the Dialog tab.
2. Find the Welcome node in the dialog tree.
3. Click the More![More options](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/kebab.png) icon on the Welcome node, and then select Add node below.
4.
Customizing the search bar 

Control how customers interact with the search bar.

Decide whether the search bar can interact with customer query submissions in the following ways:



*  Propose alternative search terms when a misspelling is detected
*  Propose better query wording with type-ahead



These search bar customizations are available for all project types except Conversational Search. Similar features, such as autocorrection, can be configured for the chat widget where you deploy the project.

To customize search bar behavior, complete the following steps:



1.  From the navigation pane, open the Improve and customize page.
2.  Expand Customize display from the Improvement tools pane, and then click Search bar.
3.  Turn the following features on or off by setting the associated switcher:

Autocompletion
:   As the customer types a word as part of a query into the search bar, completed words are displayed as suggestions. The user can click a suggestion to add it to the query. The suggested words are based on terms from the project documents. Suggestions are not based on terms from the user's search history and the project does not learn from the user's choices. This setting is enabled by default.

Spelling suggestions
:   Recognizes words that are misspelled in the customer query. After the query is submitted, a Did you mean: link is displayed that shows a corrected version of the original query. The customer can click the corrected query to submit it. This setting is disabled by default.
"context" : params.payload.context,
"input" : {
"text" : res.translations[0].translation,
"options" : {
"export" : true
}
},
},
},
};
return response
})
}
return {
body : params
}
};
Show more

When you test the webhook in the preview panel, you can submit Buenos días, and the assistant responds as if you said Good morning in English. In fact, when you check the Analytics>User conversations page, the log shows that the user input was Good morning.

You can add a postmessage webhook to translate the message's response back into the customer's native language before it is displayed. For more information see [Example 2](https://cloud.ibm.com/docs/assistant?topic=assistant-webhook-postwebhook-post-example-translate-back).





 Removing the webhook 

If you decide you do not want to preprocess customer input, complete the following steps:



1. From the assistant overview page, click the ![Overflow menu](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/kebab.png) icon, and then choose Settings.
2. Click Webhooks > Pre-message webhook.
3. Do one of the following things:



* To change the webhook that you want to call, click Delete webhook to delete the currently specified URL and secret. You can then add a new URL and other details.
* To stop calling a webhook to process every incoming message, click the Pre-message webhook switch to disable the webhook altogether.