Bot Framework v4 QnA Maker bot sample
This sample shows how to create a bot that uses the QnA Maker Cognitive AI service.
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.
- [Node.js][4] version 8.5 or higher
# determine node version node --version
- QnA Maker service application
- 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 QnAMaker-Host, QnAMaker-KnowledgeBaseId and QnAMaker-EndpointKey. 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
qnamaker
CLI tool to deploy the model.
- Clone the repository
git clone https://github.com/microsoft/botbuilder-samples.git
- In a terminal, navigate to
samples/javascript_nodejs/11.qnamaker
cd samples/javascript_nodejs/11.qnamaker
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
- Launch Bot Framework Emulator
- File -> Open Bot Configuration and navigate to
samples/javascript_nodejs/11.qnamaker
- Select
qnamaker.bot
file
QnA Maker enables you to power a question and answer service from your semi-structured content.
One of the basic requirements in writing your own bot is to seed it with questions and answers. In many cases, the questions and answers already exist in content like FAQ URLs/documents, product manuals, etc. With QnA Maker, users can query your application in a natural, conversational manner. QnA Maker uses machine learning to extract relevant question-answer pairs from your content. It also uses powerful matching and ranking algorithms to provide the best possible match between the user query and the questions.
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> --appId <YOUR APP ID> --appSecret <YOUR APP SECRET PASSWORD>
NOTE: You can obtain your appId
and appSecret
at the Microsoft's Application Registration Portal