SlideShare ist ein Scribd-Unternehmen logo
1 von 152
Downloaden Sie, um offline zu lesen
Elixir
+
CHATBOTS
ALL YOUR CHAT BELONG TO EX
WELCOME
WELCOME
WELCOME
AND I
AM
A
BOT BUILDER™
Tatsu
Tatsu
ABriefIn
tr
o
CHATBOTS
A COMPUTER PROGRAM DESIGNED TO
SIMULATE A CONVERSATION WITH HUMAN
USERS
CHATBOT
USER PLATFORM APP
OPS CHANNEL
/HELP
OPS CHANNEL
HERE IS THE HELP
YOU REQUESTED:
{ CHANNEL: ‘C1234’,
USER: ‘U8324’,
TEAM: ‘T4390’,
MESSAGE: ‘/HELP’ }
CHAT.POST_MESSAGE(‘HERE IS THE HELP YOU REQUESTED:’)
USER PLATFORM APP
CLIENT SERVER
J
os
eph
WEIZENBAUM
Alan
TURING
ELIZA
SIRI
2
0
0
7
2
0
0
1
RADIOHEAD
IS
ALWAYS
AHEAD OF THEIR TIME™
imp
or
tant?
CHATBOTS
Whyare
WHAT
OCCURRED
AT THAT
BASKETBALL GAME?
FAMILIAR
FAMILIAR
FAMILIAR LESS BARRIERS
MESSAGES SLACK
TEAMS FACEBOOK
BE WHERE YOUR USERS ARE
PLATFORM SPECIFIC
FUN STUFF
BUSINESS STUFF
MO’ MONEY
FUN
DEV CODE RUN BEEP-BOOP
builttoday?
CHATBOTS
Howare
HOW SLACK WORKS
A
P
P
D
I
R
E
C
T
O
R
Y
HOW SLACK WORKS
O
A
U
T
H
W
/
S
L
A
C
K
HOW SLACK WORKS
S
C
O
P
E
R
E
Q
U
E
S
T
HOW SLACK WORKS
N
E
W
B
O
T
U
S
E
R
!
USER PLATFORM APP
OPS CHANNEL
/HELP
HOW SLACK WORKS
{ CHANNEL: ‘C1234’,
USER: ‘U8324’,
TEAM: ‘T4390’,
MESSAGE: ‘/HELP’ }
JAVASCRIPT LIBRARIES
JAVASCRIPT LIBRARIES
WORKER THREADS
CPU PERFORMANCE
SINGLE-
THREADED
EVENT LOOP
UNHANDLED
EXCEPTIONS
NODE LIMITATIONS
Elixir?
Why
PROCESSES
PANACEA
CURES WHAT
ALES ‘YA
SPEED
HOT CODE
RELOADING
FAULT TOLERANCE
WHY ELIXIR?
BUILT FOR COMMUNICATION
WHY ELIXIR?
BUILT FOR COMMUNICATION
90%
WHY ELIXIR?
BUILT FOR COMMUNICATION
FAST
WHY ELIXIR?
WHY ELIXIR?
https://github.com/mroth/phoenix-showdown/blob/master/README.md#benchmarking
STATEFUL PROCESSES
WHY ELIXIR?
WHY ELIXIR?
PROCESS PROCESS PROCESS
SUPERVISOR
HOT CODE RELOADING
WHY ELIXIR?
WHY ELIXIR?
FAULT TOLERANT
WHY ELIXIR?
PROCESS PROCESS
SUPERVISOR
PROCESS
beimproved?
CHATBOTS
Howcanbuilding
PLUG
MIDDLEWARE
CONTEXT
ROUTER
CONTROLLER
TEMPLATES
JUVET/JUVET
NEXT.TATSU.IO
LEBOTSKI
LEBOTSKI
DISPENSARIES BOWLING ALLEYS
• COCKTAIL BARS
•
LEBOWSKI COMMANDS
/
B
E
V
E
R
A
G
E
-
H
E
R
E
-
M
A
N
LEBOTSKI
DISPENSARIES BOWLING ALLEYS
• COCKTAIL BARS
•
Aaron
DRAPLIN
DRAPLIN.COM
JWRIGHT/LEBOTSKI
DEMO
DEMO
DEMO
withJuvet?
CHATBOTS
Building
JUVET WALKTHROUGH
A
D
D
D
E
P
E
N
D
E
N
C
Y
JUVET WALKTHROUGH
A
D
D
E
X
T
R
A
A
P
P
JUVET WALKTHROUGH
S
U
P
E
R
V
I
S
I
O
N
T
R
E
E
JUVET WALKTHROUGH
S
U
P
E
R
V
I
S
I
O
N
T
R
E
E
NEW LEBOWSKI
APP FOR MY TEAM
JUVET WALKTHROUGH
C
O
N
F
I
G
U
R
E
JUVET WALKTHROUGH
B
O
T
JUVET WALKTHROUGH
R
O
U
T
E
R
JUVET WALKTHROUGH
A
D
D
P
L
U
G
PLUG
> LISTEN TO SPECIFIC ENDPOINTS
> INTEGRATE INTO EXISTING APP
JUVET WALKTHROUGH
A
D
D
C
O
M
M
A
N
D
R
O
U
T
E
ROUTER
> DSL TO DEFINE ROUTES
> FIND APPROPRIATE ROUTE
> MIDDLEWARE
ROUTER
F
I
N
D
I
N
G
R
O
U
T
E
S
ROUTER
F
I
N
D
I
N
G
R
O
U
T
E
S
MIDDLEWARE
> CHAIN RESPONSIBILITIES TOGETHER
> EXTENSION POINTS
> MODIFY CONTEXT
> COMMON RUNTIME ON EACH REQUEST
MIDDLEWARE
D
E
F
I
N
I
N
G
M
I
D
D
L
E
W
A
R
E
JUVET WALKTHROUGH
C
U
S
T
O
M
M
I
D
D
L
E
W
A
R
E
CONTEXT
> VARIABLES FOR USE IN CONTROLLER
> ONLY UPDATED IN MIDDLEWARE
JUVET WALKTHROUGH
R
O
U
T
E
R
JUVET WALKTHROUGH
C
O
N
T
R
O
L
L
E
R
CONTROLLER
> ACTION PER REQUEST
> PREPARE + SEND RESPONSE(S)
JUVET WALKTHROUGH
T
E
A
M
S
C
H
E
M
A
JUVET WALKTHROUGH
U
S
E
R
S
C
H
E
M
A
JUVET WALKTHROUGH
T
E
A
M
M
A
T
E
S
C
H
E
M
A
JUVET WALKTHROUGH
C
O
N
T
R
O
L
L
E
R
T
E
M
P
L
A
T
E
JUVET WALKTHROUGH
S
E
N
D
I
N
G
T
E
M
P
L
A
T
E
TEMPLATES
> PLATFORM INDEPENDENT
> SENT BACK AS A RESPONSE
> INTERLACE DATA
likeMVCApps
CHATBOTS
The
tr
adeo
ff
sonbuilding
ROUTING
A NICE
BLACK BOX
YOUR APP
ROUTER
CONTROLLERS
TEMPLATES
AUTHORIZATION
LOW-LEVEL API
PLATFORM LIBRARIES
HIDE THE PLUMBING
FAMILIAR PATTERN
MODEL
VIEW CONTROLLER
USER
SEES USES
MANIPULATES
UPDATES
EVERYTHING HAS A PLACE
TEMPLATES
CONTROLLERS
MODELS ROUTES
> BUSINESS LOGIC > HANDLES PLATFORM REQUESTS
> RUNS MIDDLEWARE
> PASSES CONTEXT
> CREATES CONTROLLER
> RUNS ACTION
> HANDLES REQUEST
> PREPARES RESPONSE
> RENDERS RESPONSE(S)
> RETRIEVE DATA
> UPDATE DATA
> INTEGRATES DATA
> PROVIDES RESPONSE
EXTENSION POINTS
USER
REQUEST
PLATFORM APP
ROUTER FINDS ROUTE
MIDDLEWARE IS RUN
CONTROLLER IS CREATED
ACTION IS CALLED
TEMPLATE IS RENDERED
RESPONSE IS SENT
USER
RESPONSE
OVERKILL FOR SIMPLE BROADCAST
PLATFORM
GITHUB
> CHAT.POSTMESSAGE
HARDER TO DEBUG
> (PHOENIX.ROUTER.NOROUTEERROR) NO ROUTE FOUND FOR POST /SLACK/ACTIONS (TATSUWEB.ROUTER)
> (TATSU 0.0.11) LIB/PHOENIX/ROUTER.EX:405: TATSUWEB.ROUTER.CALL/2
> (COWBOY 2.9.0) /TATSU_NEXT/DEPS/COWBOY/SRC/COWBOY_HANDLER.ERL:37: :COWBOY_HANDLER.EXECUTE/2
> (TATSU 0.0.11) LIB/TATSU_WEB/ENDPOINT.EX:1: TATSUWEB.ENDPOINT.PLUG_BUILDER_CALL/2
> …
> …
> …
> …
> …
> …
> …
C
A
L
L
S
T
A
C
K
Future
ENHANCEMENTS
DIALOGUE
DIALOGUE
R
U
B
Y
DIALOGUE
TATSUIO/DIALOGUE
ADDITIONAL PLATFORMS
TWILIO
TEAMS
DISCORD
SLACK
ALEXA
#01
#02
#03
#04
BETTER TEMPLATING
COMPONENTS PARTIALS SEPARATE PLATFORMS
IN-HOUSE AUTHENTICATION
GENERATORS
GENERATORS
BETTER ERROR MESSAGES
> (PHOENIX.ROUTER.NOROUTEERROR) NO ROUTE FOUND FOR POST /SLACK/ACTIONS (TATSUWEB.ROUTER)
> …
>…
> …
> …
> …
> …
> …
> ??? 💀😅
C
A
L
L
S
T
A
C
K
RANDOM ACCESS MEMORY
USER
CAN YOU
SCHEDULE
A MEETING?
APP
I SURE CAN.
WITH WHOM?
USER
WITH TIM.
APP
GOT IT. WHEN?
USER
TOMORROW AT 2.
APP
DONE.
I SCHEDULED A
MEETING WITH
TIM TOMORROW
AT 2.
RANDOM ACCESS MEMORY
CAN YOU SCHEDULE
A MEETING?
USER
CAN YOU SCHEDULE
A MEETING
WITH TIM
TOMORROW AT 2?
APP
DONE.
I SCHEDULED
YOUR MEETING
WITH TIM FOR
TOMORROW AT 2.
CAN YOU SCHEDULE
A MEETING?
USER
ACTUALLY CAN
YOU MAKE IT FOR 3?
APP
DONE.
I RE-SCHEDULED
IT FOR
TOMORROW AT 3.
RANDOM ACCESS MEMORY
DETECT PARAMETERS ALLOW CHANGE
DISCOVERABILITY
T
R
A
I
N
I
N
G
W
H
E
E
L
S
ARE YOU READY FOR
THE MEETING?
YOU CAN REPLY
WITH ‘Y’ES OR ’N’O.
APP USER
YES.
MEETING SCHEDULED!
DID YOU KNOW YOU
CAN REQUEST A RESCHEDULE
BY REPLYING
‘RE-SCHEDULE’?
APP
VALIDATION
ANDY WANTS TO MEET
WITH YOU TODAY AT 2.
APP
ARE YOU AVAILABLE?
USER
BLERG.
VALIDATION
I’M SORRY ‘BLERG’ IS
NOT AN ANSWER.
APP
ACKNOWLEDGE THE RESPONSE
1.
YOU CAN RESPOND ‘YES’
OR ‘NO’
APP
PROVIDE CORRECT OPTIONS
2.
ANDY WANTS TO MEET
WITH YOU TODAY AT 2.
APP
ARE YOU AVAILABLE?
RE-ASK THE QUESTION
3.
SELECTION
WHERE DO YOU WANT TO
MEET MACKENZIE
TONIGHT?
APP USER
1.
1. COFFEE SHOP
2. RESTAURANT
3. BAR
APP
O
P
T
I
O
N
R
E
D
U
C
T
I
O
N
SELECTION
OK. WHICH COFFEE
SHOP?
APP
O
P
T
I
O
N
R
E
D
U
C
T
I
O
N
1. CAFE JOE’S
2. STARBUCKS ON MAIN
3. PERKATORY
APP
RESPONSE SAMPLING
YES
APP
OK
APP
CORRECT
APP
WRONG
APP
NOPE
APP
LOOKS GOOD
APP
👍
APP
✌
APP
THAT’S WHAT SHE SAID
APP
COOL
APP
GO FORTH + CREATE BOTS
JUVET/JUVET
NEXT.TATSU.IO
SPEAKERDECK.COM/JWRIGHT/ATO2023
@JWRIGHT
JWRIGHT
JAMIE@BRILLIANTFANTASTIC.COM
STANDUP.FM
Q+A
@JWRIGHT
JWRIGHT
JAMIE@BRILLIANTFANTASTIC.COM
STANDUP.FM

