Clever data: Building a chatbot
from your database
Luis Beltrán
Luis Beltrán
• Microsoft MVP in AI & Developer Technologies
• Researcher at Tomás Bata University in Zlín, Czech
Republic.
• Professor at Tecnológico Nacional de México in
Celaya, Mexico.
@darkicebeam
luis@luisbeltran.mx
Agenda
• Chatbots Introduction
• Microsoft Bot Framework
• Adding your data into your bot
• Demo
Chatbots Introduction
Chatbots:
• Conversational bots.
• Background tasks.
• Availability 24/7/365.
• AI-powered. A bot detects users’
intentions and is capable of
combining millions of data
from different sources.
Pattern: Knowledge Base Bots
Fuzzy Searching
Filtering to guide a conversation
Generating search queries from natural language
Pattern: Handoff to Human
Every company deals with this:
First
triage/data
collection
Simple and
repetitive
solutions
If it is simple and repetitive, it can
be coded. Bots can accelerate it
Thank you for providing all this information. I
have John with me now who will take from here
and help you out
Hello, this is John. I understand your computer
won’t power on. Let’s take a look at some
service options
I’ve tried these steps, my computer still won’t turn on
Sounds lovely, thank you
I suggest us to request a hardware service. We can have one
of our service engineers look at your computer
Note to operator: It sounds like the user will need hardware
replacement, what next step should I take?
Apologize to
user
Suggest
hardware
service
Let me type
Bot to human
hand-off:
Complete or
supervised
Microsoft Bot Framework
Goals
• Start Simple. Add Complexity. No dead-ends.
• Bot adapts to the user, based on context
• Composable and intelligent controls to manage complexity
Bot Controls
LUIS
Query over database via
Azure Search
Form
Filling
QnA
C#
Customer’s
Business Logic
& DataBot Connector
Cortana Direct Line
What?
• Tools for building REST Web Sites
• Services to enrich
• Mechanisms for receive events
• Data to debug and analyze
Why?
• Implements standard protocols
• Modeling conversations is hard. Tools help!
• UI across multiple canvases is hard. Cards rock!
• Language Understanding is hard
• Common and well understood patterns
What is Microsoft Bot Framework?
An x-ray of a typical bot
Bot web service
Your bot code
Entity
Extraction
Speech
Vision/Face
Natural
Language
Translation
+ Microsoft Cognitive Services
Search
Emotion
Knowledge
API
…
Message input <> output
State Management
Bot Connector Service
Conversation Canvas/Channels
……
…
Other services, APIs,
Databases, Azure Machine
Learning, Azure Search,
etc…
Bot Builder SDK
Web Chat
Direct Line…
Email
Facebook
GroupMe
Kik
Skype
Slack
Telegram
Twilio (SMS)
Bot Builder SDK
Your bot code goes here
Bot Connector Messages
Your bot
{
"type": "Message",
"id": "68YrxgtB53Y",
"conversationId": "DphPaFQrDuZDKyCez4AFGcT4vy5aQDje1lLGIjB8v18MFtb",
"language": "en",
"text": "You can say "/order" to order!",
"attachments": [ ],
"from": {
"name": "+12065551212",
"channelId": "sms",
"address": "+12065551212",
"id": "Ro52hKN287",
"isBot": false
},
"channelData": { SMS data here },
"botUserData": { your data here },
...
}
Bot
Connector
Bot Builder
SDK
Template
Your Bot LUIS
Publish to
Azure
Connect to
users
Add dialog
smarts
Bot Builder SDK Template
LUIS (Language Understanding Intelligent
Service)
Trains utterances (examples) into a REST API
Maps utterances to intents (verbs) and extracts entities
“I want to find
news about flight
delays”
{
“entities”: [
{
“entity”: “flight delays”,
“type”: “Topic”
}
],
“intents”: [
{
“intent”: “FindNews”,
“score”: 0.99853384
},
{
“intent”: “None”,
“score”: 0.07289317
},
{
“intent”: “ReadNews”,
“score”: 0.0167122427
},
{
“intent”: “ShareNews”,
“score”: 1.0919299E-06
}
]
}
Publish to Azure
Connect to users
Add Dialog Smarts with Adaptive Cards
Notification Microsoft Teams Skype Android iOS
Adding your data into your bot
Database (SQL Server, Azure SQL, Oracle, …)
Access to your database (REST API, GraphQL, …)
Bot project – Understand user messages (1)
LUIS – Intents, Entities and Utterances
LUIS – Intents, Entities and Utterances
Bot project – Send user messages to LUIS (2)
Bot project - Translate user messages into
API calls (3)
Bot project - Translate user messages into
API calls (4)
Profit!
Demo
https://github.com/icebeam7/SQLSaturdayPragueMobileBot
https://github.com/icebeam7/SQLSaturdayPragueBot
https://github.com/icebeam7/SQLSaturdayPragueWebApi
Bot Scenarios
• Q & A
• Helpdesk
• Product selection
• Task automation
• Monitoring
• Expert Systems
Call to Action
• Microsoft Bot Framework https://dev.botframework.com/
• Azure Cognitive Services https://microsoft.com/cognitive
• Bot Builder http://github.com/Microsoft/botbuilder
• LUIS https://luis.ai
• Docs https://aka.ms/azure/bots/overview/docs
Luis Beltrán
Tomás Bata University in Zlín
Tecnológico Nacional de México en Celaya
luis@luisbeltran.mx luisbeltran.mx @darkicebeam
Thank you for your attention!
Let’s connect! ☺
icebeam darkicebeam luisantoniobeltran
icebeam7 about.me/luis-beltran
Clever data: building a chatbot from your database

