Slide 1

Slide 1 text

Chatbots and Serverless: A match made in the Cloud Gillian Armstrong @virtualgill Cardiff ServerlessDays

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Gillian Armstrong @virtualgill Technologist Emerging Technology Liberty IT

Slide 4

Slide 4 text

2019 5% SOURCE: YouGov Custom Research, eMarketer Smart Speaker Ownership UK Households 10% 2018 2017 22%

Slide 5

Slide 5 text

2019 5% Smart Speaker Ownership UK Households 10% 2018 2017 22% Activations of Alexa devices crashed the servers on Christmas Day SOURCE: YouGov Custom Research, eMarketer

Slide 6

Slide 6 text

2019 5% Smart Speaker Ownership UK Households 10% 2018 2017 22% The world is changing fast ?? SOURCE: YouGov Custom Research, eMarketer

Slide 7

Slide 7 text

So we need to learn fast The world is changing fast

Slide 8

Slide 8 text

Change Fast Learn Fast use what we learn to so we can keep on learning

Slide 9

Slide 9 text

Change Fast Learn Fast Both Chatbots and Serverless let us and

Slide 10

Slide 10 text

What is a Chatbot??? ??? ??? ??? ???

Slide 11

Slide 11 text

For the purposes of this presentation... A Chatbot is something you can interact with conversationally using natural language - me

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

CHANNEL/DEVICE NLU NLP INTENTS ENTITIES I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX A very quick overview of a Chatbot using Conversational AI

Slide 14

Slide 14 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Machine Learning ASR TTS Utterance (“what the user said”) Conversational User Interface Fulfillment CUX/VUX ENTITIES

Slide 15

Slide 15 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX Utterance (“what the user said”) Automatic Speech Recognition (Speech to Text) Conversational User Interface ENTITIES

Slide 16

Slide 16 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX Utterance (“what the user said”) Automatic Speech Recognition (Speech to Text) Mapping of Utterance to Intent (“what the user meant”) Extraction of Entities (variables like time, place, number, etc) Conversational User Interface ENTITIES

Slide 17

Slide 17 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX Utterance (“what the user said”) Automatic Speech Recognition (Speech to Text) Mapping of Utterance to Intent (“what the user meant”) Extraction of Entities (variables like time, place, number, etc) Intent maps to Fulfillment (“what we need to do”) Conversational User Interface ENTITIES

Slide 18

Slide 18 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX Utterance (“what the user said”) Automatic Speech Recognition (Speech to Text) Mapping of Utterance to Intent (“what the user meant”) Extraction of Entities (variables like time, place, number, etc) Insert cool serverless architecture here Conversational User Interface ENTITIES Intent maps to Fulfillment (“what we need to do”)

Slide 19

Slide 19 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX Utterance (“what the user said”) Automatic Speech Recognition (Speech to Text) Mapping of Utterance to Intent (“what the user meant”) Extraction of Entities (variables like time, place, number, etc) Oh hey, there’s still UI design Insert cool serverless architecture here Conversational / Voice User Experience (“how we sound and the words we say”) Conversational User Interface ENTITIES Intent maps to Fulfillment (“what we need to do”)

Slide 20

Slide 20 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX Utterance (“what the user said”) Automatic Speech Recognition (Speech to Text) Text to Speech Mapping of Utterance to Intent (“what the user meant”) Extraction of Entities (variables like time, place, number, etc) Oh hey, there’s still UI design Insert cool serverless architecture here Conversational / Voice User Experience (“how we sound and the words we say”) Conversational User Interface ENTITIES Intent maps to Fulfillment (“what we need to do”)

Slide 21

Slide 21 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX Utterance (“what the user said”) Automatic Speech Recognition (Speech to Text) Text to Speech Mapping of Utterance to Intent (“what the user meant”) Extraction of Entities (variables like time, place, number, etc) Oh hey, there’s still UI design Insert cool serverless architecture here Conversational / Voice User Experience (“how we sound and the words we say”) Conversational User Interface ENTITIES Intent maps to Fulfillment (“what we need to do”)

Slide 22

Slide 22 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX Design it so a Human can understand it Train your Bot to understand Humans Write code to make it do something! 1 2 3 What we need to do… ENTITIES

Slide 23

Slide 23 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX Design it so a Human can understand it Train your Bot to understand Humans Write code to make it do something! 1 2 3 What we need to do… Often starting point and focus ENTITIES

Slide 24

Slide 24 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX Design it so a Human can understand it Train your Bot to understand Humans Write code to make it do something! 1 2 3 What we need to do… Often starting point and focus Hardcoded and then panic-written after that well-received demo ENTITIES