Weitere ähnliche Inhalte

Mehr von All Things Open

Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
All Things Open
 
How to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractHow to Write & Deploy a Smart Contract
How to Write & Deploy a Smart Contract
All Things Open
 
Scaling Web Applications with Background
Scaling Web Applications with BackgroundScaling Web Applications with Background
Scaling Web Applications with Background
All Things Open
 
Build Developer Experience Teams for Open Source
Build Developer Experience Teams for Open SourceBuild Developer Experience Teams for Open Source
Build Developer Experience Teams for Open Source
All Things Open
 
Sudo – Giving access while staying in control
Sudo – Giving access while staying in controlSudo – Giving access while staying in control
Sudo – Giving access while staying in control
All Things Open
 
Fortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML ApplicationsFortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML Applications
All Things Open
 
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
All Things Open
 
System Design on Easy Mode
System Design on Easy ModeSystem Design on Easy Mode
System Design on Easy Mode
All Things Open
 

Mehr von All Things Open (20)

Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
 
The State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil NashThe State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil Nash
 
Total ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScriptTotal ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScript
 
What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?
 
How to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractHow to Write & Deploy a Smart Contract
How to Write & Deploy a Smart Contract
 
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
 Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
 
DEI Challenges and Success
DEI Challenges and SuccessDEI Challenges and Success
DEI Challenges and Success
 
