vania-janet/multiturn-rag-retrieval-data huggingface dataset:
"speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833",
"name": "speaker_one"
},
{
"speaker_id": "323e4476-63de-9825-7cd7-8120e45f8331",
"name": "speaker_two"
}
]
}







 Listing the custom prompts for a speaker model 

To list all of the custom prompts that are associated with a speaker model, use the GET /v1/speakers/{speaker_id} method. Pass the GUID of the desired speaker model for the indicated path parameter.

The method returns a customizations array that lists all of the custom prompts for the speaker model organized by customization_id. For each customization ID, the method returns the following information:



* prompt is the user-specified text of the prompt.
* prompt_id is the user-specified identifier of the prompt. The ID is used to identify the prompt in calls to the service.
* status is the current status of the prompt:



* processing indicates that the service received the request to add the prompt and is processing the prompt.
* available indicates that the service successfully validated the prompt, which is now ready for use in a speech synthesis request.
* failed indicates that the service's validation of the prompt failed. The status of the prompt includes an error field that describes the reason for the failure.





The customizations array is empty if the speaker model is not associated with any custom prompts.



 List the custom prompts for a speaker model example 

The following example returns all of the custom prompts with which the specified speaker_id is associated:

IBM Cloud

curl -X GET -u "apikey:{apikey}" "{url}/v1/speakers/{speaker_id}"

IBM Cloud Pak for Data

curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/speakers/{speaker_id}"

The speaker model is associated with four prompts divided between two custom models:

