vania-janet/multiturn-rag-retrieval-data huggingface dataset:
If a user conversation log includes a call to a Connect to human agent response type, then the conversation is considered to be not contained.

However, not all human interventions are transacted by using a Connect to human agent response type. If you use an alternate method to deliver additional support, you must take additional steps to register the fact that the customer's need was not fulfilled by the assistant. For example, you might direct customers to your call center phone number or to an online support ticket form URL. If so, you need to flag these types of redirects so the containment metric is able to pick them up.

To enable the containment metric, complete the following steps:



1. For any dialog nodes that transfer the chat to a service desk agent, add a Connect to human agent response type.

For more information, see [Adding a Connect to human agent response type](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-overviewdialog-overview-add-connect-to-human-agent).
2. For any dialog nodes that redirect customers to alternate forms of customer support, add a context variable named context_connect_to_agent and set it to true.

The process that calculates the containment metric looks for instances of this context variable, and registers any occurrences that it finds as interventions.



* From the dialog node, go to the Assistant responds section and click the menu icon ![overflow menu icon](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/more-icon.png).

If you're using multiple conditioned responses, you must click the Customize response icon ![gear icon](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/customize-response-icon.png) to see the menu that is associated with the response.
* Click Open context editor.
"prompt_id": "greeting",
"status": "available",
"speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
}







 Deleting a custom prompt 

To delete a custom prompt from a custom model, use the DELETE /v1/customizations/{customization_id}/prompts/{prompt_id} method. Using a nonexistent or deleted custom prompt in a speech synthesis request causes the service to return a 400 response code. Make sure that you do not attempt to use a deleted prompt in production.



 Delete a custom prompt example 

The following example deletes the specified custom prompt from the custom model that has specified customization ID:

IBM Cloud

curl -X DELETE -u "apikey:{apikey}" "{url}/v1/customizations/{customization_id}/prompts/{prompt_id}"

IBM Cloud Pak for Data

