vania-janet/multiturn-rag-retrieval-data huggingface dataset:
* For more information about adding words to a custom model that is based on next-generation model, see [Working with custom words for next-generation models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-corporaWords-ngworkingWords-ng).



After you add words to a custom model, examine the new custom words to check for typographical and other errors. This check is especially important when you add multiple words at one time.



* For custom models that are based on previous-generation models, see [Validating a words resource for previous-generation models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-corporaWordsvalidateModel).
* For custom models that are based on next-generation models, see [Validating a words resource for next-generation models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-corporaWords-ngvalidateModel-ng).





 Add words with the POST method 

The POST /v1/customizations/{customization_id}/words method adds one or more words at one time. You pass the words to be added as JSON data via the body of the request or from a file. In either case, the required Content-Type header specifies that JSON data is being passed to the method.

The following examples add two custom words, HHonors and IEEE, to the custom model with the specified ID:



* The first example passes the information about each word via the body of the request:

IBM Cloud
Use the POST /v1/customizations/{customization_id}/reset method to reset a custom model. Resetting a model removes all of the corpora and words from the model, initializing the model to its state at creation. The method does not delete the model itself or metadata such as its name and language. However, when you reset a model, its words resource is empty and must be re-created by adding corpora and words.



 Reset a custom language model example 

The following example resets the custom model with the specified customization ID:

IBM Cloud

curl -X POST -u "apikey:{apikey}" "{url}/v1/customizations/{customization_id}/reset"

IBM Cloud Pak for Data

curl -X POST --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}/reset"







 Deleting a custom language model 

Use the DELETE /v1/customizations/{customization_id} method to delete a custom language model that you no longer need. The method deletes all corpora and words that are associated with the custom model and the model itself. Use this method with caution: a custom model and its data cannot be reclaimed after you delete the model.



 Delete a custom language model example 

The following example deletes the custom model with the specified customization ID:

IBM Cloud

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

IBM Cloud Pak for Data

