Skip to content

Latest commit

 

History

History
94 lines (60 loc) · 7.55 KB

File metadata and controls

94 lines (60 loc) · 7.55 KB

Module 2.2

Building Intelligent Bots with Microsoft's Bot Framework (.NET)

This hands-on lab guides you through creating an intelligent bot from end-to-end using the Microsoft Bot Framework, Azure Search, and Microsoft's Language Understanding Intelligent Service (LUIS). To stay current with announcements, please visit: This page.

[09/29/2018] Important Note!
The v4 SDK for the bot framework recently went GA. If you would like to complete lab02.2-building_bots with the v3 SDK (instead of the v4 SDK), refer here, but note that we will not be maintaining the V3 labs going forward. If you are an instructor redelivering this course and have questions, please email learnanalytics@microsoft.com.

Objectives

In this workshop, you will:

  • Understand how to implement Azure Search features to provide a positive search experience inside applications
  • Build an intelligent bot (with C#) using Microsoft Bot Framework (SDK v4) that leverages LUIS and Azure Search
  • Use Middleware to make bots more efficient and optimize calls to LUIS.

While there is a focus on LUIS and Azure Search, you will also leverage the following technologies:

  • Data Science Virtual Machine (DSVM)
  • Visual Studio

Prerequisites

This workshop is meant for an AI Developer on Azure. Since this is a short workshop, there are certain things you need before you arrive.

Firstly, you should have experience with Visual Studio. We will be using it for everything we are building in the workshop, so you should be familiar with how to use it to create applications. Additionally, this is not a class where we teach you how to code or develop applications. We assume you know how to code in C# (you can learn here), but you do not know how to implement advanced Search and NLP (natural language processing) solutions.

Secondly, you should have some experience developing bots with Microsoft's Bot Framework. We won't spend a lot of time discussing how to design them or how dialogs work. If you are not familiar with the Bot Framework, you should complete this tutorial prior to attending the workshop.

Thirdly, you should have experience with the portal and be able to create resources (and spend money) on Azure. We will not be providing Azure passes for this workshop.

Note: This workshop was developed and tested with Visual Studio Community 2017

Introduction

We're going to build an end-to-end scenario that allows you to pull in your own pictures, use Cognitive Services to find objects and people in the images, figure out how those people are feeling, and store all of that data into a NoSQL Store (CosmosDB). We'll use that NoSQL Store to populate an Azure Search index, and then build a Bot Framework bot using LUIS to allow easy, targeted querying.

Note: This lab combines some of the results obtained from various labs (Computer Vision, Azure Search, and LUIS) from earlier in this workshop. If you did not complete the above listed labs, you will need to complete the Computer Vision, Azure Search, and LUIS labs before moving forwards. Alternatively, you can request to use a neighbor's keys from their Azure Search/LUIS labs.

Architecture

In a previous lab (lab01.1-computer_vision), we built a simple C# application that allows you to ingest pictures from your local drive, then invoke the Computer Vision Cognitive Service to grab tags and a description for those images.

Once we had these data, we processed it and stored all the information needed in CosmosDB, our NoSQL PaaS offering.

Once we had the data in CosmosDB, we built an Azure Search Index on top of it (lab02.1-azure_search). Next, we will build a Bot Framework bot to query it. We'll also extend this bot with LUIS to automatically derive intent from your queries and use those to direct your searches intelligently.

Architecture Diagram

This lab was modified from this Cognitive Services Tutorial.

Navigating the GitHub

There are several directories in the resources folder:

  • assets, instructor: You can ignore these folders for the purposes of this lab.
  • code: In here, there are several directories that we will use:
    • Models: These classes will be used when we add search to our PictureBot.
    • FinishedPictureBot-Part0: The finished PictureBot.sln that is a simple "Hello World" bot. If you fall behind or get stuck, you can refer to this.
    • FinishedPictureBot-Part1: The finished PictureBot.sln that includes additions for Regex. If you fall behind or get stuck, you can refer to this.
    • FinishedPictureBot-Part2: The finished PictureBot.sln that includes additions for Regex and Search. If you fall behind or get stuck, you can refer to this.
    • FinishedPictureBot-Part3: The finished PictureBot.sln that includes additions for Regex, LUIS and Azure Search. If you fall behind or get stuck, you can refer to this.

Note: If you decide to use a finished solution, you will still need to add the keys to connect to services, and you will not be able to publish the bot. We recommend comparing the finished solution to your solution and making adjustments to your solution as needed (as opposed to just opening and running from the finished solutions).

You need Visual Studio to run these labs. If you have already deployed a Windows Data Science Virtual Machine for one of the labs, we recommend using that.

Collecting the Keys

Over the course of this lab, we will collect various keys. It is recommended that you save all of them in a text file, so you can easily access them throughout the workshop. You may already have already started collecting these keys in previous labs, so you can keep on using the same text file.

Keys

  • LUIS App ID:
  • LUIS Key:
  • LUIS URI:
  • Azure Search Name:
  • Azure Search Key:
  • botFilePath:
  • botFileSecret:

Navigating the Labs

This workshop has been broken down into five sections:

  • 1_Dialogs_and_Regex: Here you will build a bot that uses Regex to act on user input and learn about using dialog containers for organizing bots.
  • 2_Azure_Search: We'll configure our bot for Azure Search and connect it to the Azure Search service from the previous lab.
  • 3_LUIS: Next, we'll incorporate our LUIS model into our bot, so that we can call LUIS when Regex does not recognize a user's intent.
  • 4_Publish_and_Register: We'll finish by re-publishing and registering our bot.
  • 5_Closing: Here you'll find a summary of what you've done and where to learn more.

Continue to 1_Dialogs_and_Regex, or return to the Main menu