How to Configure Questions and Answers

About Bot Conversations

Bot Conversations contain 3 main parts:

  • Entity to Filter mappings
  • Intent to Base Query mappings
  • Conversation responses settings (in order):
    • Featured Results
    • Questions and Answers
    • Conversation Topics

The Questions And Answers page is located under the SmartHub Administration page at http(s)://<smarthub-web-app-url>/_admin.

For more details about configuring Questions and Answers types, including using intent, see How to Automatically Generate Answers to User Questions.


Storage Settings

The conversation responses are saved in an Elastic index and HTML templates/adaptive cards templates used inside a conversation are saved physically on the disk.

To configure the Elastic settings, follow the next steps:

  1. Navigate to the Additional Settings page on the SmartHub Administration site. See the screenshot below.
  2. Click "Edit" from Storage Settings section.
  3. Complete the Elastic settings and indexes.

To configure where the templates should be saved modify the BotTemplatesPath variable from web.config file.

The default location for the bot templates is the BotTemplates folder.

Copy
<add key="BotTemplatesPath" value="~/BotTemplates" />

Entity-to-Filter Mappings

This section contains mappings between SmartHub filters/refiners and NLQ Service application entities.

  • An entity from the NLQ Service application must have a connection to a refiner from SmartHub.

The managed property used as a filter (refiner) must be searchable and queryable.

  • The "Click to show the query used to get the refiners" link opens a sub-section with the query run in the search center to get the managed properties.
    • The administrator can change it
  • The administrator must choose an "Entity" and a "Filter".
  • Click the "Add Mapping" button and after all changes are made, click "Save".

Intent-to-Base Query Mappings

This section contains the mappings between:

  • The intentsfrom NLQ service application,
    and
  • A query

Mappings Used in This Case

After the NLQ service detects:

  • The intent of the question
    and
  • The user follows the conversation steps,

then SmartHub returns the results:

  • Based on the user choices
    and
  • The query associated with the intent.

Example

Based on the code in the image below, the following query is run in the Search Center:

customer AND "DisplayAuthor":"Administrator".



Export Bot Conversations

This section describes how to export the indexed bot conversations to a .csv file.

To use:

  1. Click on "Conversation Topics" and select the type of conversation you want to export:
    1. Conversation Topics
    2. Question and Answers
      or
    3. Featured Results
  2. Click the sprocket icon.

  3. Click the Export button.



  4. File Name: The name of the .csv file.
    1. By default, the file name will be "SH Bot *type of conversation to be exported* *current date and time*" 
    2. For example, for Featured Results, the default file name will be SH Bot Featured Results *current date time*.csv
  5. Enter the desired file name (or leave default) and click "Export"
  6. A .csv file with the desired name is downloaded:

The newly downloaded .csv file contains all properties of the exported type:

Import Bot Conversations

This section describes how to import a .csv file containing Bot Conversations of a specific type and adds them to the Elastic index.

To use:

  1. Click on "Conversation Topics" and select the type of conversation you want to import:
    1. Conversation Topics
    2. Question and Answers
      or
    3. Featured Results
  2. Click the sprocket icon.
  3. Click the Import button:


  4. Click "Choose File" to select the .csv file containing the conversations that you want to import.
  5. "Import": The .csv contents are translated to the appropriate Conversation Type and added to the Elastic Index

All items in the .csv file you want to import must be of the same type.

For example, if you want to import Featured Results, all items in the .csv file must be of type "Featured Results".

The .csv file to be imported has the following format:

  • 1st row: Property names
  • 2nd row onward: Property values

Delete Bot Conversations

This section allows you to delete all items of a certain type from the Elastic Index.

To use:

  1. Click on "Conversation Topics" and select the type of conversation you want to delete:
    1. Conversation Topics
    2. Question and Answers
      or
    3. Featured Results
  2. Click the Cog button
  3. Click "Delete"

  • Cancel: You are returned to the "Bot Conversations" page and no items will be deleted
  • Delete: All items of the selected type will be deleted from the Elastic Index

Conversation Response Settings

