Dismiss Notice

Register now to be one of the first members of this SharePoint Community! Click here it just takes seconds!

Dismiss Notice
Welcome Guest from Country Flag

Building a FAQ Bot with the QnA Maker Cognitive Service

Discussion in 'Official Microsoft News' started by Jamie Dalton, Mar 28, 2017.

Thread Status:
Not open for further replies.
  1. Jamie Dalton

    Jamie Dalton Guest

    Blog Posts:
    The QnA Maker cognitive service has fast become the backbone for many customer service bot scenarios. Once you have created your QnA service and published it, it’s time to incorporate it into your bot framework bot. To date, there are a couple of ways to implement it from C#.

    # Option 1 – use the Microsoft.Bot.Builder.CognitiveServices nuget package


    You’ll then need to create a class that uses the QnAMakerDialog eg:

    public class FAQDialog : QnAMakerDialog
    public FAQDialog() : base(new QnAMakerService
    (new QnAMakerAttribute(ConfigurationManager.AppSettings["QnASubscriptionKey"],
    "Sorry I don't understand, please rephrase your question.",
    { }


    Then ensure you’ve set the following keys within your web.config:

    <add key="QnASubscriptionKey" value="QnASubscriptionKey" />
    <add key="QnAKnowledgebaseId" value="QnAKnowledgebaseId" />

    Full sample here: https://github.com/Microsoft/BotBuilder-CognitiveServices/tree/master/CSharp/Samples/QnAMaker

    # Option 2 – use the QnAMakerDialog nuget package by Gary Pretty (MVP)


    This has a couple of nice features, such as being able to attribute methods with the QnA confidence score and being able to add attachments to responses. More of which can be discovered here:

    [Serializable] [QnAMakerService(“QnASubscriptionKey”, “QnAKnowledgebaseId”)] public class FAQDialogGP: QnAMakerDialog<object> { public override async Task NoMatchHandler(IDialogContext context, string originalQueryText) { await context.PostAsync($”Sorry, I couldn’t find an answer for ‘{originalQueryText}’.”); context.Wait(MessageReceived); } }

    Full sample here: https://github.com/garypretty/botframework/tree/master/QnAMakerDialog/QnAMakerDialog.Sample

    Continue reading...
Thread Status:
Not open for further replies.

Share This Page

LiveZilla Live Chat Software