Data Q&A intervention

Updated at:

This topic describes how to configure the system to use contextual information to understand a user's intent and provide more accurate replies.

Q&A configuration

Environment parameters

This feature lets you pass contextual constraints to the bot through an API. For example, you may have business information, such as addresses and office hours, for two different regions, A and B. This information is stored in two separate data tables, table a and table b. By configuring an environment parameter, you can ensure that when a user from region A asks a question, the system queries table a to find the answer, not table b.

Note

You can pass this information using the VendorParam parameter in the streaming session API.

  1. After navigating to the global intervention page for the desired table, click the environment parameter tab to open the configuration page.

    image

  2. Click the toggle switch next to environment parameter to enable the feature.

  3. Click Add to configure an environment parameter. When you call the dialogue API, include the configured environment parameter in the request.

    • Location value: A business-specific string that acts as a session constraint for selecting the data table.

    • Environment parameter: A custom parameter name. You can configure multiple unique environment parameters for the same data table.

    • Operator: Includes = and in.

      • =: When a session starts, if the environment parameter from the API request matches the value configured here, the system selects this table.

      • Note

        If you configure multiple environment parameters, the system selects this table if any one of them matches the parameter passed in the API request.

      • in: When a session starts, if the configured value is present in the list of environment parameter values from the API request, the system selects this table.

      • Note

        If you configure multiple environment parameters, the system selects this table if any one of them is present in the list of values passed in the API request.

Example:

  • Scenario:

    • Table data: You have two tables that store the addresses and business hours for administrative offices in two different districts.

      Table 1: Xihu District office hours

      Administrative entity

      Business hours

      Address

      Civil Affairs Bureau

      AM: 9:00–12:00

      PM: 1:00–5:00

      122 Xihu District

      Environmental Bureau

      AM: 8:00–12:00

      PM: 1:00–5:00

      221 Xihu District

      Administrative Service Center

      AM: 7:00–12:00

      PM: 1:00–5:00

      113 Xihu District

      Table 2: Gongshu District office hours

      Administrative entity

      Business hours

      Address

      Civil Affairs Bureau

      AM: 8:00–12:00

      PM: 1:00–5:00

      122 Gongshu District

      Environmental Bureau

      AM: 7:00–12:00

      PM: 1:00–5:00

      322 Gongshu District

      Administrative Service Center

      AM: 6:00–12:00

      PM: 1:00–5:00

      133 Gongshu District

    • Goal: When users from Xihu District ask for office information, you want the system to use "Table 1: Xihu District office hours" for the answer. When users from Gongshu District ask, the system should use "Table 2: Gongshu District office hours".

  • Configuration:

    • Pass the user's district information in the VendorParam parameter of the streaming session API. For example: {"area": "Xihu District"}.

    • In the Q&A configuration > environment parameter settings for "Table 1: Xihu District office hours", configure the following:

      • Location value: area

      • Operator: =

      • Environment parameter: Xihu District

    • In the Q&A configuration > environment parameter settings for "Table 2: Gongshu District office hours", configure the following:

      • Location value: area

      • Operator: =

      • Environment parameter: Gongshu District

  • Result:

    • A user from Xihu District asks: "Where is the Civil Affairs Bureau?"

      • The bot replies: "122 Xihu District."

    • A user from Gongshu District asks: "Where is the Civil Affairs Bureau?"

      • The bot replies: "122 Gongshu District."

Associated replies

When the bot's answer is a value from a specific field in the data table, you can configure the bot to display up to three additional fields. The bot then combines these fields into a single, more informative reply.

  1. Go to Q&A configuration and select associated reply.

  2. Configure the following settings:

    • Reply field: The field the user is asking about. This is the primary field for the reply.

    • Associated reply field: An additional field to include in the bot's reply along with the Reply Field.

Example:

  • In a financial scenario, when a user asks about a product's "return," they often also want to know its "risk level." You can configure this as shown in the following figure:image

  • Q&A example:

    • User: "How was the return on Product A over the past year?"

    • Bot: "The return on Product A over the past year was XXXXXX, and its corresponding risk level is XXXXXX."

