Power your assistant with answers from web resources
In this tutorial, you will use the Watson Discovery and watsonx Assistant services to create a virtual assistant that can answer questions about the latest research from the US Federal Reserve. The assistant will answer questions by using up-to-date, existing research publications from the Federal Reserve Economic Data (FRED) website.
IBM Cloud
Follow this tutorial only if you are using a managed deployment.
Learning objectives
By the time you finish the tutorial, you will understand how to:
- Create an action in watsonx Assistant that can recognize questions about a particular subject.
- Create a Conversational Search project in Discovery.
- Add a web crawl data source to your project.
- Connect your watsonx Assistant action to a search extension that gets answers from your Discovery project.
- Use your assistant to return answers that it retrieves from the website.
Duration
This tutorial will take approximately 2 to 3 hours to complete.
Prerequisite
-
Before you begin, you must set up a paid account with IBM Cloud.
You can complete this tutorial at no cost by using a Plus plan, which offers a 30-day trial at no cost. However, to create a Plus plan instance of the service, you must have a paid account (where you provide credit card details). For more information about creating a paid account, see Upgrading your account.
-
Create a Plus plan Discovery service instance.
Go to the Discovery resource page in the IBM Cloud catalog and create a Plus plan service instance.
If you decide to stop using the Plus plan and don't want to pay for it, delete the Plus plan service instance before the 30-day trial period ends.
Create an assistant
For this tutorial, you will create an assistant with a single action. First, you must create a watsonx Assistant service instance.
Both Lite and Trial plan watsonx Assistant service instances are available at no cost. You will create a Trial plan because a Plus or higher plan is required to add a search skill to an assistant and the Trial plan includes all Plus plan features. The Lite plan does not.
-
Create a Trial plan watsonx Assistant service instance in the same data location where the Discovery service instance is hosted, such as Dallas.
-
From the watsonx Assistant plan service page in IBM Cloud, click Launch watsonx Assistant.
The watsonx Assistant product user interface is displayed where you can create your first assistant.
-
Add
FRED research
as the assistant name, and then click Next. -
Fill out the fields to share information about you and your assistant, and then click Next.
In the Which statement describes your needs best field, choose I'm using Watson Assistant to complete a course or certification..
-
When you create an assistant, a web chat application is created for you automatically.
-
Click Next to accept the default style for the web chat.
A preview of the web chat as it would be displayed in a web page is shown.
-
Click Create to create the assistant and the corresponding web chat app.
After a congratulatory message, the home page for your new assistant is displayed.
Create an action
Create a single action that can recognize questions about the latest research papers from the US Federal Reserve Economic Data (FRED) website.
In a real world scenario, you might want your assistant to answer questions about the products in your catalog or about insurance plan options or anything else. You can complete similar steps to teach the assistant to recognize when a customer is asking about a particular subject.
-
From the navigation panel, click Actions.
The Actions page is displayed.
-
Click Create action, and then choose to start from scratch.
-
Because you want the assistant to recognize when customers ask about economic research, add the following sample user question, and then click Save:
What are the latest working papers about?
The editor closes. We want to add a few more examples.
-
Click the Customer starts with tile to continue adding examples.
-
Add the following questions:
Are there any working papers on the shipping industry?
Are there any papers that focus on inflation?
Are there papers about how trade policy affects pricing?
What's the latest research on municipal bond markets?
-
Click the first step in the Conversation steps section.
-
Add the following text to the Assistant says field:
I'll check the Federal Reserve Economic Data website.
-
Do not add a customer response. Instead, in the And then section, click Continue to next step, and then choose Search for the answer.
-
Click Edit settings.
-
Select End the action after returning results, and then click Apply.
-
Save your changes, and then click the X to close the step.
Congratulations! You successfully created an action that recognizes questions about FRED research papers and returns a search response.
In a later step, we will connect the search response in this action to a search extension that is configured for the assistant.
Create a Conversational Search project
Now that the assistant can recognize questions about a subject, let's give it access to data from which it can retrieve accurate answers.
In Discovery, create a Conversational Search project type. This project type is optimized for retrieving answers during dialog-driven interactions. For example, unlike other project types, it does not apply prebuilt enrichments that aren't needed.
-
Open a new web browser page.
Keep the watsonx Assistant page open in a separate tab so you can switch between the two applications.
-
From the Discovery Plus plan service page in IBM Cloud, click Launch Discovery.
-
From the My Projects page, click New Project.
-
Name your project
Federal Reserve research
, and then select the Conversational Search project type. -
Click Next.
You'll configure the data source for the project in the next step.
Connect to a website
We want the virtual assistant to be able to answer questions about the latest working papers from the US Federal Reserve, so we will connect our project to the Federal Reserve Economic Data website that hosts the working papers.
-
From the Select data source page, click Web crawl, and then click Next.
-
In the Collection name field, add
FRED papers
. -
In the Starting URLs field, add the following URL:
https://research.stlouisfed.org/wp
You will add only one starting URL. In a real scenario, you might add multiple URLs that go to other pages with information about the same topic. By adding more URLs, you can expand the breadth of the expertise of your assistant.
-
Click Add.
-
Click the Edit icon for the URL that you just added.
-
In the Maximum number of links to follow field, change the value to 5.
By changing the value to 5, you indicate that you want the service to process the page that you specified plus you want it to follow up to 5 links from the starting page.
-
Click Save, and then click Finish.
The Discovery service crawls the web page that you specified starting with the page that you specified as the starting URL.
While the website is being crawled and the data indexed, let's go back to our watsonx Assistant service instance. It's time to connect the action that we created to this Discovery project.
Add a search extension
Let's connect your assistant to your Discovery data.
-
From the navigation panel in watsonx Assistant, click Environments.
The draft environment is displayed. It shows that a web chat is connected to your assistant.
-
Click the Web chat tile to edit the web chat.
We don't want to add multiple starter questions, so we are going to turn off the home screen for the web chat. Click the Home screen tab.
-
Set the switcher to Off, and then click Save and exit.
-
We want to connect the web chat to a search extension. Click the Add button in the Search extension tile.
The Search Integration page is displayed.
-
Select the Discovery instance where your project is stored, and then select the Federal Reserve research project that you created earlier. Click Next.
-
The default result content configuration uses the best fields; you don't need to change them.
-
In the Define the text your search will display to the end user section, edit the content to show the following message:
The Federal Reserve Economic Data website has this information:
Verify that the Emphasize the answer switch is set to On. This setting adds the
find_answers:true
parameter to the query request. As a result, a succinct answer to the query is shown in bold in the response that is returned by the assistant. -
Click Create.
Preview the assistant
To preview an assistant that connects to data that is stored in Discovery, you must preview the assistant from the Environments page. When you test it separately, the assistant is not able to retrieve data from Discovery.
-
From the Environments page, click Preview this environment.
A sample web page is displayed that includes a chat icon.
-
Click the chat icon to open the web chat window.
-
Enter the following text question:
What impact is inflation having on the real estate market?
This test question is not one of the questions that we used to train the assistant.
The correct answer is returned and it includes a link to the source documentation page.
Congratulations! You successfully created an assistant that can answer questions about economic topics by retrieving information from working papers that are available from the US Federal Research Economic Data website.
Summary
In this tutorial, you created a Watson Discovery Conversational Search project with a web crawl connector that collects information about working papers from the US Federal Reserve Economic Data website. Separately, you created a watsonx Assistant virtual assistant with a single action that can recognize user questions about economic subjects. You added a Search extension to your assistant that connects the action's search response to the Discovery project where economic data is stored. Finally, you tested your virtual assistant by asking a question and getting a useful response that featured data from relevant economic research papers.
Next steps
The assistant that you created and connected to a search extension is available from the Draft environment. Next, you can publish your assistant to a production environment and deploy it. There are a variety of methods you can use to deploy the assistant. For more information, see Overview: Previewing and publishing.