Build your own

Chatbot therapist

in F#

Chatbots

What is a chatbot?

a) rule-based
b) machine learning based

Rule-based chatbot

Match predefined rules to user input

Machine learning chatbot

I'm in London at Progressive F# tutorials.

Plan for today

  1. Build a rule-based chatbot locally.
  2. Deploy to Azure.
  3. Connect to Slack.
  4. ...
  5. Profit!

Chatbot therapist

Eliza

1964 to 1966, MIT Artificial Intelligence Laboratory

Joseph Weizenbaum

I had not realized… that extremely short exposures to a relatively simple computer program could induce powerful delusional thinking in quite normal people.

Joseph Weizenbaum
Computer Power and Human Reason: From Judgment To Calculation.

Eliza effect

Tendency to unconsciously assume computer behaviors are analogous to human behaviors.

How does Eliza work?

Pattern

Answers

Why do you need * ?
I need * Would it really help you to get * ?
Are you sure you need * ?

How does Eliza work? 🍰

Pattern

User input

I need * I need some cake

How does Eliza work? 🍰

User input

Answers

Why do you need some cake?
I need some cake Would it really help you to get some cake?
Are you sure you need some cake?

Pattern

User input

I need * I need some cake


Unification!

Find substitution that unifies two expressions

The whole process

  1. Get user input
  2. Find matching pattern
  3. Extract substitution
  4. Select answer and insert substitution
  5. Reply to user

What we're going to do:

  1. Parse input into words and wildcards
  2. Load data using Json type provider
  3. Write unification
  4. Insert substitution into answer and reply
  5. Deploy locally
  6. Deploy to Azure and use in Slack

Link to slides

evelinag.com/eliza

Give me your email

fseliza.slack.com


https://goo.gl/forms/weGhrcWi3nCRNUUB2

Download two github repositories

github.com/evelinag/eliza-tutorial

github.com/evelinag/eliza-slack

Deploying to Azure

The Deploy button

Azure portal: Deployment options

Integration

  • Custom integration
  • Slack App

Custom integration

  • Slash command
  • Bot users - Real Time Messaging API
  • App bot users - Real Time Messaging API, Events API

Slack integration

Slack commands

Slack integration

fseliza.slack.com

Learning more