Scaling Web Applications with Background
Scaling Web Applications with BackgroundScaling Web Applications with Background
Scaling Web Applications with Background
 
Supercharging tutorials with WebAssembly
Supercharging tutorials with WebAssemblySupercharging tutorials with WebAssembly
Supercharging tutorials with WebAssembly
 
Using SQL to Find Needles in Haystacks
Using SQL to Find Needles in HaystacksUsing SQL to Find Needles in Haystacks
Using SQL to Find Needles in Haystacks
 
Configuration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit InterceptConfiguration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit Intercept
 
Scaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship ProgramScaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship Program
 
Build Developer Experience Teams for Open Source
Build Developer Experience Teams for Open SourceBuild Developer Experience Teams for Open Source
Build Developer Experience Teams for Open Source
 
Deploying Models at Scale with Apache Beam
Deploying Models at Scale with Apache BeamDeploying Models at Scale with Apache Beam
Deploying Models at Scale with Apache Beam
 
Sudo – Giving access while staying in control
Sudo – Giving access while staying in controlSudo – Giving access while staying in control
Sudo – Giving access while staying in control
 
Fortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML ApplicationsFortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML Applications
 
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
 
Building AlmaLinux OS without RHEL sources code
Building AlmaLinux OS without RHEL sources codeBuilding AlmaLinux OS without RHEL sources code
Building AlmaLinux OS without RHEL sources code
 
Open Source evaluation: A comprehensive guide on what you are using
Open Source evaluation: A comprehensive guide on what you are usingOpen Source evaluation: A comprehensive guide on what you are using
Open Source evaluation: A comprehensive guide on what you are using
 
System Design on Easy Mode
System Design on Easy ModeSystem Design on Easy Mode
System Design on Easy Mode
 

Kürzlich hochgeladen

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Kürzlich hochgeladen (20)

2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 

All Your Chat Belong To Ex: Building Bots in Elixir