0

I am referring to the QnA bot sample from the git hub link QnAbot, but when I follow the steps, I am not able to figure it out the BotConfiguration.bot. I want to see the sample of this .bot file. However, from in the sample code directory, I did not find it.

Can someone tell me how to create a simple QnA bot using SDK4.0?

I am using C# .net core bot template.

Thanks.

Vivek Jain
  • 71
  • 1
  • 11

2 Answers2

1

In order to auto generate a bot file you have to use botbuilder-tools. For some reason the instructions are missing in that samples readme I will work on getting that updated ASAP.

You can install the tools by running this command in command line:

npm install -g chatdown msbot ludown luis-apis qnamaker botdispatch luisgen

You will need to have there installed:

  • Node.js version 8.5 or higher
  • .NET Core SDK version 2.1.403 or higher

Then you will have to run the msbot init command with the options you need, a list of options can be found here

and an example command would look like this:

msbot init --name TestBot --endpoint http://localhost:9499/api/messages

Then you will need to add the qnamaker service, there is information about adding this and other services here

an example of the command you would run to add the qnamaker service would look like this:

msbot connect qna --name "<NAME>" --kbId <KNOWLEDGE BASE ID> --subscriptionKey <SUBSCRIPTION KEY> --endpointKey <ENDPOINT-KEY> --hostname "https://myqna.azurewebsites.net"

When you are done you will have a .bot file that will look like this:

{
    "name": "qnamaker2",
    "services": [
        {
            "type": "endpoint",
            "name": "qnamaker2",
            "endpoint": "http://localhost:3978/api/messages",
            "appId": "",
            "appPassword": "",
            "id": "0"
        },
        {
            "type": "qna",
            "name": "{YOUR QnA APP NAME}",
            "kbId": "{YOUR KNOWLEDGEBASE ID}",
            "subscriptionKey": "{YOUR SUBSCRIPTION KEY}",
            "endpointKey": "{your endpoint key}",
            "hostname": "{YOUR HOSTNAME}",
            "id": "74"
        }
    ],
    "padlock": "",
    "version": "2.0"
}
D4RKCIDE
  • 3,439
  • 1
  • 18
  • 34
1

There is an easier way to generate Bot Configuration file without typing all these commands.

a) Install Bot Framework Emulator

b) Launch the emulator, Navigate to "File" and select "New Bot Configuration".

c) After key in all the information needed, just save the file at your desired location.

p/s: The sample botConfiguraton.bot file can refer to the official Microsoft documentation.

hongguan
  • 520
  • 2
  • 12