vania-janet/multiturn-rag-retrieval-data huggingface dataset:
Listing information about models 

The IBM Watson® Speech to Text service provides methods for listing information about all of its available models or about a specific previous- or next-generation model.



 Model information 

Regardless of whether you list information about all available models or about a specific model, the service returns the same output for a model:



* name is the name of the model that you use in a request.
* language is the language identifier of the model (for example, en-US).
* rate identifies the minimum acceptable sampling rate in Hertz for audio that is used with the model.
* url is the URI for the model.
* description provides a brief description of the model.
* supported_features describes the additional service features that are supported with the model:



* custom_language_model is a boolean that indicates whether you can create custom language models that are based on the model.
IBM Cloud

custom_acoustic_model is a boolean that indicates whether you can create custom acoustic models that are based on the model.
* low_latency is a boolean that indicates whether you can use the low_latency parameter with a next-generation model. The service includes this field only for next-generation models. Previous-generation models do not support the low_latency parameter.
* speaker_labels indicates whether you can use the speaker_labels parameter with the model.



The speaker_labels field returns true for all models. However, speaker labels are supported as beta functionality for only a limited number of languages. For more information, see [Speaker labels](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-speaker-labels).







 Listing all models 

You use the HTTP GET /v1/models method to list information about all available models. The service returns an array of JSON objects that provides information about all of the models.

The order in which the service returns models can change from call to call. So, do not rely on an alphabetized or static list of models. Because the models are returned as an array of JSON objects, the order has no bearing on programmatic uses of the response.



 List all models example
Whenever an incoming message suggests that a customer wants to report a stolen credit card, you don't want your assistant's response to be lost in a disambiguation list of options. You want the assistant to respond with a single answer that assures the customer that it can address this urgent matter.To design your dialog to prioritize a single node over disambiguation, complete the following steps:<-- <ol> -->1. In the node that conditions on the intent, enable multiple conditioned responses (Customize > Multiple conditioned responses).2. Add a conditioned response with the following condition:
intent.confidence > n

where n is a confidence score that makes sense for your training data. For example:

intent.confidence > 0.7
3. Move the response up to be first in the list of conditioned responses.4. Click the gear icon to customize the conditioned response.5. From the Assistant responds section, open the context editor.6. Add the following context variable:
<-- <table> -->

Context variable details

 Variable Value 

 `system` `{"prevent_disambiguation":true}` 

<-- </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.
* [Modifying speech synthesis characteristics](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-synthesis-params)
* [Modifying speech synthesis with expressive neural voices](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-synthesis-expressive)
* [Generating word timings](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-timing)



* Customizing the service



* [Understanding customization](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customIntro)
* [Rules for creating custom entries](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-rules)
* [Creating and managing custom models](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customModels)
* [Creating and managing custom entries](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customWords)
* [Using a custom model for speech synthesis](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-custom-using)



* Using Tune by Example