Slide 25

Slide 25 text

CHANNEL/DEVICE NLU NLP INTENTS I n t e r a c t i o n M o d e l Fulfillment Machine Learning ASR TTS CUX/VUX Design it so a Human can understand it Train your Bot to understand Humans Write code to make it do something! 1 2 3 What we need to do… Often starting point and focus Hardcoded and then panic-written after that well-received demo Forgotten ENTITIES

Slide 26

Slide 26 text

Design it so a Human can understand it 1

Slide 27

Slide 27 text

In a chatbot, Conversation is the Interface

Slide 28

Slide 28 text

Source: http://hosanna1.com/ Not a CSS and HTML problem! Design Matters!

Slide 29

Slide 29 text

Up to now we’ve kept designing based on what came before

Slide 30

Slide 30 text

We’ve carried the concept of menus and commands into our graphical user interfaces

Slide 31

Slide 31 text

We base our web forms on the paper forms that came before

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

Model your design on a human, not a website People are the original conversational interface

Slide 34

Slide 34 text

https://bit.ly/2S8UzCc 1-minute Conversational Design Guide:

Slide 35

Slide 35 text

Train your Bot to understand Humans 2

Slide 36

Slide 36 text

Amazon Lex Console What the Web Tutorials told me building a chatbot looked like…

Slide 37

Slide 37 text

BOOK MEETING Intent Utterance SAY HELLO GET HELP Fulfillment

Slide 38

Slide 38 text

Intent Utterance As simple providing a set of sample utterances! Book Meeting at

Slide 39

Slide 39 text

Amazon Lex Console SET OF INTENTS Represents the functionality the bot has SAMPLE UTTERANCES Examples of what a user might say to trigger this Intent. This is training data - not a regex match.

Slide 40

Slide 40 text

Amazon Lex Console SLOTS (ENTITIES) are defined showing type (place, name, time, custom, etc.) If the user does not supply this data the bot knows to prompt for it. The sample utterances show where to expect the data to be supplied in an utterance

Slide 41

Slide 41 text

FULFILLMENT location defined. Intent and Slot matches will be sent to this lambda or returned directly to client. Amazon Lex Console

Slide 42

Slide 42 text

Amazon Lex Console Publish to make the functionality live to users. Build to create the Interaction Model

Slide 43

Slide 43 text

Amazon Lex Console Built-in Test Console allows you to test directly here after building, but before publishing.

Slide 44

Slide 44 text

Amazon Lex Console Easy to connect your bot to popular channels through console.

Slide 45

Slide 45 text

Amazon Lex Console Chatbot Done…?

Slide 46

Slide 46 text

Sorry, I’m just a baby bot. I’m still learning.

Slide 47

Slide 47 text

Sorry, I’m just a baby bot. I’m still learning. are you?

Slide 48

Slide 48 text

Intent Utterance As simple providing a set of sample utterances! Book Meeting at

Slide 49

Slide 49 text

Intent Utterance As complex as providing a set of sample utterances! Book Meeting at

Slide 50

Slide 50 text

Track metrics and review conversation to improve your Bot Interaction Model. Learn Fast Sorry, I’m just a baby bot. I’m still learning. Change Fast

Slide 51

Slide 51 text

Look for Vocabulary used Should we add new synonyms Look for the Utterance Structure Should we add new training data Look for Interaction Patterns Can we improve the conversation flow Learn Fast Change Fast Reviewing Conversation Transcripts…

Slide 52

Slide 52 text

Write code to make it do something! 3

Slide 53

Slide 53 text

Pop a lambda here – and you’re done!

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

CONTEXT CONVERSATION SESSION CHAT STREAM ANALYTICS NLP + INTENT MAPPING FULFILLMENT … Amazon Lex Amazon VPC AWS Direct Connect AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB AWS Lambda Amazon CloudWatch Amazon ES IAM Amazon Polly Amazon S3 AWS X-Ray Amazon API Gateway Amazon Athena Amazon S3 Amazon API Gateway THE DIGITAL ASSISTANT BOT PLATFORM ARCHITECTURE

Slide 57

Slide 57 text

CONTEXT CONVERSATION SESSION … AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB IAM AWS X-Ray Amazon API Gateway THE DIGITAL ASSISTANT BOT PLATFORM ARCHITECTURE

Slide 58

Slide 58 text

CONTEXT CONVERSATION SESSION NLP + INTENT MAPPING … Amazon Lex AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB IAM Amazon Polly AWS X-Ray Amazon API Gateway THE DIGITAL ASSISTANT BOT PLATFORM ARCHITECTURE