{
For more information, see [Upgrading](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-admin-managing-planadmin-managing-plan-upgrade).





 User-based plans explained 

Unlike API-based plans, which measure usage by the number of API calls made during a month, the Plus and Enterprise plans measure usage by the number of monthly active users.

A monthly active user (MAU) is any unique user who has at least one meaningful interaction with your assistant or custom application over the calendar billing month. A meaningful interaction is an exchange in which a user sends a request to your service and your service responds. Welcome messages that are displayed at the start of a conversation are not charged.

A unique user is recognized by the user ID that is associated with the person that interacts with your assistant. The web chat and other built-in integrations set this property for you automatically.





 Specifying the user ID with the REST API 

If you are using a custom client with the Watson Assistant API, you must set the user_id property in the message payload your client sends to the message method. The user_id property is specified at the root of the request body, as in this example:

{
"input": {
"message_type": "text",
"text": "I want to cancel my order"
},
"user_id": "my_user_id"
}

In some older SDK versions, the user_id property is not supported as a top-level method parameter. As an alternative, you can specify user_id within the nested context.global.system object.

For more information about the user_id property, see the API reference documentation:



* [v2 stateless /message](https://cloud.ibm.com/apidocs/assistant-v2/assistant-v2messagestateless)
* [v2 stateful /message](https://cloud.ibm.com/apidocs/assistant-v2/assistant-v2message)







 If the user ID is not specified
input: {
message_type: 'text',
text: 'Hello',
options: {
'return_context': true
}
},
context: {
'global': {
'system': {
'user_id': 'my_user_id'
}
},
'skills': {
'main skill': {
'user_defined': {
'account_number': '123456'
}
}
}
}
})
.then(res => {
console.log(JSON.stringify(res, null, 2));
})
.catch(err => {
console.log(err);
});

In this example request, the application specifies a value for user_id as part of the global context. In addition, it sets one user-defined context variable (account_number) as part of the skill-specific context. This context variable can be accessed by dialog nodes as $account_number.

You can specify any variable name that you want to use for a user-defined context variable. If the specified variable exists, it is overwritten with the new value; if not, a new variable is added to the context.

The output from this request includes not only the usual output, but also the context, showing that the specified values have been added. If you are using the stateless message method, this context data must be stored locally and sent back to the Watson Assistant service as part of the next message. If you are using the stateful message method, this context is stored automatically and persists for the life of the session.

{
"output": {
"generic": [!
{
"response_type": "text",
"text": "Welcome to the Watson Assistant example"
}
],
"intents": [
{
"intent": "hello",
"confidence": 1
}
],
"entities": []
},
If you include a custom language model ID, you must make the request with credentials for the instance of the service that owns the custom model. By default, no custom language model is used. For more information, see [Using a custom language model for speech recognition](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-languageUse).

acoustic_customization_id (optional string)
: Specifies the GUID of a custom acoustic model that is to be used for all requests that are sent over the connection. The base model of the custom acoustic model must match the value of the model parameter. If you include a custom acoustic model ID, you must make the request with credentials for the instance of the service that owns the custom model. By default, no custom acoustic model is used. For more information, see [Using a custom acoustic model for speech recognition](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-acousticUse).

base_model_version (optional string)
: Specifies the version of the base model that is to be used for all requests that are sent over the connection. The parameter is intended primarily for use with custom models that are upgraded for a new base model. The default value depends on whether the parameter is used with or without a custom model. For more information, see [Making speech recognition requests with upgraded custom models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-custom-upgrade-usecustom-upgrade-use-recognition).

x-watson-metadata (optional string)
: Associates a customer ID with all data that is passed over the connection. The parameter accepts the argument customer_id={id}, where id is a random or generic string that is to be associated with the data. You must URL-encode the argument to the parameter, for example, customer_id%3dmy_customer_ID. By default, no customer ID is associated with the data.
However, keep in mind that state data, including conversation context, is now maintained by the assistant, so your application might not need to access the context at all (see [Let the assistant maintain state](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-api-migrationapi-migration-state)).



Refer to the v2 [API Reference ](https://cloud.ibm.com/apidocs/assistant/assistant-v2message) for complete documentation of the v2 response format.





 Let the assistant maintain state 

For most applications, you can now remove any code included for maintaining state. It is no longer necessary to save the context and send it back to Watson Assistant with each turn of the conversation. The context is automatically maintained by Watson Assistant and can be accessed by your dialog as before.

Note that with the v2 API, the context is by default not included in responses to the client application. However, your code can still access context variables if necessary:



* You can still send a context object as part of the message input. Any context variables that you include are stored as part of the context maintained by Watson Assistant. (If the context variable you send already exists in the context, the new value overwrites the previously stored value.)

Make sure the context object that you send conforms to the v2 format. All user-defined context variables that are sent by your application should be part of the skill context; typically, the only global context variable you might need to set is system.user_id, which is used by Plus and Premium plans for billing purposes.
* You can still retrieve context variables from either the global or skill context. To have the context object included with message responses, use the return_context property in the message input options. For more information, see [Accessing context data in dialog](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-api-client-get-context).
For example, you might want to ask for the customer's name and then address the person by name later on.

The following script preserves the context of the conversation. In addition, it adds an $ismember context variable and sets it to true.

The name that is specified for the skill (main skill) is a hardcoded name that is used to refer to any skill that you create from the product user interface. You do not need to edit your skill name.

<script>
function preSendhandler(event) {
event.data.context.skills['main skill'].user_defined.ismember = true;
}
window.watsonAssistantChatOptions = {
integrationID: "YOUR_INTEGRATION_ID",
region: "YOUR_REGION",
serviceInstanceID: "YOUR_SERVICE_INSTANCE_ID",
cloudPrivateHostURL: "YOUR_HOST_URL",

onLoad: function(instance) {
// Subscribe to the "pre:send" event.
instance.on({ type: "pre:send", handler: preSendhandler });
instance.render();
}
};

setTimeout(function(){
const t=document.createElement('script');
t.src='https://web-chat.global.assistant.dev.watson.appdomain.cloud/versions/' +
(window.watsonAssistantChatOptions.clientVersion || 'latest') +
'/WatsonAssistantChatEntry.js';
document.head.appendChild(t);});

</script>
Show more

You can reference the $ismember context variable from your dialog. For example, the following screen capture shows a dialog node that conditions on #General_Greetings. It has multiple conditioned responses. The first response checks whether the current user is a member of your rewards program by checking for the presence of the $ismember context variable. If the variable is present, the response addresses the user as a member.
A suggestion_id property is added by your assistant when disambiguation is triggered.Add a root node with the following condition: intents.size()==0 && input.suggestion_id
This condition is met only by input that has triggered a set of disambiguation options of which the user has indicated none match her goal.Add a response that lets users know that you understand that none of the options that were suggested met their needs, and take appropriate action.Again, the placement of nodes in the tree matters. If a node that conditions on an entity type that is mentioned in the user input is higher in the tree than this node, its response will be displayed instead.<-- </section "id="section-dialog-runtime-handle-none" "> --><-- <section "id="section-dialog-runtime-disambig-test" "> --> Testing disambiguation When testing, the order in which the options are listed might change from test run to test run. In fact, the options themselves that are included in the disambiguation list might change from one test run to the next.This behavior is intended. As part of development that is in progress to help the assistant learn automatically from user choices, the choices included and their order in the disambiguation list is being randomized on purpose. Changing the order helps to avoid bias that can be introduced by a percentage of people who always pick the first option without carefully reviewing all of their choices beforehand.To test disambiguation, complete the following steps:<-- <ol> -->1. From the "Try it out" pane, enter a test utterance that you think is a good candidate for disambiguation, meaning two or more of your dialog nodes are configured to address utterances like it.2. If the response does not contain a list of dialog node options for you to choose from as expected, first check that you added summary information to the node name (or external node name) field for each of the nodes.3. If disambiguation is still not triggered, it might be that the confidence scores for the nodes are not as close in value as you thought.
<-- <ul> -->
curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --data "{"name":"Prompt test", "language":"en-US", "description":"Custom model to test prompts"}" "{url}/v1/customizations"

The method returns a globally unique identifier (GUID) as the customization ID for the new custom model. You use this GUID to identify the custom model in subsequent requests to the service.

{
"customization_id": "82f4809a-bf63-89a6-52ca-22731fe467ba"
}





 Create a speaker model 

To create a speaker model for the speaker of your prompt, use the POST /v1/speakers method. You pass a unique name for the speaker with the speaker_name query parameter and the enrollment audio as the body of the request. The audio must be in WAV format and must have a sampling rate of no less that 16 kHz. For information about the rules and guidelines for the speaker name and audio, see [Rules for creating speaker models](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-tbe-rulestbe-rules-speakers).

The enrollment audio is distinct from the audio for any prompts. Enrollment audio lets the service extract information about a speaker’s voice. It then applies that knowledge to prompts that are associated with that speaker. Creation of a speaker model is optional. 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
Personal Data is not supported for those methods.

IMPORTANT: Specifying a customer_id will delete all messages with that customer_id that were received before the delete request, across your entire Watson Assistant instance, not just within one skill.

As an example, to delete any message data associated with a user that has the customer ID abc from your Watson Assistant instance, send the following cURL command:

curl -X DELETE -u "apikey:3Df... ...Y7Pc9" "{url}/v2/user_data?customer_id=abc&version=2020-04-01"

where {url} is the appropriate URL for your instance. For more details, see [Service endpoint](https://cloud.ibm.com/apidocs/assistant-data-v2service-endpoint).

An empty JSON object {} is returned.

For more information, see the [API reference](https://cloud.ibm.com/apidocs/assistant-data-v2deleteuserdata).

Note: Delete requests are processed in batches and may take up to 24 hours to complete.
- The conversation context is now organized into two objects:

- The global context contains system-level context data shared by all skills used by the assistant.

- The skill context contains any user-defined context variables used by your dialog skill.

However, keep in mind that state data, including conversation context, is now maintained by the assistant, so your application might not need to access the context at all (see [Let the assistant maintain state](api-migration-state)).

Refer to the v2 [API Reference ](https://cloud.ibm.com/apidocs/assistant/assistant-v2message){: external} for complete documentation of the v2 response format.

 Let the assistant maintain state {: api-migration-state}

For most applications, you can now remove any code included for the purpose of maintaining state. It is no longer necessary to save the context and send it back to Watson Assistant with each turn of the conversation. The context is automatically maintained by Watson Assistant and can be accessed by your dialog as before.

Note that with the v2 API, the context is by default not included in responses to the client application. However, your code can still access context variables if necessary:

- You can still send a context object as part of the message input. Any context variables you include are stored as part of the context maintained by Watson Assistant. (If the context variable you send already exists in the context, the new value overwrites the previously stored value.)

Make sure the context object you send conforms to the v2 format. All user-defined context variables sent by your application should be part of the skill context; typically, the only global context variable you might need to set is system.user_id, which is used by Plus and Premium plans for billing purposes.

- You can still retrieve context variables from either the global or skill context. To have the context object included with message responses, use the return_context property in the message input options. For more information, see [Accessing context data](/docs/assistant?topic=assistant-api-client-get-context).
Show more
<-- </table ""> -->

7. Click Save.
Alternatively, you can add a root-level node with a condition such as the following:

stolen_card && intent.confidence > 0.7

Place this node higher in the tree than the node that conditions on stolen_card, which allows the node to be included in a disambiguation list.
8. Test your dialog. Make sure that the node's response is returned instead of a disambiguation list when the appropriate confidence score threshold is met.<-- </ol> --><-- </section "id="section-dialog-runtime-prevent-disambiguation" "> --><-- </section "id="section-dialog-runtime-disambig-disable" "> --><-- <section "id="section-dialog-runtime-handle-none" "> --> Handling none of the above When a user clicks the None of the above option, your assistant strips the intents that were recognized in the user input from the message and submits it again. This action typically triggers the anything else node in your dialog tree.To customize the response that is returned in this situation, you can add a root node with a condition that checks for a user input with no recognized intents (the intents are stripped, remember) and contains a suggestion_id property. A suggestion_id property is added by your assistant when disambiguation is triggered.Add a root node with the following condition: intents.size()==0 && input.suggestion_id
This condition is met only by input that has triggered a set of disambiguation options of which the user has indicated none match her goal.Add a response that lets users know that you understand that none of the options that were suggested met their needs, and take appropriate action.Again, the placement of nodes in the tree matters.
'Content-Type: application/json'
'X-Watson-Metadata: customer_id=abc'
--data
'{"input":{"text":"hello"}}'
'{url}/v2/assistants/{assistant_id}/sessions/{session_id}/message?version=2019-02-28'

where {url} is the appropriate URL for your instance. For more details, see [Service endpoint](https://cloud.ibm.com/apidocs/assistant/assistant-v2service-endpoint).

The customer_id string cannot include the semicolon (;) or equal sign (=) characters. You are responsible for ensuring that each customer ID property is unique across your customers.

Only the first customer ID value that is passed in the X-Watson-Metadata header is used as the customer_id string for the message log. This customer ID value can be deleted with DELETE /user_data v1 API calls.

If you add search to an assistant, user input that is submitted to the assistant is passed to the Discovery service as a search query. If the Watson Assistant integration provides a customer ID, then the resulting /message API request includes the customer ID in the header, and the ID is passed through to the Discovery /query API request. To delete any query data that is associated with a specific customer, you must send a separate delete request directly to the Discovery service instance that is linked your the assistant. See the Discovery [information security](https://cloud.ibm.com/docs/discovery/information-security?topic=discovery-information-security) topic for details.





 Querying user data 

Use the v1 /logs method filter parameter to search an application log for specific user data. For example, to search for data specific to a customer_id that matches my_best_customer, the query might be:

curl -X GET -u "apikey:3Df... ...Y7Pc9" "{url}/v2/assistants/{assistant_id}/logs?version=2020-04-01&filter=customer_id::my_best_customer"
If the same user returns to your site later in the month and chats with your assistant again, the web chat integration recognizes the user. And you are charged only once when the same anonymous user interacts with your assistant multiple times in a single month.



If an anonymous user logs in and later is identified as being the same person who submitted a request with a known ID, you are charged twice. Each message with a unique user ID is charged as an independent active user. To avoid this situation, you can prompt users to log in before you initiate a chat or you can use the anonymous user ID to represent the user consistently.





 Data centers 

IBM Cloud has a network of global data centers that provide performance benefits to its cloud services. See [IBM Cloud global data centers](https://www.ibm.com/cloud/data-centers/) for more details.

You can create Watson Assistant service instances that are hosted in the following data center locations:



Data center locations

 Location Location code API location 

 Dallas us-south N/A 
 Frankfurt eu-de fra 
 Seoul kr-seo seo 
 Sydney au-syd syd 
 Tokyo jp-tok tok 
 London eu-gb lon 
 Washington DC us-east wdc 









 Upgrading your plan 

You can explore the Watson Assistant [service plan options](https://www.ibm.com/cloud/watson-assistant/pricing/) to decide which plan is best for you.

The page header shows the plan you are using today. To upgrade your plan, complete these steps:



1. Do one of the following things:



* Trial plan only: The number of days that are left in your trial is displayed in the page header. To upgrade your plan, click Upgrade from the page header before your trial period ends.
* For all other plan types, click Manage![user icon](https://cloud.ibm.com/docs-content/v1/content/417db917d18067d9dcc4cf2612564a9a87c3ddc8/assistant/images/user-icon.png), and then choose Upgrade from the menu.



2.