* [Understanding Tune by Example](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-tbe-intro)
* [Rules for creating custom prompts and speaker models](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-tbe-rules)
* [Creating a custom prompt](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-tbe-create)
* [Dialog Skill Analysis for Watson Assistant](https://github.com/watson-developer-cloud/assistant-dialog-skill-analysis)
* [Watson Assistant Recommendation notebooks (Measure and Analyze Effectiveness)](https://github.com/watson-developer-cloud/assistant-improve-recommendations-notebook)
* [Watson Assistant Dialog Flow Analysis notebook](https://github.com/watson-developer-cloud/assistant-dialog-flow-analysis)



Again, the [Watson Assistant Continuous Improvement Best Practices Guide](https://github.com/watson-developer-cloud/assistant-improve-recommendations-notebook/raw/master/notebook/IBM%20Watson%20Assistant%20Continuous%20Improvement%20Best%20Practices.pdf) outlines which notebook to use at each stage of your improvement process.







 Using the logs API 

You can use the /logs API to list events from the transcripts of conversations that occurred between your users and your assistant. For conversations created by using the v2 /message API, use the instance-level endpoint to [list log events in all workspaces](https://cloud.ibm.com/apidocs/assistant/assistant-v1listalllogs), and then filter by Assistant ID. For more information about filtering logs, see [Filter query reference](https://cloud.ibm.com/docs/assistant?topic=assistant-filter-reference).

The API logs messages that are exchanged in conversations that are defined by a dialog skill only.

The number of days that logs are stored differs by service plan type. See [Log limits](https://cloud.ibm.com/docs/assistant?topic=assistant-logslogs-limits) for details.

For a Python script you can run to export logs and convert them to CSV format, download the export_logs_py.py file from the [Watson Assistant GitHub)](https://github.com/watson-developer-cloud/community/blob/master/watson-assistant/export_logs_py.py) repository.





 Understanding logs-related terminology
A similar workflow is used to identify intent conflicts in a dialog skill.
* Skill-search: Manages API calls to a Discovery service instance that is enabled in the same cluster. When a v2 /message API call reaches the Store microservice, the Store retrieves session state information from Redis and start processing skills. When the assistant that is being processed has a search skill, the Store microservice calls this microservice over HTTPS REST. This microservice queries the Discovery instance and and converts the output that is returned by Discovery to the v2 /message API schema.
* Spellchecker: Corrects spelling mistakes that are made in user input that is submitted with /message requests. This autocorrection feature is enabled automatically for English dialog skills, and can be turned on for French skills. This microservice provides basic spell-checking capabilities by using correction techniques such as edit-distance from vocabulary word and generic language models. If enabled, the TAS microservice calls the Spellchecker using gRPC before it performs recognition of intents and entities in the user input. Spellchecker does not depend on datastores and it does not call any other microservice.
* Store: Handles all assistant API calls. This microservice either processes the request itself or calls the other Watson Assistant microservices that are needed to process the request. For example, if a customer submits user input with a v1 /message API call, the request is sent to and processed by the store. For stateful v2 /message API calls, the store retrieves session state information from Redis first. It then calls the NLU microservice to analyze the user input and identify any intent and entity references in the input. Next, the Store calls the Dialog microservice to generate the appropriate response to return to the customer. The Store microservice stores the assistants, skills, and workspace definitions in a PostgreSQL database. The Store microservice saves the state of the session (from the v2 API) in the Redis data store.
* TAS: Performs model inferencing, which means it identifies the best-matching intents and entities in the user input.
The intent and entities filters are populated by the intents and entities in the skill, and not what is in the data source. If you have [selected a data source](https://cloud.ibm.com/docs/assistant?topic=assistant-logslogs-deploy-id) other than the skill, you might not see an intent or entity from your data source logs as an option in the filters, unless those intents and entities are also in the skill.
* Refresh data: Select Refresh data to refresh the data that is used in the page metrics.

The statistics show traffic from customers who interact with your assistant; they do not include interactions from the Try it out pane.







 Top intents and top entities 

You can also view the intents and entities that were recognized most often during the specified time period.



* Top intents - Intents are shown in a simple list. In addition to seeing the number of times an intent was recognized, you can select an intent to open the User conversations page with the date range filtered to match the data you are viewing, and the intent filtered to match the selected intent.
* Top entities are also shown in a list. You can select an entity to open the User conversations page with the date range filtered to match the data you are viewing, and the entity filtered to match the selected entity.



See [Improve your skill](https://cloud.ibm.com/docs/assistant?topic=assistant-logs) for tips on how to edit intents and entities based on discoveries you make by reviewing the intents and entities that your assistant recognizes.
Next, you go to the Intents page and mine your existing intent user examples to find any mentions of the entity, and label them as such. For example, you might go to the buy_something intent, and find a user example that says, I want to buy a Coach bag. You can label Coach bag as a mention of the @product entity.

For training purposes, the term you annotated, Coach bag, is added as a value of the @product entity.

At run time, your assistant evaluates terms based on the context in which they are used in the sentence only. If the structure of a user request that mentions the term matches the structure of an intent user example in which a mention is labeled, then your assistant interprets the term to be a mention of that entity type. For example, the user input might include the utterance, I want to buy a Gucci bag. Due to the similarity of the structure of this sentence to the user example that you annotated (I want to buy a Coach bag), your assistant recognizes Gucci bag as a @product entity mention.

When a contextual entity model is used for an entity, your assistant does not look for exact text or pattern matches for the entity in the user input, but focuses instead on the context of the sentence in which the entity is mentioned.

If you choose to define entity values by using annotations, add at least 10 annotations per entity to give the contextual entity model enough data to be reliable.



To learn more about contextual entities, [read this blog post](https://medium.com/ibm-watson/contextual-entities-with-ibm-watson-assistant-f41b2e0ca82e).

To learn about how to use contextual entites to identify names and locations, see the [Detecting Names And Locations With Watson Assistant](https://medium.com/ibm-watson/detecting-names-and-locations-with-watson-assistant-e3e1fa2a8427) blog post on Medium.







 Creating entities 



1. Open your dialog skill and then click the Entities tab.
2. Click Create entity.
* If you have existing Speech to Text instances, select the instance you want to use from the list.
* If you do not have any existing Speech to Text instances, click Create new instance to create a new Plus instance.



7. In the Choose your Speech to Text language model field, select the language model you want to use.

The list of language models is automatically filtered to use the same language as your assistant. To see all language models, toggle the Filter models based on assistant language switch to Off.

If you created specialized custom models that you want your assistant to use, choose the Speech to Text service instance that hosts the custom models now, and you can configure your assistant to use them later. The Speech to Text service instance must be hosted in the same location as your Watson Assistant service instance. For more information, see [Using a custom language model](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-voice-actionsdialog-voice-actions-custom-language).

For more information about language models, see [Languages and models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-models) in the Speech to Text documentation.

Click Next.
8. On the Text to Speech page, select the instance of the Text to Speech service you want to use for the phone integration.



* If you have existing Text to Speech instances, select the instance you want to use from the list.
* If you do not have any existing Text to Speech instances, click Create new instance to create a new Standard instance.



9. In the Choose your Text to Speech voice field, select the voice you want to use.

The list of voices is automatically filtered to use the same language as your assistant. To see all voices, toggle the Filter voices based on assistant language switch to Off.

For more information about voice options, and to listen to audio samples, see [Languages and voices](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-voices) in the Text to Speech documentation.

Click Next.
You can use the expression language to extract property information for the following global variables:



 Global variable Definition 

 context JSON object part of the processed conversation message. 
 entities[ ] List of entities that supports default access to 1st element. 
 input JSON object part of the processed conversation message. 
 intents[ ] List of intents that supports default access to first element. 
 output JSON object part of the processed conversation message. 







 Accessing entities 

The entities array contains one or more entities that were recognized in user input.

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

<? entities ?>

For the user input, today, your assistant recognizes the @sys-date system entity, so the response contains this entity object:

[
{
"entity":"sys-date",
"location":0,5],
"value":"2020-12-30",
"confidence":1.0,
"metadata":
{
"calendar_type":"GREGORIAN",
"timezone":"America/New_York"
},
"interpretation":
{
"timezone":"America/New_York",
"relative_day":0,
"granularity":"day",
"calendar_type":"GREGORIAN"
}
}
]
Show more

If you want to include text in the response, use the toJson() method in the expression to cast the returned entities list into a JSON object. For example:

Recognized entities are: <? entities.toJson() ?>



 When placement of entities in the input matters 

When you use the shorthand expression, @city.contains('Boston'), in a condition, the dialog node returns true only ifBoston is the first entity detected in the user input. Only use this syntax if the placement of entities in the input matters to you and you want to check the first mention only.
Listing information about voices 

The IBM Watson® Text to Speech service provides methods for listing information about all of its available voices or about a specific voice.



 Listing all voices 

The GET /v1/voices method lists information about all available voices. It takes no arguments and returns a JSON array that is named voices. The array includes a separate object for each voice. The order in which the service returns voices can change from call to call. Do not rely on an alphabetized or static list of voices.

The following example lists all voices that are supported by the service:

IBM Cloud

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

IBM Cloud Pak for Data

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

This abbreviated response shows only the first few voices of the response:

{
"voices": [
{
"name": "en-US_LisaV3Voice",
"language": "en-US",
"gender": "female",
"url": "{url}/v1/voices/en-US_LisaV3Voice",
"customizable": true,
"supported_features": {
"voice_transformation": false,
"custom_pronunciation": true
},
"description": "Lisa: American English female voice.",
},
{
"name": "es-LA_SofiaV3Voice",
"language": "es-LA",
"customizable": true,
"gender": "female",
"url": "{url}/v1/voices/es-LA_SofiaV3Voice",
"supported_features": {
"voice_transformation": false,
"custom_pronunciation": true
},
"description": "Sofia: Latin American Spanish (español latinoamericano) female voice."
},
{
For more information about how to test for values in conditions, see [Conditions](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-overviewdialog-overview-conditions).
4. Optional: If you want to collect multiple pieces of information from the user in this node, then click Customize and enable Slots. See [Gathering information with slots](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-slots) for more details.
5. Enter a response.



* Add the text or multimedia elements that you want your assistant to display to the user as a response.
* If you want to define different responses based on certain conditions, then click Customize and enable Multiple responses.
* For information about conditional responses, rich responses, or how to add variety to responses, see [Responses](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-overviewdialog-overview-responses).



6. Specify what to do after the current node is processed. You can choose from the following options:



* Wait for user input: Your assistant pauses until new input is provided by the user.
* Skip user input: Your assistant jumps directly to the first child node. This option is only available if the current node has at least one child node.
* Jump to: Your assistant continues the dialog by processing the node you specify. You can choose whether your assistant should evaluate the target node's condition or skip directly to the target node's response. See [Configuring the Jump to action](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-overviewdialog-overview-jump-to-config) for more details.



7. Optional: If you want this node to be considered when users are shown a set of node choices at run time, and asked to pick the one that best matches their goal, then add a short description of the user goal handled by this node to the external node name field. For example, Open an account.
Personalizing the dialog with context 

To personalize the conversation, your assistant can collect information from the customer and then refer back to it later in the conversation.



 Anatomy of a dialog call 

Each user input is passed to the dialog as a /message API call. Replies that users make in response to prompts from the dialog that ask them for more information are included. A single /message API call is equivalent to a single dialog turn, which consists of an input from the customer and a corresponding response from the dialog.

The body of the /message API call request and response includes the following objects:



* context: Contains variables that are meant to be persisted. For the dialog to subsequently reference information that is submitted by the user, you must store the information in the context object. For example, the dialog can collect the user's name and then refer to the user by name in subsequent nodes. The following example shows how the context object is represented in the dialog JSON editor:

{
"context" : {
"user_name" : "<? @name.literal ?>"
}

See [Retaining information across dialog turns](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-runtime-contextdialog-runtime-context) for more information.
* input: The string of text that was submitted by the user. The text string can contain up to 2,048 characters. The following example shows how the input object is represented in the dialog JSON editor:

{
"input" : {
"text" : "Where's your nearest store?"
}
* output: The dialog response to return to the user. The following example shows how the output object is represented in the dialog JSON editor:

{
"output": {
"generic": [
{
"values":
{
"text": "This is my response text."
}
],
"response_type": "text",
"selection_policy": "sequential"
}
]
}
}
[Download icon](https://cloud.ibm.com/docs-content/v1/content/ca9232b3702768f24bb897f48f10778fcda28718/watson-assistant/images/download-icon.png).

Your example phrases are downloaded to a CSV file.









 Asking clarifying questions 

When your assistant finds that more than one action might fulfill a customer's request, it can automatically ask for clarification. Instead of guessing which action to take, your assistant shows a list of the possible actions to the customer, and asks the customer to pick the right one.

Zoom

![Shows a sample conversation between a user and the assistant, where the assistant asks for clarification from the user.](https://cloud.ibm.com/docs-content/v1/content/ca9232b3702768f24bb897f48f10778fcda28718/watson-assistant/images/disambig-demo.png)

Sample conversation

Any Created by you action that might match the customer's input can be included in the choices that are listed by a clarifying question. The Set by assistant actions are never included.

In the assistant output, the possible actions are listed by name. The default name for an action is the text of the first example message that you add to it (such as I want to open an account), but you can change this name to something more descriptive.

The order in which the actions are listed might change. In fact, the actions themselves that are included in the list might change. This behavior is intended. As part of development that is in progress to help the assistant learn automatically from user choices, the actions that are included and their order in the list is randomized on purpose. Randomizing the order helps to prevent bias that can be introduced by a percentage of people who always pick the first option without carefully reviewing all of their choices beforehand.



 Customizing clarifying questions 

To customize clarification, you can:



* Change settings like the wording your assistant uses to introduce the clarification list or when no action matches.