Slide 59

Slide 59 text

CONTEXT CONVERSATION SESSION NLP + INTENT MAPPING FULFILLMENT … Amazon Lex Amazon VPC AWS Direct Connect AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB AWS Lambda IAM Amazon Polly Amazon S3 AWS X-Ray Amazon API Gateway THE DIGITAL ASSISTANT BOT PLATFORM ARCHITECTURE

Slide 60

Slide 60 text

CONTEXT CONVERSATION SESSION CHAT STREAM ANALYTICS NLP + INTENT MAPPING FULFILLMENT … Amazon Lex Amazon VPC AWS Direct Connect AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB AWS Lambda Amazon CloudWatch Amazon ES IAM Amazon Polly Amazon S3 AWS X-Ray Amazon API Gateway Amazon Athena Amazon S3 Amazon API Gateway THE DIGITAL ASSISTANT BOT PLATFORM ARCHITECTURE

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

Number of conversations Length of conversations Functionality being used Number of Users What people want us to add Where we are getting it right Where we are getting it wrong Examples of our Conversational Analytics

Slide 63

Slide 63 text

CONTEXT CONVERSATION SESSION CHAT STREAM ANALYTICS NLP + INTENT MAPPING FULFILLMENT … Amazon Lex Amazon VPC AWS Direct Connect AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB AWS Lambda Amazon CloudWatch Amazon ES IAM Amazon Polly Amazon S3 AWS X-Ray Amazon API Gateway Amazon Athena Amazon S3 Amazon API Gateway THE DIGITAL ASSISTANT BOT PLATFORM ARCHITECTURE

Slide 64

Slide 64 text

Observability is critical This lets you quickly learn where there might be problems with your system.

Slide 65

Slide 65 text

Why Serverless??

Slide 66

Slide 66 text

Lower Cost lets us Change Fast Learn Fast Off-loading Maintenance lets us

Slide 67

Slide 67 text

Being able to change quickly is vital, so you can keep improving your bot’s understanding and add new functionality.

Slide 68

Slide 68 text

Serverless means you don’t pay if no-one talks to your bot…

Slide 69

Slide 69 text

Serverless means you don’t pay if no-one talks to your bot… …and lets you scale seamlessly if everyone wants to talk to your bot!

Slide 70

Slide 70 text

Lambdas are quick to develop, isolate small pieces of functionality and allow you to scale different parts of the conversation independently.

Slide 71

Slide 71 text

Both Serverless and Chatbots might require new ways of thinking about your architecture.

Slide 72

Slide 72 text

A good human conversation is synchronous

Slide 73

Slide 73 text

A good human conversation is synchronous You wait for a response

Slide 74

Slide 74 text

A good human conversation is synchronous You wait for a response You expect a response

Slide 75

Slide 75 text

A good human conversation is synchronous You wait for a response You expect a response immediately

Slide 76

Slide 76 text

A Conversational Architecture needs to - Be fast! - Appear synchronous to the user (there should be a response) This is particularly critical for a voice-based bot

Slide 77

Slide 77 text

invoke invoke invoke Combining the time to invoke and the time to ‘spin up’ can hit performance and add complexity to your system. Before you “keep warm” look at combining lambdas or pulling reusable code into libraries rather separate lambdas Be careful how far you decompose…

Slide 78

Slide 78 text

Ensure that everything scales - or at least know your limits. API Lambda functions Amazon DynamoDB

Slide 79

Slide 79 text

CHANGE FAST LEARN FAST We get there iteratively by being able to and

Slide 80

Slide 80 text

CHANGE FAST LEARN FAST We get there iteratively by being able to and but Good Supporting Engineering Practices are needed to do both with confidence and at scale

Slide 81

Slide 81 text

Amazon Lex Console What the Web Tutorials told me building a chatbot looked like…

Slide 82

Slide 82 text

CODE HERE Fulfillment in Code

Slide 83

Slide 83 text

CODE HERE CODE HERE Bot Interaction Model in Code

Slide 84

Slide 84 text

CODE HERE CODE HERE CODE HERE Design in Code

Slide 85

Slide 85 text

CODE HERE CODE HERE CODE HERE CODE HERE CODE HERE CODE HERE CODE HERE Infrastructure in Code

Slide 86

Slide 86 text

CODE HERE EVERYTHING in Code CODE HERE CODE HERE CODE HERE CODE HERE CODE HERE CODE HERE

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