Header and value intervention

Overview and access

  • Overview: In table-based Q&A, header settings allow you to refine the bot's ability to recognize a specific header. The configuration affects only the selected header. This includes header synonym, value synonym, and environment parameter settings.

  • Access: In your bot's space, navigate to Knowledge Base > Table Management > data table management. Click Edit next to the desired table to open the table editor. Click the Q&A configuration button for the relevant header to start configuring its recognition behavior.

    image

Header synonyms

  • Purpose: Configure synonyms for a table header. When a user's query matches a header synonym, the system maps it to the corresponding header.

  • Configuration: On the header recognition settings page, select the header synonym tab. Enter synonyms in the Synonym input box and then click Save.

    image

Value synonyms (text-based headers only)

  • Purpose: Configure synonyms for a cell value. When a user's query matches a value synonym, the system maps it to the corresponding cell value.

  • Configuration: On the header recognition settings page, select the value synonym tab. First, select a value in the Value selection box, then add value synonyms in the Add synonym box. Click Add or press Enter to add the synonym.

    image

Environment parameters

  • Purpose: Lets you pass contextual constraints to the bot via an API. For example, in a product Q&A scenario, you can pass a product ID as an environment parameter when the session starts. When a user asks about the price, the system automatically uses the product ID as a filter to retrieve the correct price.

    Note
    • You can pass this information using the VendorParam parameter in the streaming session API.

    • environment parameter configuration is not suitable for the following field types, as they inherently represent a range or a set of values: text fields with a length exceeding 255 characters, array types, range types, calculated columns, and numeric fields configured for fuzzy query.

  • Configuration: image

    1. After navigating to the Header and value intervention page, select the environment parameter tab to open the configuration page.

    2. Click the toggle switch next to environment parameter to enable the feature.

    3. Add an environment parameter.

      • Unmatched variable policy: If you have configured an environment parameter for a header in the console and passed a value for that parameter to the dialogue engine through an API, the system follows the policy selected here. The default is Ignore.

        • Ignore: If a filtered query using the environment parameter finds no data but an unfiltered query does, the system ignores the environment parameter and returns the unfiltered result.

        • Reject: If a query based on the environment parameter filter returns no data, the system will reject the user's query and indicate that no information was found.

      • Add environment variable:

        • Field name: The name of the current header.

        • Operator: Includes = and in.

          • =: The system uses the value of the API parameter whose name you specify here. It then filters for data where the current header's value is identical to that API parameter's value.

          • in: The system uses the list of values from the API parameter whose name you specify here. It then filters for data where the current header's value is present in that list.

        • Environment parameter: The name of the parameter key passed in the API, such as teacher.

Example:

  • Table configuration: image

  • environment parameter configuration:

    1. Pass the environment parameter name and value through the API: teacher: Mait.

    2. console configuration:

      • Field name: Advisor

      • Operator: =

      • Environment parameter: teacher

  • User Q&A result:

    • unmatched variable policy set to Ignore

      • User: "What is Xiao Wang's grade?"

      • Bot: "Fail."

        Note

        Because the filter "Advisor = Mait" finds no grade for Xiao Wang, but a search without the filter does, the system ignores the environment parameter setting and answers "Fail".

    • unmatched variable policy set to Reject

      • User 1: "What is Xiao Wang's grade?"

      • Bot 1: "Sorry, I can't find grade information for a student named Xiao Wang."

        Note

        Because the filter "Advisor = Mait" finds no grade information for Xiao Wang, and the policy is set to Reject, the system rejects the query.

      • User 2: "What is Zhang San's grade?"

      • Bot 2: "Zhang San's grade is Fail, and the advisor is Mait."

        Note

        In this example, the environment parameter filters the Advisor header by the value "Mait", which filters out other data. The example table contains two students named "Zhang San", but the one with student ID "430485" is filtered out because their advisor is not "Mait". Therefore, the bot's reply does not include that student's information.