Odin (SUTD QnA Bot)

The previous documentation for Qbot is rendered irrelevant since most of the suggested Azure services were already discontinued or are going to be discontinued in a few years time.

Overview

The aim of this bot is to automate question answering in class Microsoft Team channels. In parallel to that, this bot will also build a knowledge repository of questions and answers, as well as provide a better visibility on the types of questions asked by students in different classes & over the years.

Steps to Create

Creating a Language Service & Knowledge Base

A knowledge base is the repository of questions and answers that the language service can refer to when it looks up for questions. This resource can be created through this portal.

When creating a KB, Azure will prompt you to create a question answering service in the Language Studio.

In the Language Studio, click on "Create new project", select the language to English, and populate the project information.

Knowledge Base Source

KB Source can be in the file format of Excel or TSV (might be possible to try other file formats, but not priority at the moment).

After uploading the KB Source, you could edit the prompts and responses anytime.

Once you're satisfied with the list of QnAs, the KB is ready for deployment.
Click on the "Deploy knowledge base" button on the sidebar, and click on the deploy button.

Creating a Bot

After KB is successfully deployed, there is a "Create a bot" button, which will automatically create a boilerplate code for the MS Teams bot and deploy it with the relevant KB Source.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Deployment Error Troubleshooting

At the time of writing this document, the SEA region does not have the quota for Bot Web App resource. If the deployment fails, check the log and if it says "SKU Oversubscription", change the region (by default, the region selected is US Central).

Making the Application on MS Teams

Bot Configuration

The source code of the bot service can be downloaded, modified, and redeployed.

Bot Source Code

Navigate to qbot-language-service-bot and click on Download bot source code

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
.

If you're using VSCode, install the following extensions:

  • Teams Toolkit
  • Azure Resource Manager
  • Azure App Service
  • Azure Developer CLI
    Otherwise, you can also use Visual Studio, edit the source code, and deploy from within the IDE.

Bot Deployment

The commands to deploy an Azure Bot can be found here.
//TODO: research the exact steps to re-deploy the bot using the modified code.

Tabs Configuration

//TODO: read up on how to program the "Tabs" (which is basically an embedded web application) in MS Teams.

QnAMaker APIs

In order to make the QNAMaker Knowledge Base dynamic, we need a way to update the KB with new values.
This can be done by modifying the bot's codebase.

Resources Management

Currently, the ownership of all the resource group is under Prof Oka.

Transferring Ownership

Ownership of a resource group is inherited from the ownership of the subscription.
For this project, it is recommended that the student lead and the prof in charge to be co-administrators of the subscription.

If you are the owner of the resources and wish to transfer the ownership of the project to someone else, navigate to the resource group > Access Control (IAM) > Roles > Add > Add co-administrator.

Resource Groups

In this project, there is only one resource group used – qbot-trial resource group. This resource group falls under the SUTD Q-Bot Subscription subscription.

Disabling the Resource Group

Disabling the resource group means stopping all resources under the group.
Note that the data stored in Azure will be removed after a few months (Azure).
The resource group can be disabled (without deleting the resources) by temporarily cancelling the subscription:

  1. Go to Azure Portal
  2. Go to the SUTD Q-Bot Subscription
  3. Cancel the subscription.
  4. It will take a while for the subscription to cancel.
  5. Verify that the subscription is already cancelled by going to the dashbord and the Status is Disabled.

Enabling the Resource Group

Enabling the resource group means running all the resources under this group, and this is automatically done after creating all of the resources above.
However, if all of the resources are disabled. You can re-enable them by doing the following:

  1. Go to Azure Portal
  2. Go to the SUTD Q-Bot Subscription
  3. Re-enable the subscription.

Resources List

  • qbot-language-service (Language)
  • qbot-language-service-bot (Web App Bot)
  • qbot-language-service-bot (App Service plan)
  • qbot-language-service-bot-ba9a (App Service)
  • qbotlanguageservice-assrfwlctnomsvy (Search Service)

Future Works

QnA Bot (High Priority)

Currently, the bot can converse using static qna pair knowledge base.
Works required:

  • Research Knowledge Base APIs (How to programmatically add/update/delete a QnA pair on Knowledge Base)
  • Research how to make the bot call the Knowledge Base APIs
  • Research how to prompt the bot to update the Knowledge Base e.g. when student types

    @OdinBot what is the origin of "hello world"?

The bot is supposed to create a QnA pair entry with an empty Answer.

  • Research how to update the QnA pair when a solution is accepted. e.g. when an instructor/TA marks the solution as accepted (could be through prompt or keyword), the bot will update the QnA pair with the updated solution.