See also: Adaptive Cards

This article will discuss the following:

  1. Introduction and Overview of QnA Ability.
  2. How does it work (technical details).
  3. Creating and connecting your Knowledge base (KB).
  4. Using the QnA Ability (Adaptive Cards).
  5. Best Practices.

Introduction and Overview of the QnA Ability.

The QnA Ability is a simple question and answer ability. It lets your bot fetch an answer linked to a question which best matches a user's input. 

This article will teach you how to successfully add a QnA Ability to your LiveTiles Bot. 

How does it work? (Technical details)

Summary: This ability uses Microsoft's QnA Maker to provide question and answer functionality to your bot.  A Knowledge base (KB) can be built up with manually entered question and answer pairs. QnA Maker can also automatically populate your Knowledge base by crawling a document or website which has a question and answer layout. 

Settings: These are the authorization settings needed to link your KB to your bot. They can be found in the Settings tab within QnA Maker.

  • Endpoint Key - The authorization key required to access the Azure service your KB has been linked to. 
  • Knowledge base ID - The ID for the Knowledge base to link with your Bot.
  • Host - The authorization URL associated with your KB's Azure service.

Note: These fields have default values referencing a LiveTiles KB populated from the FAQ page on our website.

Connecting your KB

There are two options for connecting your KB to the QnA ability.

  1. Autoset KB - This automatically populates the above-mentioned fields (Endpoint Key, Knowledge Base ID and Host URL), by checking which KBs you have access to as part of your user account. Note this only covers KBs hosted in your tenant. To retrieve this list, hit the 'Authenticate' button, which will retrieve the list in a drop-down from where you can pick the appropriate KB.
  2. Manual Entry - Alternatively, you can manually enter the values for the above-mentioned fields. This is also to be used when you want to connect to a KB in a different tenant.

Once these changes have been made, you'll have to Save and then Train the bot in order to use this ability.

Creating and connecting your Knowledge base (KB). 

Create your KB: In order for your LiveTiles Bot to use the QnA ability, you must:

  • Open Microsoft's QnA Maker and create or import a KB.
  • You should now have created your KB and have access to the Knowledge Base Page within QnA Maker
  • If you have already populated your KB with a file or a URL, then you should see its content on the redirect page (Knowledge Base Page)
  • Refer to the following diagram to assist in your navigation. This is a screen shot of your Knowledge Base Page.

Blue: My Knowledge bases lists of all the published QnA KBs linked to your Azure service.

Red: Create a Knowledge base to create or import an existing KB. 

Yellow: The Publish tab is where you would go once everything has been finalized. This is where users would also go to obtain their Endpoint Key and Knowledge base ID. You will need both keys/ids in order to utilize the created KB into LiveTiles Bots. 

Pink: Click on Test to open a side chat menu and test your KB with a QnA Maker sample bot. (Adaptive Cards will not be correctly rendered. They are only interpreted when passed through your LiveTiles Bot.)  

Green: Click on Add QnA pair for a new question and answer. Each answer can be fetched by a number of different questions. Add more questions to that answer by clicking the "+" in the question column. 

Magenta: Delete QnA pair. This will delete an answer and all of its linked questions.

  • Save and Train. Click this button to simultaneously save your progress and train the QnA algorithm. If you do not know where that is, refer to the image diagram above. After you Save and Train, you may now Publish your KB.
  • Publish your KB. Click Publish next to the Edit tab. Refer to the diagram above (coded Yellow). You will be told which Azure service your QnA Maker KB will be published to.  Click Publish again. This should publish your KB and create your authorization endpoints. 

Connect your KB: You should now have published your KB and obtained your Endpoint Key, Knowledge base ID and Host/Knowledge base URL. The Blue is your KB ID and the Red is your Endpoint Key. The Host URL is sandwiched between them. 

Copy and paste the keys into their respective sections on LiveTiles Bots:

  • Click Save at the top right, and then click Train (appears at the top of the side menu chat bar once you click Save). 

Using the QnA ability (Adaptive Cards)

Adaptive Cards (Recommended): Adaptive Cards are a great way to enhance the looks and functionality of your bot's responses! You can learn how to integrate them in our article on Adaptive Cards.

Asking a question: A QnA KB with a large number of QnA pairs will reduce QnA Maker's confidence in returning what it believes is the desired answer. This can result in QnA Maker fetching an unexpected answer from a user's input. Having multiple answers with similarly worded questions may also return unexpected results. 

QnA Ability only: When a bot only has the QnA ability to it, any interaction will be pushed through the Knowledge base to try and get a match.
An example of asking a question is:

  •  What browsers are supported?

The bot will take this and attempt to match it to the Knowledge base.

Multiple abilities: When other abilities have also been added to the bot, the bot will use Microsoft LUIS to understand the user's intent. You will therefore need to trigger your QnA ability with an utterance before asking QnA questions.
An example utterance in this case is:

  • I have a knowledge base question
  • FAQ
  • KB

These 'triggers' will depend on how the ability was set up. You can see existing utterances and set up new utterances in the Keyword and Target options of your QnA ability's settings. A Keyword functions as a verb, and a Target as a noun. So, in the utterance, "Ask a question", "ask" is a Keyword and "question" is a Target. You can think of it as, "Keyword a target." So, if you'd like to trigger your QnA ability with the utterance "I have a question", enter "I have" into the Keyword field, and "question" into the Target field. Save your ability and Train your bot to update its LUIS language model. 

After this initial question, the bot will then prompt the user with 'What is your Knowledge base question?'

Best Practices

  • Keep your answers as short and simple as you can.
  • Break down necessarily long answers into follow-up questions.
  • Keep your user’s expectations grounded.
  • Don’t try to trick the user into thinking they’re speaking to a human.
  • Don’t over-explain or apologize for the limitations of your bot. You can both tell your user they're speaking to a bot and provide them with options at the same time by writing something like, “You can always ask for a human.” (Make appropriate QnA pairs for any promises you make. e.g. "I need a human".) 
  • Account for different user input styles by using both long-form and short keyword-style phrasings for your QnA pairs. e.g. “I need further help” and “need help”.

Related Links

Adaptive Cards

Did this answer your question?