CONTEXT CONVERSATION SESSION CHAT STREAM ANALYTICS NLP + INTENT MAPPING FULFILLMENT … Amazon Lex Amazon VPC AWS Direct Connect AWS Lambda AWS Lambda Amazon DynamoDB Amazon DynamoDB AWS Lambda Amazon CloudWatch Amazon ES IAM Amazon Polly Amazon S3 AWS X-Ray Amazon API Gateway Amazon Athena Amazon S3 Amazon API Gateway THE DIGITAL ASSISTANT BOT PLATFORM ARCHITECTURE

Slide 89

Slide 89 text

Conversation as Code - Amazon Lex Fully Validated and Repeatable Bot Build and Deploy to any AWS Account Everything written in CFN, with JSON for API calls to Amazon Lex Model Building API as part of deploy Local and Pre-Commit Hook Tests • Unit Test • Lambdas • Libraries • Static analysis • Cloud Formation • Code • JSON for API calls

Slide 90

Slide 90 text

Conversation as Code - Amazon Lex Fully Validated and Repeatable Bot Build and Deploy to any AWS Account Everything written in CFN, with JSON for API calls to Amazon Lex Model Building API as part of deploy Code push triggers tests, and automatic build and deploy across multiple environments Build Tests • Unit Test • Lambdas • Libraries • Static analysis • Cloud Formation • Code • JSON for API calls

Slide 91

Slide 91 text

Conversation as Code - Amazon Lex Fully Validated and Repeatable Bot Build and Deploy to any AWS Account Everything written in CFN, with JSON for API calls to Amazon Lex Model Building API as part of deploy Code push triggers tests, and automatic build and deploy across multiple environments All tests, builds, deploys and alarms sent to Slack channels to alert developers immediately

Slide 92

Slide 92 text

Conversation as Code - Amazon Lex Fully Validated and Repeatable Bot Build and Deploy to any AWS Account Everything written in CFN, with JSON for API calls to Amazon Lex Model Building API as part of deploy Code push triggers tests, and automatic build and deploy across multiple environments AWS CloudFormation Templates Amazon S3 deployment bucket Amazon Lex Model Building Service Botbuilder Lambda function Packaged Fulfillment Lambdas Bot JSON files

Slide 93

Slide 93 text

Conversation as Code - Amazon Lex Fully Validated and Repeatable Bot Build and Deploy to any AWS Account Everything written in CFN, with JSON for API calls to Amazon Lex Model Building API as part of deploy Code push triggers tests, and automatic build and deploy across multiple environments All tests, builds, deploys and alarms sent to Slack channels to alert developers immediately Deploy Tests • Smoke Tests • Component Tests (Lex) Non-Prod Only

Slide 94

Slide 94 text

Conversation as Code - Amazon Lex Fully Validated and Repeatable Bot Build and Deploy to any AWS Account Everything written in CFN, with JSON for API calls to Amazon Lex Model Building API as part of deploy Code push triggers tests, and automatic build and deploy across multiple environments All tests, builds, deploys and alarms sent to Slack channels to alert developers immediately Fully tested new functionality available in minutes

Slide 95

Slide 95 text

Conversation as Code - Amazon Lex Fully Validated and Repeatable Bot Build and Deploy to any AWS Account Everything written in CFN, with JSON for API calls to Amazon Lex Model Building API as part of deploy Code push triggers tests, and automatic build and deploy across multiple environments All tests, builds, deploys and alarms sent to Slack channels to alert developers immediately Live Analytics ‘Live’ Tests - APM • Alarms • Cloudwatch metrics and Dashboards • Centralized Logging • Tracing

Slide 96

Slide 96 text

Conversation as Code - Amazon Lex Fully Validated and Repeatable Bot Build and Deploy to any AWS Account Everything written in CFN, with JSON for API calls to Amazon Lex Model Building API as part of deploy Code push triggers tests, and automatic build and deploy across multiple environments Live Analytics ‘Live’ Tests - APM • Alarms • Cloudwatch metrics and Dashboards • Centralized Logging • Tracing

Slide 97

Slide 97 text

Know Fast Code Quality Conversational Analytics User Feedback Application Monitoring Learn Fast FAST FEEDBACK LOOP

Slide 98

Slide 98 text

Conversational UI is about Listening to what the user wants to do… CHANGE FAST LEARN FAST

Slide 99

Slide 99 text

Conversational UI is about Listening to what the user wants to do… CHANGE FAST LEARN FAST …and that’s the secret to a great chatbot!

Slide 100

Slide 100 text

Got questions? Let’s chat! @virtualgill KEY TAKEAW AYS • Model your Chatbot UI and Architecture based on observing Humans and real Conversation. Break out of old mindsets! • New tech still needs the good engineering practices you already know virtualgill.io