When SmartHub receives a natural language query, it attempts to find a match, progressively, for:

  1. Featured Results
    1. If no match is found, SmartHub calls LUIS and based on the identified entity and intents, SmartHub then tries to find a match for:
  2. Question and Answer (QnA)
    1. If no QnA match is found:
  3. Conversation
    1. A match for a conversation (which consists of one or more conversation topics).
    2. If no conversation step match is found, the bot does not have a relevant suggestion.

How to Configure "Featured Results"

Use the following instructions to configure a Featured Results.

  1. Click on "Conversation Topics" under "Bot Conversations" .
  2. Select "Featured Results".


  3. Click the "+" icon next to the "Featured Results" text at the top left of the screen.
  4. Choose a relevant name for the Featured Result
  5. Added query terms.
    There two types of query terms:
    1. Regular strings. For example: priority, case, version
    2. Regex stringsPattern for regex matching. For example: ([A-Z])\w+
  6. Added results source ids. This field will contain a list with results source ids of the user's query
    • "ALL" is the default value. It means that all results source ids will be considered as valid.
  7. Choose the response method:
    • "answer"  - "HTML response": What the bot tells the user before the results are listed.
    • "search for" - "Query To Run template":
      • Generates the query made to SmartHub if a match is found for this item (hover over the icon to see which fields can be used inside the template).
      • Choose a results source ID used to run the query and display results.
      • The default value is "Current Source Id" which represents the result source id of the query made by user.
      • Choose the template from the last field:
        • Regular results
        • Cards
        • Carousel
      • For cards or carousel display mode choose.
        • n results - the top n results will be listed in SmartHub search page.
        • Adaptive Cards JSON - The JSON template used to render the bot results.

Answer Display Mode

Regular Results Display Mode

Cards/carousel display mode

How to Configure "Questions & Answers"

Use the following instructions to configure a Question and Answer.

  1. Click on "Conversation Topics" under "Bot Conversations" .
  2. Select "Questions & Answers".


  3. Click the "+" icon next to the "Questions & Answers" text at the top left of the screen.
  4. Choose a relevant name for the QnA.
  5. Choose the NLQ Service intents that matches this QnA.
  6. Choose the response method:
    • "answer"  - "HTML response": What the bot tells the user before the results will be listed.
    • "search for" - "Query To Run json object"
      1. Generates the query to be executed by SmartHub if a match is found for this item (click on this query to open the query builder panel) 
      2. On the left side, you can see the most common properties that can be altered in the query.
        The JSON query on the right side will be updated based on your input.


  7. Choose whether you want to pick up specific metadata from your results or the entire results set.
    1. metadata: Choose which metadata field to extract from results


  8. Choose the template from the last field:
    1. regular results
    2. cards
    3. carousel
  9. To use a "cards" or "carousel" display mode choose:
    1. Display text: The text to be displayed on top of the card or carousel
    2. Adaptive Cards JSON: The JSON template used to render the bot results

Regular Results Display Mode

Cards/carousel Display Mode

How to Configure "Conversation Topics"

Use the following instructions to configure a Conversation Topic.

  1. Click on "Conversation Topics" under "Bot Conversations".


  2. Click the "+" button.
  3. Choose a relevant name for the Conversation Topic.
  4. Choose the NLQ Service intents that match this Conversation Topic.
  5. Choose the filter mapped to the NLQ Service entity.
    1. This is the filter for which SmartHub suggests refinement after the associated NLQ Service entity is recognized.
    2. The entity is populated automatically based on the mappings.
  6. Choose how many filter values should be recommended by bot.
  7. Choose recommended filter values.
    1. These values are suggested by the bot.
  8. Bot reply template: Generates a short message displayed by the bot before showing the recommended values.

How to Use Bot Templates

Note: Bot Templates are available for "Questions and Answers" and  "Featured Results"

Creating a new template:

  • Populate the Template name field. If the field is empty the new template will use the same name as the conversation item.
  • Populate the template field.
  • Save the conversation item. The template will be created and it will be available to use for other templates.

Selecting an existing template with the "Chose a file " button:

  • A pop-up will open showing you all the available templates.

  • Selecting a template populates the Template Name and the template fields.
  • Modifying the template and then saving the conversation item updates the selected template. 

    Caution! The changes are visible in all the conversations that use that template.

  • Modifying the template name and saving will create a new template with the specified name.