Skip to content

Latest commit

 

History

History
 
 

20.qna-with-appinsights

This sample shows how to integrate QnA Maker in a simple bot with ASP.Net Core 2 and Application Insights.

Concepts introduced in this sample

The QnA Maker Service enables you to build, train and publish a simple question and answer bot based on FAQ URLs, structured documents or editorial content in minutes.

The Application Insights enables you to discover actionable insights through application performance management and instant analytics.

In this sample, we demonstrate how to use the QnA Maker service to answer questions based on a FAQ text file as input.

To try this sample

  • Clone the samples repository
git clone https://github.com/Microsoft/botbuilder-samples.git
  • [Optional] Update the appsettings.json file under botbuilder-samples/samples/csharp_dotnetcore/20.qna-with-appinsights with your botFileSecret. For Azure Bot Service bots, you can find the botFileSecret under application settings.

Prerequisites

  • Follow instructions here to create a QnA Maker service.
  • Follow instructions here to import the sample.qna to your newly created QnA Maker service.
  • Update BotConfiguration.bot with your kbid (KnowledgeBase Id) and endpointKey in the "qna" services section. You can find this information under "Settings" tab for your QnA Maker Knowledge Base at QnAMaker.ai.
  • Name of your QnA Bot should be "QnABot".
  • Follow instructions here to set up your Application Insights service.
    • Note: The Application Insights will automatically update the appsettings.json file.
  • (Optional) Follow instructions here to set up the Qna Maker CLI to deploy the model.

Visual Studio

  • Navigate to the samples folder (botbuilder-samples/samples/csharp_dotnetcore/20.qna-with-appinsights) and open QnABot.csproj in Visual Studio.
  • Hit F5

Visual Studio Code

  • Open botbuilder-samples/samples/csharp_dotnetcore/20.qna-with-appinsights sample folder
  • Bring up a terminal, navigate to botbuilder-samples/samples/csharp_dotnetcore/20.qna-with-appinsights folder.
  • Type 'dotnet run'.

Testing the bot using Bot Framework Emulator

Microsoft Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.

  • Install the Bot Framework Emulator from here.

Connect to bot using Bot Framework Emulator V4

  • Launch the Bot Framework Emulator
  • File -> Open bot and navigate to botbuilder-samples/samples/csharp_dotnetcore/20.qna-with-appinsights folder.
  • Select the BotConfiguration.bot file.

Deploy this bot to Azure

You can use the MSBot Bot Builder CLI tool to clone and configure any services this sample depends on.

To install all Bot Builder tools -

Ensure you have Node.js version 8.5 or higher

npm i -g msbot chatdown ludown qnamaker luis-apis botdispatch luisgen

To clone this bot, run

msbot clone services -f deploymentScripts/msbotClone -n <BOT-NAME> -l <Azure-location> --subscriptionId <Azure-subscription-id>

Further reading