curl -X DELETE --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}"
To translate a document with a [custom model](https://cloud.ibm.com/docs/language-translator?topic=language-translator-customizing), use the model_id parameter. The following request translates the document with the custom model identified by the model ID 96221b69-8e46-42e4-a3c1-808e17c787ca. The custom model is defined for en-fr translation, so the source and target parameters are not needed.

curl -X POST --user "apikey:{apikey}" --form "file=@curriculum.html" --form "model_id=96221b69-8e46-42e4-a3c1-808e17c787ca" "{url}/v3/documents?version=2018-05-01"

A successful translation request returns a document ID in the response. In the following example, the ID is bae02796-0d28-435c-9115-888359fdde62. The status of processing indicates that the service is translating the document.

{
"document_id": "bae02796-0d28-435c-9115-888359fdde62",
"filename": "curriculum.html",
"model_id": "en-fr",
"source": "en",
"target": "fr",
"status": "processing",
"created": "2018-10-11T03:31:25"
}





 Step 2: Check the translation status 

After you have submitted a document for translation, you can check the translation status to find out when the translated document is available to download. The following example request checks the translation status of the document with ID bae02796-0d28-435c-9115-888359fdde62. When the status in the response is available, the translated document is ready to download.
For more information, see [Training a custom acoustic model with a custom language model](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-useBothuseBothTrain).
* The strict parameter indicates whether training is to proceed if the custom model contains a mix of valid and invalid audio resources. By default, training fails if the model contains one or more invalid resources. Set the parameter to false to allow training to proceed as long as the model contains at least one valid resource. The service excludes invalid resources from the training. For more information, see [Training failures for custom acoustic models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-acousticfailedTraining-acoustic).





 Monitoring the train model request 

The service returns a 200 response code if the training process is successfully initiated. The service cannot accept subsequent training requests, or requests to add more audio resources, until the existing training request completes.

To determine the status of a training request, use the GET /v1/acoustic_customizations/{customization_id} method to poll the model's status. The method accepts the customization ID of the acoustic model, as in the following example:

IBM Cloud

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

IBM Cloud Pak for Data

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

The response includes the status of the model, which is training:

{
"customization_id": "74f4807e-b5ff-4866-824e-6bba1a84fe96",
"created": "2016-06-01T18:42:25.324Z",
"updated": "2016-06-01T22:11:13.298Z",
"language": "en-US",
* -i, --instance is the instance name or ID. If this is not set, the context instance specified by dns instance-target INSTANCE is used instead.
* --output specifies output format. Currently, JSON is the only supported format.









 Viewing custom resolver forwarding rules using the API 

To view the details of a custom resolver forwarding rule using the API, follow these steps:



1. Set up your API environment with the correct variables.
2. Store the following values in variables to be used in the API command:



* instance_id, which is the unique identifier of a service instance.
* resolver_id, which is the unique identifier of a custom resolver.
* rule_id, which is the unique identifier of a forwarding rule.
* X-Correlation-ID, which is a string that uniquely identifies a request.



3. When all variables are initiated, view the details of your custom resolver forwarding rule:

{
"id": "5365b73c-ce6f-4d6f-ad9f-d9c131b26370",
"description": "forwarding rule",
"type": "zone",
"match": "example.com",
"forward_to": [
"161.26.0.7"
],
"created_on": "2021-04-21T08:18:25Z",
"modified_on": "2021-04-21T08:18:25Z"
}





 Viewing a list of all custom resolver forwarding rules using the API 

To view the details of a custom resolver forwarding rule using the API, follow these steps:



1. Set up your API environment with the correct variables.
2. Store the following values in variables to be used in the API command:



* instance_id, which is the unique identifier of a service instance.
* resolver_id, which is the unique identifier of a custom resolver.
curl -X PUT --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --data "{"translation":"<phoneme alphabet=\"ipa\" ph=\"aɪ.tɹˈɨpəl.ˈi\"></phoneme>"}" "{url}/v1/customizations/{customization_id}/words/IEEE"
* Phonetic IBM SPR: SPR uses the <phoneme> element with the alphabet attribute set to ibm and the ph attribute defined in SPR format:

IBM Cloud

curl -X PUT -u "apikey:{apikey}" --header "Content-Type: application/json" --data "{"translation":"<phoneme alphabet=\"ibm\" ph=\"1Y.tr1Ipxl.1i\"></phoneme>"}" "{url}/v1/customizations/{customization_id}/words/IEEE"

IBM Cloud Pak for Data

curl -X PUT --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --data "{"translation":"<phoneme alphabet=\"ibm\" ph=\"1Y.tr1Ipxl.1i\"></phoneme>"}" "{url}/v1/customizations/{customization_id}/words/IEEE"







 Adding multiple words to a custom model 

To add one or more words to a custom model at one time, use the POST /v1/customizations/{customization_id}/words method. You specify the entries to be added to the custom model as a JSON array of word/translation pairs. The required Content-Type header identifies the type of the input as application-json.

The following example adds common sounds-like translations for the words NCAA and iPhone to a custom model:

IBM Cloud
"application": "/opt/ibm/customization-scripts/customize_instance_app.py",
"arguments": ["{"library_set":{"action":"add","name":"my_library_set","libraries":{"conda":{"python":{"packages":"numpy"]}}}}}"]
}
}

Important: You must escape all double quote characters in the strings that are passed as application arguments.

If the application is accepted, you will receive a response like the following:

{
"id": "87e63712-a823-4aa1-9f6e-7291d4e5a113",
"state": "accepted"
}

