I am trying to build a chat bot which queries a database and returns answer from the database depending on the question asked. is there any way to connect the azure chat bot to the database say azure SQL database?
I am trying to build a chat bot which queries a database and returns answer from the database depending on the question asked. is there any way to connect the azure chat bot to the database say azure SQL database?
Per your additional information, I have changed my answer. The original suggestion using QnA Maker is below. If you need to retrieve data from a database, such as student scores the best way to do this is with a slot-filling dialog. Personally, I use and prefer waterfall dialogs initiated by intent recognition with LUIS, but there are other ways to do it.
if (step._info.options.entities.orderNumber) {
return await step.next(step._info.options.entities.orderNumber[0].toUpperCase());
} else {
return await step.prompt(ORDER_PROMPT, {
prompt: 'Please provide your order number.',
retryPrompt: 'Please enter a valid order number.',
});
}
step.values.orderNumber = step.result; ( or step.result.value if returning a choice selection).const score = await queryMyDb(student, subject). Then you can reply with the score to the user.This should give you enough to make an attempt at retrieving the information. If you try and still have trouble, you can open a separate request showing your code and the specific problems you are encountering.
Previous answer before additional context received:
Assuming you are just wanting to retrieve answers to questions in a single question-answer pair, it sounds like you just need to deploy QnA Maker and create a bot to utilize it. Microsoft provides good instructions on how to Create, train, and publish your QnA Maker knowledge base. Give it a try and if you have any issues, come back and ask via a separate question along with the code you've tried.
QnA Maker can support prompts for multi-turn conversations as well. You're still dealing with single question-answer pairs, but you can provide a easy selection for users to bring up related answers with a click of a button.
If you are using azure storage like table storage or blob. I suggest using Azure search service. This will help you solve your problem, but it will certainly add up the cost.