Type: NLP Worker
A Watson worker takes user input and sends it to Watson bot for natural language processing. A Watson worker can be created through the CLI, or through portal.
The following contains useful documentation on getting started with a Watson Assistant, which will be needed in the next sections https://cloud.ibm.com/docs/assistant/services-information.html
Assuming you have setup a Watson Assistant, you can find the required information for creating a watson worker within Watson by following these steps:
Navigate to the the Watson Assistants dashboard, which looks like this
Navigate to the settings of your Watson Assistant by clicking the Settings
option here
Click on the API details
tab, and take note of the following:
The page should look something like this:
Once you have this information, you can derive the details which will be required for creating a watson worker:
Secret: The secret is the Watson Assistant API key that will be used to communicate with Watson. This is the API Key mentioned above on the Watson Assistant API Details section. See Creating a Watson Secret for more information on creating the secret.
AssistantId: The identifier of the particular assistant you wish to use hosted in the assistant resource, this is available on the Watson Assistant API Details page.
ServiceUrl: The Watson service url to use for communicating with Watson. This can be obtained from the Assistant URL
you retrieved from the API Details section of your Watson Assistant. The Watson Assistant URL will be in the form https://api.eu-gb.assistant.watson.cloud.ibm.com/instances/some-id/v2/assistants/some-id/sessions
. Your ServiceUrl
for your worker configuration is just this section of the url https://api.eu-gb.assistant.watson.cloud.ibm.com
.
AssistantInstance: The identifier of the watson assistant resource, this can be taken from the Assistant URL
you retrieved from the API Details section of your Watson assistant. The image highlights the section of the url which contains the instance id.
NluConfidenceThresholdOverride [Optional] You can use this as an override of the returned detected intent confidence. If this value is higher than that returned from the nlu provider it will change the response to be a fallback, this value defaults to 0.
API Key
that you got from the API Details page of your Watson Assistant.secret
.Secrets Management
section.Create Secret
.Watson
as your Secret Type Template.Secret
text area.Save this json to a file and create a worker using the cli command sb-cli worker create file.json
{
"Data": {
"NluConfiguration": {
"AssistantId": "AssistantId",
"AssistantInstance": "AssistantInstance",
"Secret": "SRN:::HERE",
"ServiceUrl": "https://api.eu-gb.assistant.watson.cloud.ibm.com",
"NluConfidenceThresholdOverride": 0.8
},
"NluType": "Watson"
},
"Organization": "ORGANIZATION",
"Config": {
"Avatar": "default-bot"
},
"Enabled": true,
"Updated": 1608652074324,
"Description": "A Watson worker",
"Id": "4685b16c-a305-4b0c-b33d-8ae12b81ff9a",
"Type": "nlp-worker",
"Name": "WatsonWorker",
"Created": 1608652074324,
"Status": "published",
"Srn": "srn:botnet:REGION:ORGANIZATION:worker:4685b16c-a305-4b0c-b33d-8ae12b81ff9a"
}
Once you have created the worker using the CLI, it will return an ID for you. You need to then update/create a bot and place the worker at the top with the id and the type of nlp-worker
You can create a watson worker using portal by navigating to your bot, and clicking on the resources
tab.
Add Resource
Watson Worker
and then click Next
.