Make Your Own Chatbot

— A Workshop Led by Carrie Sijia Wang

In this artist-led workshop, participants will learn to use simple coding to build their own chatbots. The aim of this workshop is to explore the different roles Artificial Intelligence plays in human society in the process of creating and personalizing chatbots.

01. Chatbots

Definition of a Chatbot

A computer, program, algorithm or artificial intelligence which communicates with a person or another participant of the communication can be called a chatbot. The aim is usually to make users feel that they are conversing with a living person.

Source

Chatbots in Art

02. What We are Doing in this Workshop

A Chatbot That Responds to Our Emotions

03. Tools We are Using

From the Tech Kit

We will be using the iPad like a computer, the USB hub, and the mouse.

For Programming

We will use the p5,js web editor and Rivescript to program and share the chatbots. Both are open source tools that are free to use.

p5.js Web Editor

A web editor for p5.js, a JavaScript library with the goal of making coding accessible to artists, designers, educators, and beginners. Sign up for an account here: https://editor.p5js.org/signup

RiveScript

A simple scripting language for chatbots with a friendly, easy to learn syntax. Learn more about RiveScript here: https://www.rivescript.com/docs/tutorial

04. Let’s Start Coding

  • Create a free account with the p5 web editor.
  • Log in to your p5 account.
  • Copy, duplicate, and save this Plain RiveScript Chatbot Template.
  • Practice writing simple conversations in the .txt file with RiveScript Commands (see cheat sheet below).
  • Copy, duplicate, and save the Friendly Bot Template.
  • Modify the lines in the .txt file to create a chatbot that says what you want to hear based on how you feel.

Simple RiveScript Commands

Important: In RiveScript, triggers are ALWAYS lowercased & without punctuations.

Simple Trigger and Response:
+ trigger (what the user says)
– response (what the chatbot says)
– alternative response (the program will randomly select from the responses)

Keyword Triggers:
+ [*] keyword [*]

Alternative Triggers:
+ (trigger one|trigger two| trigger three)

Catchall Trigger:
+ *
– catchall response

Wildcard:
+ my name is *
– Hi <star>! How are you?

Remember User Variable:
+ my name is *
– <set username=<formal>>Hello, <get username>.

Short Discussion: use % to check the bot’s previous response to determine how the bot respond to the user’s next trigger. For example:

+ hello
– What’s your name?

+ [my name is|i am] *
% what is your name
– Nice to meet you, <star>.

Topics: logical groupings of triggers. When the user’s in a topic, they can only match triggers within the topic. For example:

+ i hate you
– You’re really mean! I’m not talking again until you apologize.{topic=sorry}

> topic sorry

+ [*] sorry [*]
– It’s OK, I’ll forgive you!{topic=random}

+ *
– Nope, not until you apologize.
– Say you’re sorry!
– Apologize!

< topic