How to Connect Watson Assistant with WatsonX and Watson Discovery

2 minute read

Today we are going to setup Watson Assistant with Watson Discovery and WatsonX. We are going to use the standard toolkit of IBM Developer.

im-778762

Generative artificial intelligence is artificial intelligence capable of generating text, images, or other media. Generative AI models learn the patterns and structure of their input training data and then generate new data that has similar characteristics

Step 1 - Create services in IBM Cloud.

First we need to login to IBM Cloud

https://cloud.ibm.com/

We need to create the following services

  1. WatsonX
  2. Watson Discovery
  3. Watson Assistant

After you have created those services, we have to setup them.

Step 2. Setup of WatsonX

After you have created your instance in WatsonX we open a simple prompt lab

we click over view code and click create personal API key and we create and we download the API key that we will use.

Then we return back to our Prompt Lab and in the view code we copy our project_id. So we should have the following two numbers, for exaple:

  1. API Key
  2. project_id

Step 3 - Setup of Watson Discovery

In the menu of IBM cloud we go to resource list, and in the section of AI / Machine Learning

we go click to Watson Discovery service and then we have two additional numbers to conserve here

  1. API Key
  2. URL

Notice that this API key is different to our previous case. This is for this service.

Now lunch this service and we create New project

In this example we are goint to analize Bitcoins, so the project will be named Bitcoin then we selectConversational Search we have different options to retreive the data, we choose Web crawl and click Next We choose a crawling each month

and we chose the url to crawl https://bitcoin.org/en/faq and finally click finish. After few minutes. You can get sometihng like then you go to your menu and click Integrate and Deployand you will get another project_id so we will have our third important number to keeep for the Watson Assistant.

  1. project_id

Step 4 - Setup Watson Assistant.

Let us return back to our IBM cloud and there in resource list, let lunch Watson Assistant and create a new assitant and you will get something like

then in the menu click integrations, we will install two integrations. Click on Build extensions

  1. Watson Discovery Extension First, we name it as Watson Discovery Extension then you have to download the openapi of this extension here https://github.com/ruslanmv/How-to-create-a-Chatbot-with-WatsonX-and-Watson-Discovery/blob/master/watson-discovery-query-openapi.json

and then click Finish

then we click add and then we paste our API Key and URL from Watson Discovery setup. and click finish

  1. WatsonX Extension We repeat the same, we go to Extensions and Build a new custom extension

    which we call WatsonX extension

    then we download the openapi of WatsonX from here https://github.com/ruslanmv/How-to-create-a-Chatbot-with-WatsonX-and-Watson-Discovery/raw/master/watson-discovery-query-openapi.json

    and we click Finish

    On the Extensions we click Add

    we paste our API Key that was created in the WatsonX setup we click Next and then Finish

In the Integrations menu you should have the active two integrations

with the word Open

Step 5 - Creation of Applications fo Watson Assitant.

In this part we are going to build some standard applications. Go to Actions then Click on the button Global Settings On the menu, go to the last tab called Upload/Download

and then download this file from here https://github.com/ruslanmv/How-to-create-a-Chatbot-with-WatsonX-and-Watson-Discovery/raw/master/discovery-watsonx-actions.json

and upload it

click upload and replace

go to Variables then in the tab Created by You You have to edit the following variables:

  1. discovery_project_id - From the Discovery Setup you can copy the Project ID

    2.watsonx_project_id - From you WatsonX Setup you copy your project_id

After you have updated all variables. You can test by click Try and you can ask like How are bitcoin transactions?

What is bitcoin?

and finally you can click in preview and give some questions.

Congratulations You have created a simple chatbot with Watson Assistant with WatsonX and Watson Discovery.

Posted:

Leave a comment