Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Azure Bot Services Guide

Azure Bot Services Guide

Quick start on how to create a bot in Azure.

Tee Guang Ying Marcus

May 26, 2017
Tweet

Other Decks in Technology

Transcript

  1. Azure Bot Service Preview Develop your way Built in code

    editor </> Integrated chat window Quick start templates
  2. Azure Bot Service Preview Direct Line support API Embedded web

    chat Cognitive Services Channel support
  3. Azure Bot Service Preview Scale on demand Reduced dev ops

    Powered by Azure Functions Continuous deployment
  4. Let’s Start Here’s what you need to build a bot:

    Azure account Web Browser Visual Studio or any code editor (Optional)
  5. Fill in the info Tick “pin to dashboard” for easier

    navigation. Once done, click “Create”.
  6. Click Continue Note: QnA Maker uses Microsoft Cognitive Services (Text

    Analytics) to understand the query, for now in preview it offers free up to 10,000 transactions a month.
  7. Input the question and answer Once done, click “Save and

    retrain” You can test your knowledge base here
  8. You can input several alternatives for the question If answer

    is wrong, you can choose the appropriate one to train the bots
  9. Paste here Once done, click “Save and retrain” Go back

    to Knowledge Base to check imported pairs
  10. Go back to “Test” to test the imported pairs Once

    done, click “Save and retrain” Finally, click “Publish”
  11. You can change “Welcome” to anything you want. This is

    the reply when new users added into the conversation Once done, click “Save”
  12. LUIS Bots Bots with natural language understanding, based on Cognitive

    Services – Language Understanding Intelligence Service (LUIS).
  13. Introduction In this tutorial, we will build a bot that

    reply to users the image of traffic camera in Singapore. Data are obtained from mytransport.sg, provided by LTA. In order to proceed this tutorial, please obtain the Account Key from LTA by registering in mytransport.sg.
  14. Click “+” to add new Intents Notes Intent is the

    intention that you want LUIS to learn, when the model is trained, LUIS will categorize the command to the Intents that you’ve set.
  15. Submitting the command Click “+” to add new Entities Note

    Entities is the object that LUIS will pick up from the Intents.
  16. Newly added Entities Click “Review labels” Note Now we want

    to label which item in the command belongs to “cameraNo”.
  17. LUIS Luis.ai is a machine learning tools built by Microsoft

    to understand the natural language. Users don’t have to deal with the machine learning model, just have to define the intents and entities for the particular bots. In next section, we will move into coding.
  18. Test here, we coded the response for “Greeting” intent to

    be “Hello World!” Click save after editing the code
  19. JSON Now, we will get data from web, bind the

    data and output to users. The data that we obtained is in JSON format, and we have to bind the data before we can use it.
  20. Add a function to obtain the data Note You can

    obtain the Account Key from mytransport.sg
  21. Add this to obtain the data when this intent is

    triggered. Note cameraID is the entities that we extract from the command.
  22. Now we find the camera within the data Note CameraNo

    is ranging from 1001 – 9999, but not all camera number is available. We find the ranking of this camera here.
  23. Complete code for the intent [LuisIntent("cameraImage")] public async Task cameraImage(IDialogContext

    context, LuisResult result) { //obtain the json data from LTA and extract entities Rootobject Traffic = await GetTrafficImages.GetImage(); string cameraID = ""; cameraID = result.Entities[0].Entity; //find the camera from data int cameraNo = 0; int maxCameraNo = Traffic.value.Count() - 1; while (cameraID != Traffic.value[cameraNo].CameraID) { if (cameraNo == maxCameraNo) break; else cameraNo += 1; } //construct response //case when can't find the camera if (cameraNo == maxCameraNo) { await context.PostAsync("I can't find this camera."); // context.Wait(MessageReceived); } //case when can find the camera else { string cameraImageURL = Traffic.value[cameraNo].ImageLink; var replyTraffic = context.MakeMessage(); replyTraffic.Attachments = new List<Attachment>() { new Attachment() { ContentUrl = cameraImageURL, ContentType = "image/png", Name = "Camera.png" } }; await context.PostAsync(replyTraffic); await context.PostAsync("Here's your image."); // context.Wait(MessageReceived); } }
  24. Done That’s it! Congratulations on building your first language understanding

    bots! Refer to next slides on how to improve the language understanding model.
  25. Form Bots Form bots is simple and useful, in terms

    of performing a guided conversation with the users. Typically, this guided conversation is used when you need the users to answer a series of questions.
  26. Proactive Bots Bots that proactively engage users when given a

    context, and initiate the conversation.