This sample shows how to create a bot that uses QnA Maker. This bot example uses restify
and dotenv
.
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.
- 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
- [Optional] Update the .env file under samples/javascript_nodejs/11.qnamaker with your botFileSecret For Azure Bot Service bots, you can find the botFileSecret under application settings.
- Install modules and start the bot
npm i & npm start
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
- 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.
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>