Clever data: building a chatbot from your database

  • 2.
    Clever data: Buildinga chatbot from your database Luis Beltrán
  • 3.
    Luis Beltrán • MicrosoftMVP in AI & Developer Technologies • Researcher at Tomás Bata University in Zlín, Czech Republic. • Professor at Tecnológico Nacional de México in Celaya, Mexico. @darkicebeam luis@luisbeltran.mx
  • 4.
    Agenda • Chatbots Introduction •Microsoft Bot Framework • Adding your data into your bot • Demo
  • 5.
  • 7.
    Chatbots: • Conversational bots. •Background tasks. • Availability 24/7/365. • AI-powered. A bot detects users’ intentions and is capable of combining millions of data from different sources.
  • 8.
    Pattern: Knowledge BaseBots Fuzzy Searching Filtering to guide a conversation Generating search queries from natural language
  • 9.
    Pattern: Handoff toHuman Every company deals with this:
  • 10.
    First triage/data collection Simple and repetitive solutions If itis simple and repetitive, it can be coded. Bots can accelerate it
  • 11.
    Thank you forproviding all this information. I have John with me now who will take from here and help you out Hello, this is John. I understand your computer won’t power on. Let’s take a look at some service options I’ve tried these steps, my computer still won’t turn on Sounds lovely, thank you I suggest us to request a hardware service. We can have one of our service engineers look at your computer Note to operator: It sounds like the user will need hardware replacement, what next step should I take? Apologize to user Suggest hardware service Let me type Bot to human hand-off: Complete or supervised
  • 12.
  • 13.
    Goals • Start Simple.Add Complexity. No dead-ends. • Bot adapts to the user, based on context • Composable and intelligent controls to manage complexity Bot Controls LUIS Query over database via Azure Search Form Filling QnA C# Customer’s Business Logic & DataBot Connector Cortana Direct Line What? • Tools for building REST Web Sites • Services to enrich • Mechanisms for receive events • Data to debug and analyze Why? • Implements standard protocols • Modeling conversations is hard. Tools help! • UI across multiple canvases is hard. Cards rock! • Language Understanding is hard • Common and well understood patterns What is Microsoft Bot Framework?
  • 14.
    An x-ray ofa typical bot Bot web service Your bot code Entity Extraction Speech Vision/Face Natural Language Translation + Microsoft Cognitive Services Search Emotion Knowledge API … Message input <> output State Management Bot Connector Service Conversation Canvas/Channels …… … Other services, APIs, Databases, Azure Machine Learning, Azure Search, etc… Bot Builder SDK Web Chat Direct Line… Email Facebook GroupMe Kik Skype Slack Telegram Twilio (SMS) Bot Builder SDK Your bot code goes here
  • 15.
    Bot Connector Messages Yourbot { "type": "Message", "id": "68YrxgtB53Y", "conversationId": "DphPaFQrDuZDKyCez4AFGcT4vy5aQDje1lLGIjB8v18MFtb", "language": "en", "text": "You can say "/order" to order!", "attachments": [ ], "from": { "name": "+12065551212", "channelId": "sms", "address": "+12065551212", "id": "Ro52hKN287", "isBot": false }, "channelData": { SMS data here }, "botUserData": { your data here }, ... } Bot Connector
  • 16.
    Bot Builder SDK Template Your BotLUIS Publish to Azure Connect to users Add dialog smarts
  • 17.
  • 18.
    LUIS (Language UnderstandingIntelligent Service) Trains utterances (examples) into a REST API Maps utterances to intents (verbs) and extracts entities
  • 19.
    “I want tofind news about flight delays” { “entities”: [ { “entity”: “flight delays”, “type”: “Topic” } ], “intents”: [ { “intent”: “FindNews”, “score”: 0.99853384 }, { “intent”: “None”, “score”: 0.07289317 }, { “intent”: “ReadNews”, “score”: 0.0167122427 }, { “intent”: “ShareNews”, “score”: 1.0919299E-06 } ] }
  • 20.
  • 21.
  • 22.
    Add Dialog Smartswith Adaptive Cards Notification Microsoft Teams Skype Android iOS
  • 23.
    Adding your datainto your bot
  • 24.
    Database (SQL Server,Azure SQL, Oracle, …)
  • 25.
    Access to yourdatabase (REST API, GraphQL, …)
  • 26.
    Bot project –Understand user messages (1)
  • 27.
    LUIS – Intents,Entities and Utterances
  • 28.
    LUIS – Intents,Entities and Utterances
  • 29.
    Bot project –Send user messages to LUIS (2)
  • 30.
    Bot project -Translate user messages into API calls (3)
  • 31.
    Bot project -Translate user messages into API calls (4)
  • 32.
  • 33.
  • 34.
  • 35.
    Bot Scenarios • Q& A • Helpdesk • Product selection • Task automation • Monitoring • Expert Systems
  • 36.
    Call to Action •Microsoft Bot Framework https://dev.botframework.com/ • Azure Cognitive Services https://microsoft.com/cognitive • Bot Builder http://github.com/Microsoft/botbuilder • LUIS https://luis.ai • Docs https://aka.ms/azure/bots/overview/docs
  • 38.
    Luis Beltrán Tomás BataUniversity in Zlín Tecnológico Nacional de México en Celaya luis@luisbeltran.mx luisbeltran.mx @darkicebeam Thank you for your attention! Let’s connect! ☺ icebeam darkicebeam luisantoniobeltran icebeam7 about.me/luis-beltran