Skip to content

Latest commit

 

History

History
 
 

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

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.

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/11.qnamaker 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 smartLightFAQ.tsv to your newly created QnA Maker service.
  • Update qnamaker.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
  • (Optional) Follow instructions here to set up the QnA Maker CLI to deploy the model.

Running Locally

Visual Studio

  • Navigate to the samples folder (botbuilder-samples/samples/csharp_dotnetcore/11.qnamaker) and open QnABot.csproj in Visual Studio .
  • Run the project (press F5 key)

.NET Core CLI

  • Install the .NET Core CLI tools.
  • Using the command line, navigate to botbuilder-samples/samples/csharp_dotnetcore/11.qnamaker 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/11.qnamaker folder.
  • Select the qnamaker.bot file.

Further reading