SlideShare a Scribd company logo
1 of 46
CREATING
INTELLIGENT BOTS
Introduction to Microsoft Bot Framework & LUIS.ai
Kevin Leung
 Microsoft Bot Framework
 Cognitive Services + LUIS.ai
 ASP.NETCore
 Internet ofThings
MicrosoftTechnical Evangelist
Follow Me: @KSLHacks
Road Map
 Why Bots
 RealWorld Demo
 Microsoft Bot Framework
 Building our own bot
 Adding Intelligence
 Deploying!
Why Conversation as a Platform?
“Bots are the new apps,” said Nadella during a
nearly three-hour keynote here that sketched a vision for the
way humans will interact with machines. “People-to-
people conversations, people-to-digital
assistants, people-to-bots and even digital
assistants-to-bots. That’s the world
you’re going to get to see in the
years to come.”
- USATODAY
“Microsoft CEO Satya Nadella says future belongs to bots”
FRIDGEBOT DEMO
Try it yourself:
aka.ms/fridgechatbot
Microsoft Bot Framework
■ Supports NodeJS and C# .NET
■ Lead users through conversation
– Prompts, Choices, Media, Rich Cards (Displays)
■ Bot Emulator provided for local development/testing
■ Easy to incorporate Natural Language Processing (Cognitive Services)
■ Easily deploy to Azure Cloud Services
Connectors and Benefits
■ Connector to Platform Channels
– One Bot : Many Channels and endpoints
■ Why restrict yourself to one platform?
– Hit them all
■ Half the battle is getting users to download your app.
– They already have these installed
OUR FIRST BOT
Visual Studio Community
Getting Started
1. Download the Bot ApplicationTemplate here: http://aka.ms/bf-bc-vstemplate
2. Save zip file toVisual Studio templates directory
3. OpenVisual Studio
4. Create newVisual C# project using the Bot ApplicationTemplate
Testing out theTemplate
1. Download the Bot Framework Emulator here: https://emulator.botframework.com/
1. More info: https://docs.botframework.com/en-us/tools/bot-framework-emulator/
2. Run the project inVisual Studio
3. Check the localhost in the browser that opens
4. Enter the same local host PORT and press Connect
Adding a new RootDialog
RootDialog.cs
1. Inherit from IDialog<object>
2. Implement StartAsync() method
1. Welcome our users
3. Create a new method to display a prompt after the greeting message
RootDialog.cs - Prompting Choice
1. Add strings which will become your option choices for the user
2. PromptDialog.Choice will present option buttons to the user
RootDialog.cs - OnOptionSelect
■ This method runs when the user selects an option
– Arguement result holds the user’s response
RootDialog.cs – PromptDialog.Text()
LUIS.ai
■ Language Understanding Intelligence Service (LUIS)
■ Natural Language Processing (NLP)
– Using artificial intelligence to process natural language
■ Extract Intents (meaning of the utterance)
■ Extract Entities (items in the utterance that are of value)
■ This is a huge problem developers working with AI or human speech encounter
– Cognitive Services: LUIS abstracts this into a training model
CREATING
INTELLIGENCE!
LUIS.ai
Creating a LUIS model
1. Head over to luis.ai
2. Log in with your Microsoft live account
3. Create a new model
1. You will need an Azure account to create a ‘Cognitive Service’ service
2. This will provide you with a Key. (free, but need to get it through Azure Portal)
Creating a LUIS model
Add Intent
Train the model
Add new Intent + Entity
1. Created new Intent ‘UpdateTwitter’
2. Clicked on the ‘@’ and ‘kslhacks’, entered a new entity name and press ‘create’
Training Intent and Entity
1. Select all other entities and label them accordingly..
2. You can now select from the created entity
Training Intent and Entity
■ Continue creating intents and entities in the portal
■ Make sure to add sufficient utterances, label entities and save!
■ For this demo we will create ‘Greeting’, ‘UpdateTwitter’, ‘UpdateName’ and ‘None’
– None is always created in every model
– LUIS passes back ‘None’ intent when it does not match any other intent
– Think of ‘None’ as a fall through
– If LUIS doesn’t know how to handle an utterance  ‘None’ is returned
Train model
■ Navigate to ‘Train &Test’ (left menu)
– Press ‘Train Application’
■ You can always go back to the intents and train the utterances
– This makes your LUIS model smarter!
– It should start identifying entities correctly
■ You can test the confidence level under the ‘Test &Train’
– Confidence for each intent is shown
– Entities are displayed here
Publish model
1. Navigate to ‘Publish App’ (left menu)
2. Press ‘Publish’
3. Make note of the model ID and model Key from the ‘Endpoint url’
LUIS JSON
■ If we click on the endpoint and add an utterance
– Add after ‘&q=‘ at end of url
■ We can see the JSON LUIS returns back to us
■ This is what we consume in our bot
ADDING
INTELLIGENCE!
LUIS Intent Dialogs C#
Adding LuisDialog
1. Using Microsoft.Bot.Builder.Luis;
2. Change IDialog<> to LuisDialog<>
3. [LuisModel(“<model ID>”,”<model Key>”]
LUIS models and Intents
1. Create a method for each Intent, passing in IDialogContext, and LuisResult
2. Add [LuisIntent] attribute above each method
3. User input will be passed to LUIS endpoint and JSON will be returned
4. The bot will handle the LUIS JSON and execute the correct method base don the
intent
LUIS models and Intents
LUIS models and Intents
DEPLOYTO AZURE
Web App Services
Publish Project to Azure
■ Must be signed into yourVisual Studio
■ Must have activatedAzure Cloud on your
account
1. Right click on your project
2. Click ‘Publish’ option from the menu
3. Click ‘MicrosoftAzure App Service’
4. Crate new Resource Group to Host
Publish Project to Azure
REGISTERYOUR
BOT
Dev.botframework.com
Register Bot
1. Head over to https://dev.botframework.com/bots/new to register your bot
2. Add a Name, bot handle and description
3. Add the Message endpoint
1. This is the azurewebsites.net endpoint you just made!
2. Few things to add.. Mine was demobot.azurewebsites.net
3. I will enter: https://demobot.azurewebsites.net/api/messages
4. Click ‘Crate MicrosoftApp ID and password
1. Remember these!
5. Register your bot!
Add your ID and Password
■ Since we have registered our bot’s end point with an ID and Password, we need to add
these credentials to our bot.
1. Navigate to Web.config (under Solution Explorer on the right side)
2. You should see a empty spot for our “MicrosoftAppID & Password” values.
1. Paste these here!
SETUP CHANNEL
Web Chat
SetupWeb Chat Channel
Once you have registered your
bot, go to the Channels
section of the portal.
Click ‘Edit’ forWeb Chat
■ You will be brought to a
new page.
■ Click ‘Add new site’
■ Name your site (reference
only)
■ Click ‘Done’
Get your secret key and embed code
1. Click ‘Show’, you will need to put this key in the ‘YOUR_SECRET_HERE’ embed code
2. Copy the embed code
Add your embed code
■ Under Solution Explorer (on the right), find ‘default.htm’
■ Paste the embed codeWITH your secret here.
Re-Publish to Azure!
1. Right click your project  Publish
2. Now we should be able to navigate to our demobot.azurewebsites.net and see our
bot!
Ready for the world to use
Thanks!
■ Check out my blog/tutorials! www.KSLHacks.com
■ dev.botframework.com
■ luis.ai
■ azure.microsoft.com/free ($200 credits)
// Kevin Leung
// MicrosoftTechnical Evangelist
//Twitter: @KSLHacks (send questions here)
// Github: KSLHacks

More Related Content

Similar to Creating Intelligent Chatbots

Chatbot development workshop with the Microsoft Bot Framework
Chatbot development workshop with the Microsoft Bot FrameworkChatbot development workshop with the Microsoft Bot Framework
Chatbot development workshop with the Microsoft Bot Frameworkgjuljo
 
API Workshop Series Part 2: The Future of Intelligent User Interactions
API Workshop Series Part 2: The Future of Intelligent User InteractionsAPI Workshop Series Part 2: The Future of Intelligent User Interactions
API Workshop Series Part 2: The Future of Intelligent User InteractionsCaitlin Zucal
 
Dynamics 365 self hosting bots
Dynamics 365 self hosting botsDynamics 365 self hosting bots
Dynamics 365 self hosting botsAmit Patil
 
Behind the buzzwords: using chatbots & AI for everyday wins!
Behind the buzzwords: using chatbots & AI for everyday wins!Behind the buzzwords: using chatbots & AI for everyday wins!
Behind the buzzwords: using chatbots & AI for everyday wins!SoHo Dragon
 
Webinar - Building a ChatBot using IBM Watson Conversation Service
Webinar - Building a ChatBot using IBM Watson Conversation ServiceWebinar - Building a ChatBot using IBM Watson Conversation Service
Webinar - Building a ChatBot using IBM Watson Conversation ServiceThirdEye Data
 
I Love APIs - Oct 2015
I Love APIs - Oct 2015I Love APIs - Oct 2015
I Love APIs - Oct 2015Mike McNeil
 
Introduction to BOT Framework- Global Azure Bootcamp 2017
Introduction to BOT Framework- Global Azure Bootcamp 2017Introduction to BOT Framework- Global Azure Bootcamp 2017
Introduction to BOT Framework- Global Azure Bootcamp 2017Jalpesh Vadgama
 
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksIBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksSenturus
 
BP 308 - The Journey to Becoming a Social Application Developer
BP 308 - The Journey to Becoming a Social Application DeveloperBP 308 - The Journey to Becoming a Social Application Developer
BP 308 - The Journey to Becoming a Social Application DeveloperSerdar Basegmez
 
"Build AI Compliant Whatsapp-like Chat App Using Qiscus SDK" by Evan Purnama ...
"Build AI Compliant Whatsapp-like Chat App Using Qiscus SDK" by Evan Purnama ..."Build AI Compliant Whatsapp-like Chat App Using Qiscus SDK" by Evan Purnama ...
"Build AI Compliant Whatsapp-like Chat App Using Qiscus SDK" by Evan Purnama ...Tech in Asia ID
 
Bot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachBot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachITCamp
 
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp
 
LF_APIStrat17_Connect Your RESTful API to Hundreds of Others in Minutes (Zapi...
LF_APIStrat17_Connect Your RESTful API to Hundreds of Others in Minutes (Zapi...LF_APIStrat17_Connect Your RESTful API to Hundreds of Others in Minutes (Zapi...
LF_APIStrat17_Connect Your RESTful API to Hundreds of Others in Minutes (Zapi...LF_APIStrat
 
Operating System Upgrade Implementation Report And...
Operating System Upgrade Implementation Report And...Operating System Upgrade Implementation Report And...
Operating System Upgrade Implementation Report And...Julie Kwhl
 
Identifying Users Across Platforms with a Universal ID Webinar Slides
Identifying Users Across Platforms with a Universal ID Webinar SlidesIdentifying Users Across Platforms with a Universal ID Webinar Slides
Identifying Users Across Platforms with a Universal ID Webinar SlidesLooker
 
Tbjsphx918
Tbjsphx918Tbjsphx918
Tbjsphx918Thinkful
 

Similar to Creating Intelligent Chatbots (20)

Chatbot development workshop with the Microsoft Bot Framework
Chatbot development workshop with the Microsoft Bot FrameworkChatbot development workshop with the Microsoft Bot Framework
Chatbot development workshop with the Microsoft Bot Framework
 
API Workshop Series Part 2: The Future of Intelligent User Interactions
API Workshop Series Part 2: The Future of Intelligent User InteractionsAPI Workshop Series Part 2: The Future of Intelligent User Interactions
API Workshop Series Part 2: The Future of Intelligent User Interactions
 
Dynamics 365 self hosting bots
Dynamics 365 self hosting botsDynamics 365 self hosting bots
Dynamics 365 self hosting bots
 
Behind the buzzwords: using chatbots & AI for everyday wins!
Behind the buzzwords: using chatbots & AI for everyday wins!Behind the buzzwords: using chatbots & AI for everyday wins!
Behind the buzzwords: using chatbots & AI for everyday wins!
 
Are API Services Taking Over All the Interesting Data Science Problems?
Are API Services Taking Over All the Interesting Data Science Problems?Are API Services Taking Over All the Interesting Data Science Problems?
Are API Services Taking Over All the Interesting Data Science Problems?
 
Webinar - Building a ChatBot using IBM Watson Conversation Service
Webinar - Building a ChatBot using IBM Watson Conversation ServiceWebinar - Building a ChatBot using IBM Watson Conversation Service
Webinar - Building a ChatBot using IBM Watson Conversation Service
 
I Love APIs - Oct 2015
I Love APIs - Oct 2015I Love APIs - Oct 2015
I Love APIs - Oct 2015
 
LUIS and Bots
LUIS and BotsLUIS and Bots
LUIS and Bots
 
Conversational AI: What's New?
Conversational AI: What's New?Conversational AI: What's New?
Conversational AI: What's New?
 
Introduction to BOT Framework- Global Azure Bootcamp 2017
Introduction to BOT Framework- Global Azure Bootcamp 2017Introduction to BOT Framework- Global Azure Bootcamp 2017
Introduction to BOT Framework- Global Azure Bootcamp 2017
 
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksIBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
 
BP 308 - The Journey to Becoming a Social Application Developer
BP 308 - The Journey to Becoming a Social Application DeveloperBP 308 - The Journey to Becoming a Social Application Developer
BP 308 - The Journey to Becoming a Social Application Developer
 
"Build AI Compliant Whatsapp-like Chat App Using Qiscus SDK" by Evan Purnama ...
"Build AI Compliant Whatsapp-like Chat App Using Qiscus SDK" by Evan Purnama ..."Build AI Compliant Whatsapp-like Chat App Using Qiscus SDK" by Evan Purnama ...
"Build AI Compliant Whatsapp-like Chat App Using Qiscus SDK" by Evan Purnama ...
 
Bot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachBot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent Ellerbach
 
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
 
LF_APIStrat17_Connect Your RESTful API to Hundreds of Others in Minutes (Zapi...
LF_APIStrat17_Connect Your RESTful API to Hundreds of Others in Minutes (Zapi...LF_APIStrat17_Connect Your RESTful API to Hundreds of Others in Minutes (Zapi...
LF_APIStrat17_Connect Your RESTful API to Hundreds of Others in Minutes (Zapi...
 
Designing Modules in Python
Designing Modules in PythonDesigning Modules in Python
Designing Modules in Python
 
Operating System Upgrade Implementation Report And...
Operating System Upgrade Implementation Report And...Operating System Upgrade Implementation Report And...
Operating System Upgrade Implementation Report And...
 
Identifying Users Across Platforms with a Universal ID Webinar Slides
Identifying Users Across Platforms with a Universal ID Webinar SlidesIdentifying Users Across Platforms with a Universal ID Webinar Slides
Identifying Users Across Platforms with a Universal ID Webinar Slides
 
Tbjsphx918
Tbjsphx918Tbjsphx918
Tbjsphx918
 

Recently uploaded

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

Creating Intelligent Chatbots

  • 1. CREATING INTELLIGENT BOTS Introduction to Microsoft Bot Framework & LUIS.ai
  • 2. Kevin Leung  Microsoft Bot Framework  Cognitive Services + LUIS.ai  ASP.NETCore  Internet ofThings MicrosoftTechnical Evangelist Follow Me: @KSLHacks
  • 3. Road Map  Why Bots  RealWorld Demo  Microsoft Bot Framework  Building our own bot  Adding Intelligence  Deploying!
  • 4. Why Conversation as a Platform? “Bots are the new apps,” said Nadella during a nearly three-hour keynote here that sketched a vision for the way humans will interact with machines. “People-to- people conversations, people-to-digital assistants, people-to-bots and even digital assistants-to-bots. That’s the world you’re going to get to see in the years to come.” - USATODAY “Microsoft CEO Satya Nadella says future belongs to bots”
  • 5. FRIDGEBOT DEMO Try it yourself: aka.ms/fridgechatbot
  • 6. Microsoft Bot Framework ■ Supports NodeJS and C# .NET ■ Lead users through conversation – Prompts, Choices, Media, Rich Cards (Displays) ■ Bot Emulator provided for local development/testing ■ Easy to incorporate Natural Language Processing (Cognitive Services) ■ Easily deploy to Azure Cloud Services
  • 7. Connectors and Benefits ■ Connector to Platform Channels – One Bot : Many Channels and endpoints ■ Why restrict yourself to one platform? – Hit them all ■ Half the battle is getting users to download your app. – They already have these installed
  • 8. OUR FIRST BOT Visual Studio Community
  • 9. Getting Started 1. Download the Bot ApplicationTemplate here: http://aka.ms/bf-bc-vstemplate 2. Save zip file toVisual Studio templates directory 3. OpenVisual Studio 4. Create newVisual C# project using the Bot ApplicationTemplate
  • 10. Testing out theTemplate 1. Download the Bot Framework Emulator here: https://emulator.botframework.com/ 1. More info: https://docs.botframework.com/en-us/tools/bot-framework-emulator/ 2. Run the project inVisual Studio 3. Check the localhost in the browser that opens 4. Enter the same local host PORT and press Connect
  • 11.
  • 12. Adding a new RootDialog
  • 13. RootDialog.cs 1. Inherit from IDialog<object> 2. Implement StartAsync() method 1. Welcome our users 3. Create a new method to display a prompt after the greeting message
  • 14. RootDialog.cs - Prompting Choice 1. Add strings which will become your option choices for the user 2. PromptDialog.Choice will present option buttons to the user
  • 15. RootDialog.cs - OnOptionSelect ■ This method runs when the user selects an option – Arguement result holds the user’s response
  • 17. LUIS.ai ■ Language Understanding Intelligence Service (LUIS) ■ Natural Language Processing (NLP) – Using artificial intelligence to process natural language ■ Extract Intents (meaning of the utterance) ■ Extract Entities (items in the utterance that are of value) ■ This is a huge problem developers working with AI or human speech encounter – Cognitive Services: LUIS abstracts this into a training model
  • 19. Creating a LUIS model 1. Head over to luis.ai 2. Log in with your Microsoft live account 3. Create a new model 1. You will need an Azure account to create a ‘Cognitive Service’ service 2. This will provide you with a Key. (free, but need to get it through Azure Portal)
  • 23. Add new Intent + Entity 1. Created new Intent ‘UpdateTwitter’ 2. Clicked on the ‘@’ and ‘kslhacks’, entered a new entity name and press ‘create’
  • 24. Training Intent and Entity 1. Select all other entities and label them accordingly.. 2. You can now select from the created entity
  • 25. Training Intent and Entity ■ Continue creating intents and entities in the portal ■ Make sure to add sufficient utterances, label entities and save! ■ For this demo we will create ‘Greeting’, ‘UpdateTwitter’, ‘UpdateName’ and ‘None’ – None is always created in every model – LUIS passes back ‘None’ intent when it does not match any other intent – Think of ‘None’ as a fall through – If LUIS doesn’t know how to handle an utterance  ‘None’ is returned
  • 26. Train model ■ Navigate to ‘Train &Test’ (left menu) – Press ‘Train Application’ ■ You can always go back to the intents and train the utterances – This makes your LUIS model smarter! – It should start identifying entities correctly ■ You can test the confidence level under the ‘Test &Train’ – Confidence for each intent is shown – Entities are displayed here
  • 27. Publish model 1. Navigate to ‘Publish App’ (left menu) 2. Press ‘Publish’ 3. Make note of the model ID and model Key from the ‘Endpoint url’
  • 28. LUIS JSON ■ If we click on the endpoint and add an utterance – Add after ‘&q=‘ at end of url ■ We can see the JSON LUIS returns back to us ■ This is what we consume in our bot
  • 30. Adding LuisDialog 1. Using Microsoft.Bot.Builder.Luis; 2. Change IDialog<> to LuisDialog<> 3. [LuisModel(“<model ID>”,”<model Key>”]
  • 31. LUIS models and Intents 1. Create a method for each Intent, passing in IDialogContext, and LuisResult 2. Add [LuisIntent] attribute above each method 3. User input will be passed to LUIS endpoint and JSON will be returned 4. The bot will handle the LUIS JSON and execute the correct method base don the intent
  • 32. LUIS models and Intents
  • 33. LUIS models and Intents
  • 35. Publish Project to Azure ■ Must be signed into yourVisual Studio ■ Must have activatedAzure Cloud on your account 1. Right click on your project 2. Click ‘Publish’ option from the menu 3. Click ‘MicrosoftAzure App Service’ 4. Crate new Resource Group to Host
  • 38. Register Bot 1. Head over to https://dev.botframework.com/bots/new to register your bot 2. Add a Name, bot handle and description 3. Add the Message endpoint 1. This is the azurewebsites.net endpoint you just made! 2. Few things to add.. Mine was demobot.azurewebsites.net 3. I will enter: https://demobot.azurewebsites.net/api/messages 4. Click ‘Crate MicrosoftApp ID and password 1. Remember these! 5. Register your bot!
  • 39. Add your ID and Password ■ Since we have registered our bot’s end point with an ID and Password, we need to add these credentials to our bot. 1. Navigate to Web.config (under Solution Explorer on the right side) 2. You should see a empty spot for our “MicrosoftAppID & Password” values. 1. Paste these here!
  • 41. SetupWeb Chat Channel Once you have registered your bot, go to the Channels section of the portal. Click ‘Edit’ forWeb Chat ■ You will be brought to a new page. ■ Click ‘Add new site’ ■ Name your site (reference only) ■ Click ‘Done’
  • 42. Get your secret key and embed code 1. Click ‘Show’, you will need to put this key in the ‘YOUR_SECRET_HERE’ embed code 2. Copy the embed code
  • 43. Add your embed code ■ Under Solution Explorer (on the right), find ‘default.htm’ ■ Paste the embed codeWITH your secret here.
  • 44. Re-Publish to Azure! 1. Right click your project  Publish 2. Now we should be able to navigate to our demobot.azurewebsites.net and see our bot!
  • 45. Ready for the world to use
  • 46. Thanks! ■ Check out my blog/tutorials! www.KSLHacks.com ■ dev.botframework.com ■ luis.ai ■ azure.microsoft.com/free ($200 credits) // Kevin Leung // MicrosoftTechnical Evangelist //Twitter: @KSLHacks (send questions here) // Github: KSLHacks

Editor's Notes

  1. aka.ms/fridgechatbot
  2. Create a new template Bot project Bot Emulator – Run template Add new RootDialog Prompt 2 Choices Update Name Update Twitter Handle
  3. You
  4. Create 2 intents Update Name Update Twitter Handle Create 2 entities Name Twitter Handle Train and publish
  5. Add LUIS Attribute (ID + Keys) Add Intents Utilize the two prompts Run on emulator
  6. Register with Bot Framework Dev Portal Add Id and Password Publish through Visual Studio Hit endpoint
  7. Register with Bot Framework Dev Portal Add Id and Password Publish through Visual Studio Hit endpoint
  8. Register with Bot Framework Dev Portal Add Id and Password Publish through Visual Studio Hit endpoint