Skip to content

mamahara/poc-qnamaker-bot

Repository files navigation

QnA Maker

Bot Framework v4 QnA Maker bot sample. This sample shows how to integrate Multiturn and Active learning in a QnA Maker bot with Python. Click here to know more about using follow-up prompts to create multiturn conversation. To know more about how to enable and use active learning, click here.

This bot has been created using Bot Framework, it 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 used as input.

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 Active Learning to generate suggestions for knowledge base.

Prerequisites

This samples requires prerequisites in order to run.

Overview

This bot uses QnA Maker Service, an AI based cognitive service, to implement simple Question and Answer conversational patterns.

Create a QnAMaker Application to enable QnA Knowledge Bases

  • QnA knowledge base setup and application configuration steps can be found here.
    • Note that these instructions are for a different sample, but still apply to this sample. Namely: Create a QnA service, and import 'cognitiveModels/smartLightFAQ.tsv' to a knowledgebase
    • The knowledgebase 'Deployment Details' will show something like:
      POST /knowledgebases/04e394a2-7d8a-4a56-9344-db13fb1d9d79/generateAnswer
      Host: https://servicename.azurewebsites.net/qnamaker
      Authorization: EndpointKey bc3fbc8e-f461-66b1-8c58-4d6799320f9c
      Content-Type: application/json
      {"question":"<Your question>"}
  • Enable Active Learning on your QnA service.

Running the sample

  • Clone the repository
git clone https://github.com/Microsoft/botbuilder-samples.git
  • Bring up a terminal, navigate to botbuilder-samples\samples\python\11.qnamaker folder
  • Activate your desired virtual environment
  • In the terminal, type pip install -r requirements.txt
  • Update QNA_KNOWLEDGEBASE_ID, QNA_ENDPOINT_KEY, and QNA_ENDPOINT_HOST in config.py
  • Run your bot with python app.py

Testing the bot using Bot Framework Emulator

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 latest Bot Framework Emulator from here

Connect to the bot using Bot Framework Emulator

  • Launch Bot Framework Emulator
  • File -> Open Bot
  • Enter a Bot URL of http://localhost:3978/api/messages

Deploy the bot to Azure

See Deploy your bot for instructions.

The deployment process assumes you have an account on Microsoft Azure and are able to log into the Microsoft Azure Portal.

If you are new to Microsoft Azure, please refer to Getting started with Azure for guidance on how to get started on Azure.

Further reading

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published