IBM Cloud Docs
Power your assistant with answers from web resources

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

  1. 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.

  2. 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.

  1. Create a Trial plan watsonx Assistant service instance in the same data location where the Discovery service instance is hosted, such as Dallas.

  2. 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.

  3. Add FRED research as the assistant name, and then click Next.

    Shows the Watson Assistant welcome page
    Watson Assistant welcome page

  4. 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..

    Shows the Tell us where your assistant will live page
    Assistant details page

  5. When you create an assistant, a web chat application is created for you automatically.

    Shows the chat bot style settings
    Web chat settings

  6. Click Next to accept the default style for the web chat.

    Shows the chat bot preview in a fake web page
    Web chat preview

    A preview of the web chat as it would be displayed in a web page is shown.

  7. 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.

Shows the assistant page
Assistant home page

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.

  1. From the navigation panel, click Actions.

    Shows the Watson Assistant navigation panel
    Actions menu

    The Actions page is displayed.

    Shows the actions introduction page.
    Actions page

  2. Click Create action, and then choose to start from scratch.

    Shows the action creation method options.
    Action creation method options

  3. 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.

  4. Click the Customer starts with tile to continue adding examples.

    Shows the actions page with the customer prompt tile selected.
    User question examples

  5. 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?
    

    Shows the list of example prompt questions.
    User examples list

  6. Click the first step in the Conversation steps section.

    Shows the first step selected.
    First step

  7. Add the following text to the Assistant says field:

    I'll check the Federal Reserve Economic Data website.
    
  8. Do not add a customer response. Instead, in the And then section, click Continue to next step, and then choose Search for the answer.

    Shows the And then section of the action step.
    And then options

  9. Click Edit settings.

    Shows the Search step details.
    Search step

  10. Select End the action after returning results, and then click Apply.

    Shows the search step with End the action checkbox selected.
    Search step settings

  11. Save your changes, and then click the X to close the step.

    Shows the action close icon.
    Close action

Congratulations! You successfully created an action that recognizes questions about FRED research papers and returns a search response.

Shows the action that was created.
Created action

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.

  1. Open a new web browser page.

    Keep the watsonx Assistant page open in a separate tab so you can switch between the two applications.

  2. From the Discovery Plus plan service page in IBM Cloud, click Launch Discovery.

  3. From the My Projects page, click New Project.

  4. Name your project Federal Reserve research, and then select the Conversational Search project type.

  5. 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.

  1. From the Select data source page, click Web crawl, and then click Next.

    Shows the data source options
    Data source options

  2. In the Collection name field, add FRED papers.

    Shows the Web crawl name field
    Web crawl connector

  3. 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.

  4. Click Add.

  5. Click the Edit icon for the URL that you just added.

  6. In the Maximum number of links to follow field, change the value to 5.

    Shows the Starting URLs field
    Starting URL settings

    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.

  7. 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.

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.

  1. From the Environments page, click Preview this environment.

    Shows the draft environment with search extension enabled
    Search extension enabled

    A sample web page is displayed that includes a chat icon.

    Shows a preview of a web page with a chat icon
    Web chat icon

  2. Click the chat icon to open the web chat window.

    Shows web chat welcome message
    Web chat welcome message

  3. 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.

    Shows a preview of the assistant where the test question is answered
    Web chat returns search response

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.