curl -X DELETE --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}/prompts/{prompt_id}"
sessionId = res.session_id;
})
2. Use the v2 [Send user input to assistant](https://cloud.ibm.com/apidocs/assistant/assistant-v2message) method to send user input to the assistant. Instead of specifying the workspace ID as you did with the v1 API, you specify the assistant ID and the session ID:



* Java
* Python
* Node



MessageInput input = new MessageInput.Builder().text(inputText).build();
MessageOptions messageOptions = new MessageOptions.Builder(assistantId, sessionId)
.input(input)
.build();
MessageResponse response = service.message(messageOptions)
.execute()
.getResult();

response = service.message(
assistant_id,
session_id,
input = message_input
).get_result()

service
.message({
assistant_id: assistantId,
session_id: sessionId,
input: messageInput
})

The basic message structure has not changed; in particular, the user input is still sent as input.text.
3. After a conversation ends, use the v2 [Delete session](https://cloud.ibm.com/apidocs/assistant/assistant-v2deletesession) method to delete the session.



* Java
* Python
* Node



DeleteSessionOptions deleteSessionOptions = new DeleteSessionOptions.Builder(assistantId, sessionId
.build();
service.deleteSession(deleteSessionOptions).execute();

service.delete_session(
assistant_id = assistant_id,
session_id = session_id
)

service
.deleteSession({
assistant_id: assistantId,
session_id: sessionId,
})

If you do not explicitly delete the session, it will be automatically deleted after the configured timeout interval.
You can create prompts that are not associated with speakers. However, a speaker model can make a very positive difference in the quality of a prompt, so speaker models are highly recommended for all prompts.

The following example creates a speaker model named speaker_one. The request passes a 16 kHz WAV file as the enrollment audio in the body of the request. The Content-Type header of the request must be audio/wav.

IBM Cloud

curl -X POST -u "apikey:{apikey}" --header "Content-Type: audio/wav" --data-binary "@speaker-one-audio.wav" "{url}/v1/speakers?speaker_name=speaker_one"

IBM Cloud Pak for Data

curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type: audio/wav" --data-binary "@speaker-one-audio.wav" "{url}/v1/speakers?speaker_name=speaker_one"

The method returns a GUID as the speaker ID for the new speaker model. You use this GUID to identify the speaker model in subsequent requests to the service.

{
"speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
}

Speaker enrollment is a synchronous operation. Although it accepts more audio data than a custom prompt, the process of adding a speaker model is very fast. The service simply extracts information about the speaker’s voice from the audio. Unlike prompts, speaker models neither need nor accept a transcription of the audio, so the service does not need to align text and audio. When the call returns with a 201 response code to indicate success, the audio is fully processed and the speaker enrollment is complete.





 Add a custom prompt 

To add a prompt to a custom model, use the POST /v1/customizations/{customization_id}/prompts/{prompt_id} method. You pass a unique identifier for the prompt as a path parameter. You then use that ID to specify the prompt in speech synthesis and other requests to the service.
You might want to define the customization in the welcome node or another node that is triggered early in the conversation so it is applied any time disambiguation is triggered.

{
"output": {
"generic": [
]
},
"context": {
"smsAction": {
"command": "smsActSetDisambiguationConfig",
"parameters": {
"prefixText": "%s."
}
}
}
}

When displayed, the assistant shows the introductory text that is configured for disambiguation, such as Did you mean?. Then it lists the choices from the disambiguation list as numbered choices.

The prefixText parameter prepends a number to the text specified in a label. The list choices are numbered sequentially and are displayed to the user in the order in which they appear in the list. The user can type a number to pick one of the choices.

For example, if label is configured as follows:

"label": "I'd like to order a drink."

The assistant sends this message to the user:

1. I'd like to order a drink.

You can configure the text that will be prepended to each label. In the prefixText attribute, %s represents the number corresponding to the suggestion; it is replaced with the actual number at run time.

"context": {
"smsAction": {
"command": "smsActSetDisambiguationConfig",
"parameters": {
"prefixText": "Enter %s for:"
}
}
}

When prefixText is set to Enter %s for:, the following output is sent to the customer:

Enter 1 for: I'd like to order a drink.
If the number is invalid or no phone number is found on the user's profile, then a registration widget is displayed for the user to add a number. Then, the number is part of the user's profile and after validation, becomes the default number that is used for MFA.

When MFA is initially enabled, it is set to use email by default. You can change the setting to use SMS, but you cannot configure both at the same time.



 Before you begin 

App ID uses [Vonage](https://www.vonage.com/communications-apis/sms/) (formally Nexmo) to send MFA SMS one-time codes. Before you get started, be sure that you have an instance of App ID that is on the [graduated tier pricing plan](https://cloud.ibm.com/docs/appid?topic=appid-pricing) and the following Vonage information.



* Obtain your Vonage API key and secret. You can find the Vonage API key and secret in your account settings page on the Vonage dashboard. Check out the [Vonage documentation](https://developer.vonage.com/getting-started/concepts/authenticationapi-key-and-secret) for further information on how to obtain your credentials.
* Register your sender ID or the from number with Vonage. This from number is what appears on your user's phone to show who the SMS is from. In some countries, Vonage supports alpha-numeric sender IDs. App ID uses the value that you enter as Vonage's sender ID. So, if they are supported by Vonage, you can use the IDs with App ID. For more information, check out the [Vonage documentation](https://api.support.vonage.com/hc/en-us/articles/217571017-What-is-a-Sender-ID).







 With the GUI 

To configure MFA with the GUI, check out [Cloud Directory](https://cloud.ibm.com/docs/appid?topic=appid-cloud-directory).



1.
The following example shows a stateful /message request that includes both global and skill-specific context variables; it also uses the options.return_context property to request that the context is returned with the response. This option is applicable only if you are using the stateful message method because the stateless message method always returns the context.



* Java
* Python
* Node



MessageInputOptions inputOptions = new MessageInputOptions.Builder()
.returnContext(true)
.build();

MessageInput input = new MessageInput.Builder()
.messageType("text")
.text("Hello")
.options(inputOptions)
.build();

// create global context with user ID
MessageContextGlobalSystem system = new MessageContextGlobalSystem.Builder()
.userId("my_user_id")
.build();
MessageContextGlobal globalContext = new MessageContextGlobal.Builder()
.system(system)
.build();

// build user-defined context variables, put in skill-specific context for main skill
Map<String, Object> userDefinedContext = new HashMap<>();
userDefinedContext.put("account_number","123456");
MessageContextSkill mainSkillContext = new MessageContextSkill.Builder()
.userDefined(userDefinedContext)
.build();
Map<String, MessageContextSkill> skillsContext = new HashMap<>();
skillsContext.put("main skill", mainSkillContext);

MessageContext context = new MessageContext.Builder()
.global(globalContext)
.skills(skillsContext)
.build();

MessageOptions options = new MessageOptions.Builder()
.assistantId("{assistant_id}")
.sessionId("{session_id}")
.input(input)
The timestamp of the response is earlier than 2019-11-01T04:00:00.000Z. response_timestamp<2019-11-01T04:00:00.000Z 
 The message is labeled with the customer ID my_id. customer_id::my_id 
 The message was sent to a specific assistant. assistant_id::dcd5c5ad-f3a1-4345-89c5-708b0b5ff4f7 
 The user input text contains the word "order" or a grammatical variant (for example, orders or ordering. request.input.text:order 
 An intent name in the response exactly matches place_order. response.output.intents:intent::place_order 
 An entity name in the response exactly matches beverage. response.output.entities:entity::beverage 
 No intent name in the response exactly matches order. response.intents:intent::!order 
 The user input text does not contain the word "order" or a grammatical variant. request.input.text:!order 
 The user input text contains the string !hello. request.input.text:!hello 
 The user input text contains the string IBM Watson. request.input.text:"IBM Watson" 
 The user input text contains a string that has no more than 2 single-character differences from Watson. request.input.text:Watson2 
 The user input text contains a string consisting of comm, followed by zero or more additional characters, followed by s. request.input.text:comms 
 An intent name in the response exactly matches either hello or goodbye. response.output.intents:intent::(hello goodbye) 
 An intent name in the response exactly matches order, and an entity name in the response exactly matches beverage. [response.output.intents:intent::order,response.output.entities:entity::beverage] 







 Filtering v1 logs 

If your application is still using the v1 API, you can query and filter logs using the v1 /logs method. The filtering syntax is the same, but the structure of v1 logs and message requests is different.
version: '2021-11-27',
authenticator: new IamAuthenticator({
apikey: '{apikey}', // replace with API key
}),
url: '{url}', // replace with URL
});

const assistantId = '{environment_id}'; // replace with environment ID

// Start conversation with empty message
messageInput = {
messageType: 'text',
text: '',
};
context = {};
sendMessage(messageInput);

// Send message to assistant.
function sendMessage(messageInput, context) {
assistant
.messageStateless({
assistantId,
input: messageInput,
context: context,
})
.then(res => {
processResult(res.result);
})
.catch(err => {
console.log(err); // something went wrong
});
}

// Process the result.
function processResult(result) {

let context = result.context;

// Print responses from actions, if any. Supports only text responses.
if (result.output.generic) {
if (result.output.generic.length > 0) {
result.output.generic.forEach( response => {
if (response.response_type === 'text') {
console.log(response.text);
}
});
}
}

// Prompt for the next round of input unless skip_user_input is true.
let newMessageFromUser = '';
if (result.context.global.system.skip_user_input !== true) {
newMessageFromUser = prompt('>> ');
}

if (newMessageFromUser !== 'quit') {
newMessageInput = {
messageType: 'text',
The user adds additional resources (words, corpora, or audio) to the custom model but does not retrain the model.
3. The user cannot use the custom model for speech recognition. The service returns an error of the following form when used with a speech recognition request:

{
"code_description": "Bad Request",
"code": 400,
"error": "Requested custom language model is not available.
Please make sure the custom model is trained."
}



To work around this issue, the user must retrain the custom model on its latest data. The user can then use the custom model with speech recognition.
* Before training an existing custom language or custom acoustic model, you must upgrade it to the latest version of its base model. The problem shows up in the following scenario:



1. The user has an existing custom model (language or acoustic) that is based on a model that has been updated.
2. The user trains the existing custom model against the old version of the base model without first upgrading to the latest version of the base model.
3. The user cannot use the custom model for speech recognition.



To work around this issue, the user must use the POST /v1/customizations/{customization_id}/upgrade_model or POST /v1/acoustic_customizations/{customization_id}/upgrade_model method to upgrade the custom model to the latest version of its base model. The user can then use the custom model with speech recognition.







 7 September 2018 

Session-based interface no longer available
: The session-based HTTP REST interface is no longer supported. All information related to sessions is removed from the documentation. The following methods are no longer available:



* POST /v1/sessions
* POST /v1/sessions/{session_id}/recognize
* GET /v1/sessions/{session_id}/recognize
* GET /v1/sessions/{session_id}/observe_result
* DELETE /v1/sessions/{session_id}



If your application uses the sessions interface, you must migrate to one of the remaining HTTP REST interfaces or to the WebSocket interface.
If no tenantPhoneNumber value is provided, the tenant ID from the phone integration configuration for the active call is used. Optional. 
 userPhoneNumber string The phone number to send the SMS message to. The format of the number must match the format that is required by the SMS provider. If no userPhoneNumber value is provided, the voice caller's phone number from From header of the incoming SIP INVITE request is used. Optional. 



If your SMS integration supports more than one SMS phone number, or you are using a SIP trunk different from your SMS provider, be sure to specify the phone number that you want to use to send the text message. Otherwise, the text is sent using the same phone number that was called.

After the assistant receives an SMS message, a new conversation turn is initiated with the text input vgwSMSMessage. This input indicates that a message was received from the caller. The text of the customer's message is included as the value of the vgwSMSMessagecontext variable.

If the assistant is unable to send an SMS message to the caller, a new turn is initiated with the text input vgwSMSFailed. This input indicates that an SMS message could not be sent the caller. You can design your assistant to handle such a failure by creating actions that are triggered by the input text vgwSMSFailed.

{
"input": {
"message_type": "text",
"text": "vgwSMSMessage"
},
"context": {
"skills": {
"main skill": {
"user_defined": {
"vgwSMSMessage": "1545 Lexington Ave."
}
}
}
}





 Defining a sequence of phone commands 

If you want to run more than one command in succession, include multiple responses in the generic array. These commands are processed in the order in which they are specified in the array.

This example shows two responses: first a text response, followed by an end_session response to end the call.

{
"generic": [
{
"response_type": "text",
* POST /v1/sessions
* POST /v1/sessions/{session_id}/recognize
* GET /v1/sessions/{session_id}/recognize
* GET /v1/sessions/{session_id}/observe_result
* DELETE /v1/sessions/{session_id}



If your application uses the sessions interface, you must migrate to one of the remaining HTTP REST interfaces or to the WebSocket interface. For more information, see the service update for [8 August 2018](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-release-notesspeech-to-text-8august2018).





 8 August 2018 

Deprecation notice for session-based speech recognition interface
: The session-based HTTP REST interface is deprecated as of August 8, 2018. All methods of the sessions API will be removed from service as of September 7, 2018, after which you will no longer be able to use the session-based interface. This notice of immediate deprecation and 30-day removal applies to the following methods:



* POST /v1/sessions
* POST /v1/sessions/{session_id}/recognize
* GET /v1/sessions/{session_id}/recognize
* GET /v1/sessions/{session_id}/observe_result
* DELETE /v1/sessions/{session_id}



If your application uses the sessions interface, you must migrate to one of the following interfaces by September 7:



* For stream-based speech recognition (including live-use cases), use the [WebSocket interface](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-websockets), which provides access to interim results and the lowest latency.
* For file-based speech recognition, use one of the following interfaces:
US Health Insurance Portability and Accountability Act (HIPAA) support is available for Premium plans that are hosted in the Washington, DC, (us-east) and Dallas (us-south) locations. For more information, see [Enabling EU and HIPAA supported settings](https://cloud.ibm.com/docs/account?topic=account-eu-hipaa-supportedeu-hipaa-supported).

Do not include personal health information (PHI) in data that is to be added to custom models. Be sure to remove any PHI from data that you use for custom models.





 Labeling and deleting data in the Text to Speech service 

The IBM Watson® Text to Speech service enables you to delete all data that is associated with speech synthesis requests and with custom models. To delete data, you must do the following:



1. Use the X-Watson-Metadata header to associate a customer ID with data that is passed by a request to the service; see [Specifying a customer ID](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-information-securityspecify-customer-id).
2. Use the DELETE /v1/user_data method to delete all data that is associated with a specified customer ID; see [Deleting data](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-information-securitydelete-pi).



By default, no customer ID is associated with data.

Experimental and beta features are not intended for use with a production environment and therefore are not guaranteed to function as expected when labeling and deleting data. Experimental and beta features should not be used when implementing a solution that requires the labeling and deletion of data.



 Specifying a customer ID 

To associate a customer ID with data, include the X-Watson-Metadata header with the request that passes the information. You pass the string customer_id={id} as the argument of the header. The following example associates the customer ID my_customer_ID with the data passed with a POST /v1/synthesize request:

IBM Cloud
: Important: The names of the properties of the Speech services custom resource that specify whether user data is stored and logged have changed. The custom resource formerly contained the following properties:


 Anonymize logs

sttRuntime:
anonymizeLogs: "false" If true, disables storage and logging of user data
sttAMPatcher:
anonymizeLogs: "false" If true, disables storage and logging of user data
ttsRuntime:
anonymizeLogs: "false" If true, disables storage and logging of user data

These properties are now named as follows:


 Storage and logging of user data

sttRuntime:
skipAudioAndResultLogging: "false" If true, disables storage and logging of user data
sttAMPatcher:
skipAudioAndResultLogging: "false" If true, disables storage and logging of user data
ttsRuntime:
skipAudioAndResultLogging: "false" If true, disables storage and logging of user data

If you already set these properties in your custom resource to change the default value of false to true, you need to edit your custom resource. You must manually change the names of the properties to the new values and save the updated custom resource. For more information, see [Installing Watson Speech to Text](https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=text-installing-watson-speech).

Important: Changes to properties of PostgreSQL secrets object
: Important: When you install the Speech services, an object that contains a randomly generated password for the PostgreSQL datastore is created by default. You can choose instead to specify the password manually. If you do, the properties of the YAML file for the secrets object have changed. For more information, see the topic about managing your datastores in [Administering Watson Speech to Text](https://www.ibm.com/docs/en/cloud-paks/cp-data/4.0?topic=text-administering-watson-speech).