IBM Cloud Docs
Search integration enhancement

Search integration enhancement

Use the following enhancements for the search integration to enhance the assistant responses to customer queries.

Search trigger

The search integration is triggered from an action step. By default, the action sends the most recently submitted user message as the search query. However, you can use the search settings within the action step to change the custom search query and custom results filter, which helps you to get accurate results.

For example, the conversational flow might collect information about the type of device a customer wants to buy. When you know the device model, you can then send a model keyword in the query that is submitted to the search integration to get better results.

To configure the search query, complete the following steps:

  1. In the And then field of the step where you want the search to be triggered, choose Search for the answer.

  2. Click Edit settings.

  3. Add values to one or both of the following fields:

    • Custom search query. Add a word or phrase that you want to submit to search integration as the query string for the search.

      For example, you can specify a string such as, What cities do you fly to?.

      For a more dynamic string, you can include a variable. For example, Do you have flights to ${destination}?

      You are effectively defining the value that is used by the search integration API as the natural_language_query parameter. For more information about defining query values for IBM Watson® Discovery, see Query parameters Discovery. For more information about defining query values for Elasticsearch, see Query parameters Elasticsearch.

      If you don't specify a text string, the action sends the most recently submitted user message as the search string.

      If you want to use the original customer message that triggered the action as the query string instead, you need to plan ahead. You can follow these steps:

      1. Create a session variable to store the initial user input. For example, named original message.
      2. In Step 1, meaning the first step after the action trigger, set the value of the session variable. For more information about session variables, see Creating a session variable.
      3. Set the value of the variable by using an expression that looks like this: <? input.text ?>.

      This expression captures the complete message that was submitted by the customer. As a result, your variable captures the customer message that triggered this action.

      1. Add the session variable to the Custom query field (for example, ${original_message}).
    • Custom results filter: Add a text string that defines information that must be present in any of the search results that are returned.

      You are effectively defining the value that is used by the search integration API as the filter parameter. For more information about defining filter values for IBM Watson® Discovery, see Discovery filter. For more information about defining filter values in Elasticsearch, see Elasticsearch filter

      The syntax to use for the filter value is not intuitive. Here are a few examples of common use cases:

      • To indicate that you want to return only documents with positive sentiment, for example, specify enriched_text.sentiment.document.label:positive.

      • To filter results to include only documents that mention Boston, MA, specify enriched_text.entities.text:"Boston, MA".

    If you add both a query and a filter value, the filter parameter is applied first to filter the data collection documents and cache the results. The query parameter then ranks the cached results.

    1. If you want the search for an answer to be the last step in the action, select End the action after returning results.
  4. Click Apply.

Use search when no action matches

You can use the search integration with the built-in No matches capability. By adding search to No matches, you can have your assistant refer to search when a customer asks a question that isn't addressed by an existing action.

To update No matches to use search:

  1. In your assistant, click Actions, then click Set by assistant.

  2. Click No matches to open it in the editor.

  3. Click New step.

  4. In the And then section, click Continue to next step, then choose Search for the answer.

    No matches
    Configure no matches to use search

  5. Close No matches. Your assistant uses search to provide customers with potentially useful answers, if the customer question does not trigger any of the existing actions.

Use Conversational search

Conversational search uses the large language models (LLMs) to recognize and respond to customer queries. You can enable this feature in the search integration to improve the assistant responses by using simple conversations.

For more information about Conversational Search, click Conversational search.