This Bot was created using the Bot Framework v4, an AI based cognitive service, to implement simple Question and Answer conversational patterns, and can answer questions in more than 60 languages. The Bot uses the QnA Maker as well as the Text Translator API. 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, I demonstrate how to use the QnA Maker service in combination with the Text Translator to answer questions asked in more than 60 languages.
The solution was written in .NET Core SDK version 2.1. You can check your installed version the following way:
# determine dotnet version
dotnet --version
TODO: Add script for automatic deployment of required resources
To answer questions from the users a knowledge base must be created using QnA Maker. 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. How this can be done is decribed here:
git clone https://github.com/marvinbuss/MultilanguageQnABot.git
- If you downloaded the repository as zip-File, then please unzip the archive.
- In a terminal, navigate to the project folder.
Your Bot has to connect to the deployed services to function properly. Therefore you have to update the appsettings.json
.
MicrosoftAppId
: For local testing not required.MicrosoftAppPassword
: For local testing not required.QnAKnowledgebaseId
: Base ID of your published Knowledge BaseQnAAuthKey
: Authentication Key of your published Knowledge BaseQnAEndpointHostName
: Endpoint of your QnA serviceQnAThreshold
: Threshold/Accuracy of accepted answers (e.g. 0.6 or 0.7)TranslatorTextSubscriptionKey
: Subscription Key of your Text Translator APITranslatorTextEndpoint
: Endpoint of your Text Translator service (e.g. https://api.cognitive.microsofttranslator.com/translate?api-version=3.0)TranslatorTextRoute
: Should not be changed
- Run the bot from a terminal or from Visual Studio, choose option A or B.
# run the bot
dotnet run
- Launch Visual Studio
- File -> Open -> Project/Solution
- Navigate to the project folder.
- Select
MultilanguageQnABot.csproj
file - Press
F5
to run the project
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. Follow this link to install the Bot Framework Emulator version 4.3.0 or greater.
- Launch Bot Framework Emulator
- File -> Open Bot
- Enter a Bot URL of
http://localhost:3978/api/messages
To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.