When the state turns to FINISHED, the library set creation is complete.
4. Track the status of the application by invoking the application status REST API. See [Get the status of an application](https://cloud.ibm.com/docs/AnalyticsEngine?topic=AnalyticsEngine-spark-app-rest-apispark-app-status).
For more information, see [Train the custom acoustic model](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-acoustictrainModel-acoustic).





 Adding an audio file 

To add an individual audio file to a custom acoustic model, you specify the format (MIME type) of the audio with the Content-Type header. You can add audio with any format that is supported for use with recognition requests. Include the rate, channels, and endianness parameters with the specification of formats that require them. For more information, see [Supported audio formats](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-audio-formats).

The application/octet-stream specification for an audio format is not supported for audio resources.

The following example from [Add audio to the custom acoustic model](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-acousticaddAudio) adds an audio/wav file:

IBM Cloud

curl -X POST -u "apikey:{apikey}" --header "Content-Type: audio/wav" --data-binary @audio1.wav "{url}/v1/acoustic_customizations/{customization_id}/audio/audio1"

IBM Cloud Pak for Data

curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type: audio/wav" --data-binary @audio1.wav "{url}/v1/acoustic_customizations/{customization_id}/audio/audio1"





 Adding an archive file 

The preferred means of adding audio to a custom acoustic model is to add an archive file that includes multiple audio files. You can add the following types of archive files by specifying the type of the archive with the Content-Type request header:



* A .zip file by specifying application/zip
* A .tar.gz file by specifying application/gzip
If the model is not completely trained and available, the field has a value of 0.

When you monitor the training or upgrading of a custom model, poll the value of the status field, not the value of the progress field. If the operation fails for any reason, the value of the status field changes to reflect the failure; the value of the progress field remains 0.



 List all custom language models example 

The following example includes the language query parameter to list all US English custom language models that are owned by the specified credentials:

IBM Cloud

curl -X GET -u "apikey:{apikey}" "{url}/v1/customizations?language=en-US"

IBM Cloud Pak for Data

curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/customizations?language=en-US"

The credentials own two such models. The first model is awaiting data or is being processed by the service. The second model is fully trained and ready for use. Both custom models are based on previous-generation models; the first custom model has two available versions.

{
"customizations": [
{
"customization_id": "74f4807e-b5ff-4866-824e-6bba1a84fe96",
"created": "2016-06-01T14:21:26.894Z",
"updated": "2020-01-18T18:42:25.324Z",
"language": "en-US",
"dialect": "en-US",
"versions":
"en-US_BroadbandModel.v2018-07-31",
"en-US_BroadbandModel.v2020-01-16"
],
"owner": "297cfd08-330a-22ba-93ce-1a73f454dd98",
"name": "Example model",
"description": "Example custom language model",
"base_model_name": "en-US_BroadbandModel",
-i, --instance
: Instance name or ID. If not set, the context instance specified by dns instance-target INSTANCE is used.

--output
: Specify output format. Currently, json is the only supported format.





 Examples 

Create a forwarding rule in custom resolver f1aba936b94213e5b8dca0c0dbf1f9cc for instance dns-demo.

ibmcloud dns custom-resolver-forwarding-rule-create f1aba936b94213e5b8dca0c0dbf1f9cc --type zone --match "example.com" --dns-svcs 192.168.0.1,192.168.0.2 --description "demo" -i "dns-demo"







 ibmcloud dns custom-resolver-forwarding-rule-update 

Update a custom resolver forwarding rule for a service instance.

ibmcloud dns custom-resolver-forwarding-rule-update RESOLVER_ID RULE_ID [--match HOSTNAME] [--dns-svcs IPs] [--description DESCRIPTION] [-i, --instance INSTANCE] [--output FORMAT]



 Command options 

RESOLVER_ID
: The ID of custom resolver.

RULE_ID
: The ID of custom resolver forwarding rule.

-d, --description
: The descriptive text of the custom resolver forwarding rule.

--match
: The matching zone or hostname.

--dns-svcs
: The upstream DNS servers will be forwarded to, for example: ip1,ip2

-i, --instance
: Instance name or ID. If not set, the context instance specified by dns instance-target INSTANCE is used.

--output
: Specify output format. Currently, json is the only supported format.





 Examples
ibmcloud dns custom-resolver-location-add f1aba936b94213e5b8dca0c0dbf1f9cc --subnet crn:v1:bluemix:public:is:us-south-1:a/01652b251c3ae2787110a995d8db0135::subnet:0716-b49ef064-0f89-4fb1-8212-135b12568f04 --enabled true -i "dns-demo"







 ibmcloud dns custom-resolver-location-update 

Update custom resolver location for a service instance.

ibmcloud dns custom-resolver-location-update RESOLVER_ID LOCATION_ID [--subnet SUBNET_CRN] [--enabled true|false] [-i, --instance INSTANCE] [--output FORMAT]



 Command options 

RESOLVER_ID
: The ID of custom resolver.

LOCATION_ID
: The ID of custom resolver location.

--subnet
: The CRN of the subnet.

--enabled
: Whether to enable the custom resolver location.

-i, --instance
: Instance name or ID. If not set, the context instance specified by dns instance-target INSTANCE is used.

--output
: Specify output format. Currently, json is the only supported format.





 Examples 

Update location 9a234ede-c2b6-4c39-bc27-d39ec139ecdb in custom resolver f1aba936b94213e5b8dca0c0dbf1f9cc for instance dns-demo.
For an archive file, they include its compression type.



Additionally, listing all audio resources for a model returns the total_minutes_of_audio summed over all of the valid audio resources for the model. You can use this value to determine whether the custom model has enough or too much audio to begin training.

The methods also list the status of the audio data. The status is important for checking the service's analysis of audio files in response to a request to add them to a custom model:



* ok indicates that the service has successfully analyzed the audio data. The data can be used to train the custom model.
* being_processed indicates that the service is still analyzing the audio data. The service cannot accept requests to add new audio or to train the custom model until its analysis is complete.
* invalid indicates that the audio data is not valid for training the model (possibly because it has the wrong format or sampling rate, or because it is corrupted).





 List all audio resources example 

The following example lists all audio resources for the custom acoustic model with the specified customization ID:

IBM Cloud

curl -X GET -u "apikey:{apikey}" "{url}/v1/acoustic_customizations/{customization_id}/audio"

IBM Cloud Pak for Data

curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/acoustic_customizations/{customization_id}/audio"

The acoustic model has three audio resources. The service has successfully analyzed audio1 and audio2; it is still analyzing audio3.

{
"total_minutes_of_audio": 11.45,
"audio": [
{
"duration": 131,
"name": "audio1",
"details": {
"codec": "pcm_s16le",
"type": "audio",
"frequency": 22050
}
"status": "ok"
},
{
"duration": 556,
"name": "audio2",
"details": {
"type": "archive",
"name": "audio-file2.wav",
"details": {
"codec": "pcm_s16le",
"type": "audio",
"frequency": 16000
},
"status": "ok"
},
. . .
]
}
Show more







 Deleting an audio resource from a custom acoustic model 

Use the DELETE /v1/acoustic_customizations/{customization_id}/audio/{audio_name} method to remove an existing audio resource from a custom acoustic model. When you delete an archive-type audio resource, the service removes the entire archive of files. The service does not allow deletion of individual files from an archive resource.

Removing an audio resource does not affect the custom model until you train the model on its updated data by using the POST /v1/acoustic_customizations/{customization_id}/train method. If you successfully trained the model on the resource, until you retrain the model, the existing audio data continues to be used for speech recognition.



 Delete an audio resource example 

The following method deletes the audio resource that is named audio3 from the custom model with the specified customization ID:

IBM Cloud

curl -X DELETE -u "apikey:{apikey}" "{url}/v1/acoustic_customizations/{customization_id}/audio/audio3"

IBM Cloud Pak for Data

curl -X DELETE --header "Authorization: Bearer {token}" "{url}/v1/acoustic_customizations/{customization_id}/audio/audio3"
"outbound_stream": {
"maximum_jitter": 5,
"average_jitter": 1,
"packets_lost": 0,
"packets_transmitted": 2000,
"canonical_name": "voice.gateway@127.0.0.1",
"tool_name": "IBM Voice Gateway/1.0.0.5"
}
}

Show more



The objects for each stream contain the following keys:



Keys for RTP network summary details

 Key Type Description 

 maximum_jitter Number Maximum jitter during the call 
 average_jitter Number Average jitter, calculated over the call duration 
 packets_lost Number An estimate of the number of packets that were lost during the call 
 packets_transmitted Number An estimate of the total number of packets that were transmitted during the call 
 canonical_name string A unique identifier for the sender of the stream, typically in @ format 
 tool_name string The name of the application or tool where the stream originated. For Voice Gateway, the default is IBM Voice Gateway/. 







 Injecting custom values into call detail record events 

By including the cdr_custom_data context variable in your Watson Assistant dialog or actions, you can add custom data to your Call Detail Records. Each time this object is received it will merge with any previously received cdr_custom_data . You can record data related to various activities that are happening during a call. This includes ways to identify completion of specific tasks.

"context": {
"integrations": {
"voice_telephony": {
"cdr_custom_data": {
"key1": "value1",
"key2": "value2"
}
}
}
}

When generating a CDR report, the custom data is included in the injected_custom_data field. For example, in the following CDR report, the key1 and key2 are added to the injected_custom_data field.

{
"payload": {
...
"injected_custom_data": {
* The character limit for a custom tokenization dictionary is 1 million characters. * To disable tokenization, delete the tokenization dictionary and reingest your documents. * You cannot currently upload or delete a tokenization dictionary using the Discovery tooling; it must be done using the Discovery API. * Tokenization is performed on the query and multiple collection query methods. * Each tokenization dictionary is associated with a collection. When querying across multiple collections]] ! ! ! , each collection is tokenized individually. * Do not upload or delete a tokenization dictionary at the same time documents are being ingested into your collection.<-- </ul> --><-- </section "id="section-tokenization" "> --><-- <section "id="section-doc-similarity" "> --> Document similarity A document similarity query finds other documents similar to the currently viewed document, for example, a call center operator could be viewing the manuals for a product and use document similarity to find other documents with similar characteristics.
IBM Cloud Pak for Data

curl -X PUT --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --data "{"display_as": "HHonors"}" "{url}/v1/customizations/{customization_id}/words/hhonors"

As another example, you can indicate that the word IBM is to be displayed as IBM™.

IBM Cloud

curl -X PUT -u "apikey:{apikey}" --header "Content-Type: application/json" --data "{"display_as":"IBM™"}" "{url}/v1/customizations/{customization_id}/words/IBM"

IBM Cloud Pak for Data

curl -X PUT --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --data "{"display_as":"IBM™"}" "{url}/v1/customizations/{customization_id}/words/IBM"



 Interaction with smart formatting and numeric redaction 

If you use the smart_formatting or redaction parameters with a recognition request, be aware that the service applies smart formatting and redaction to a word before it considers the display_as field for the word. You might need to experiment with results to ensure that the features do not interfere with how your custom words are displayed. You might also need to add custom words to accommodate the effects.

For instance, suppose that you add the custom word one with a display_as field of one. Smart formatting changes the word one to the number 1, and the display-as value is not applied. To work around this issue, you could add a custom word for the number 1 and apply the same display_as field to that word.
: The ID of global load balancer monitor. Required.

-i, --instance
: Instance name or ID. If not set, the context instance specified by dns instance-target INSTANCE is used.

-f, --force
: Delete load balancer monitor without prompting for confirmation.





 Examples 

Delete GLB monitor f1aba936b94213e5b8dca0c0dbf1f9cc.

ibmcloud dns glb-monitor-delete f1aba936b94213e5b8dca0c0dbf1f9cc -f -i "dns-demo"







 ibmcloud dns glb-monitors 

List GLB monitors for a service instance.

ibmcloud dns glb-monitors [-i, --instance INSTANCE] [--output FORMAT]



 Command options 

-i, --instance
: Instance name or ID. If not set, the context instance specified by dns instance-target INSTANCE is used.

--output
: Specify output format. Currently, json is the only supported format.





 Examples 

List all GLB monitors for instance dns-demo.

ibmcloud dns glb-monitors -i "dns-demo"









 Custom resolver 

Manage custom resolvers by using the following custom resolver commands.



 ibmcloud dns custom-resolver-create 

Create a custom resolver for a service instance.

ibmcloud dns custom-resolver-create --name NAME [--location LOCATION1] [--location LOCATION2] [-description DESCRIPTION] [-f, --force] [-i, --instance INSTANCE] [--output FORMAT]



 Command options 

-n, --name
: The name of the custom resolver.

-d, --description
: The descriptive text of the custom resolver.

-f, --force
: Allow creating custom resolver with fewer than 2 locations.

--location
: The Locations on which the custom resolver will be running. The location subnet CRN is required.