Step by Step

I Programmed My Own AI App to Tell Knock-Knock Jokes and This Is How It Went

Coding might not be for everybody but this tool for conversational AI development is.

Anna Cranfordová
PromethistAI

--

Do you feel panic and fear whenever you hear the words “IT”, “artificial intelligence”, “code” or “programming”? If the answer is yes, this article is for you. If the answer is no, you are kindly invited to read on anyway because it is for you too.

PromethistAI is a startup that aims to make conversational AI programming easy and accessible by simplifying the interface of their open-source platform as much as possible so that people without any background in AI or IT can design their own applications. I am one of those people — a liberal arts student who has only just started working for PromethistAI as a copywriter without any previous experience with technology development—and this is how I programmed mine.

The Promethist Platform

All you need to create your own application is to go to the Promethist Platform in your browser and sign in. You can do so with your email address or with one of your existing Google, Facebook, or Twitter accounts. This way you will have your own space on the platform where you can get back to your saved work.

When the platform opens you will see a series of hints telling you the functions of all the buttons. You can either read them all or, if you like living on the edge, skip them, experiment by trial and error and see where it takes you. There is also a video tutorial on how to create your first application, which is very helpful. I used it as a step-by-step manual when I created mine, pausing the video while copying each step.

How to Create Your First Application

To create your first dialogue which will become the base of the application you need to open the Dialogue Designer. On the left, you will see a list of nodes and in the middle of the screen is where all the magic happens — an infinite canvas.

Dialogue Designer

Conversation Design

The programming itself is very easy. The way the Promethist Platform works means you do not have to know any coding. All you do is pick the node you need, drag, and drop it on the canvas. Then, by adding a node after node, you build a sort of a puzzle, connecting the nodes with transition lines.

The hardest part of the whole process is to understand what nodes you need to use and in what order, but the video tutorial shows you all the necessary basics and the rest is quite intuitive and easy to comprehend because there is logic to everything. However, if you do not know how to do something, the PromethistAI team is always happy to help.

The Promethist Platform is great because it allows you to use premade, reusable assets — pieces of dialogue that recur often and can be applied in basically any conversation. Using these assets saves a lot of time — but we will get to that.

How to build a simple dialogue

First I designed a simple dialogue following the video tutorial. The tutorial shows that the basic nodes you need are Enter, Speech, User Input, Intent, and Exit.

The Speech node contains what the AI says, and Intent is what the user says. The content of the nodes is edited by clicking on them and typing into the context panel on the right side, so for the first Speech node I wrote: “Knock, knock.”

Enter and Speech nodes

After the Speech node comes the User Input node, which signals to the AI that it should listen because the speaker is about to say something. Right after User Input has to come the Intent node, which contains the expected answer of the user. In this instance the only possible answer of the user is “Who’s there?” (supposing they know how knock-knock jokes work) which made the process significantly easier than in cases of questions with many possible answers. Again, I type the text into the context panel.

User Input and Intent nodes

Then another Speech node needs to be inserted as it is the AI’s turn to speak. Here it says the “name” of the person behind the door as it were, such as “Art.” What follows is again User Input and Intent, with only one possible option: “Art who?”

Can you guess what comes next? Yes, a Speech node with the text “Artificial Intelligence!”

This way I included ten different jokes at the same point in the dialogue graph. Only after I tried the finished app out I found that it tells me the same joke every time. I asked a member of the PromethistAI team what to do and was advised to add the Function node that ensures that the AI chooses a joke randomly every time.

Function node

The last node of every dialogue is Exit, and all the nodes in the dialogue need to be connected in the order just described. The transition line between two nodes is created by clicking on the port of one node and dragging the line to the port of another node.

There was a second problem that I didn’t know how to deal with, so I asked again and received another quick, helpful answer. The problem was that the AI didn’t know how to react when the user doesn’t say anything during their turn. The solution was very simple. What needed to be done was to drop the Global Action node anywhere on the canvas and write “silence” as its property in the context panel, connect it to a Speech node saying “I didn’t hear you, let me repeat what I said.” and finally add the Go Back node. This ensures that the AI will know how to react to silence from the user at any point in the conversation.

Silence and Go Back nodes

The video tutorial also shows how to save the dialogue and how to create a new, shareable application including this dialogue.

The whole process of building this dialogue took me about two hours, from watching the video to listening to my computer tell me jokes that I had just taught it. The total time could have definitely been a lot shorter had I not spent so much time searching for the least painful knock-knock jokes on the internet.

Reusable content

Afterwards I wanted to upgrade my dialogue so I added a part at the beginning where the AI asks whether the user wants to hear a joke. This is where reusable content comes in handy. Even though the answer to a question like this is either yes or no, these two meanings can be expressed in many ways by the user and the AI needs to know all of them to react appropriately.

The Promethist Platform has ready-made categories of answers that are called mixins and you will find them on the left side of the editor next to the list of the basic nodes. As my question is in fact a proposal, I chose the mixin Proposal_YES for the positive answer and Poposal_NO for the negative. The mixins are placed in the dialogue where the usual Intent nodes would be and they include all the possible ways of expressing “yes” and “no” so that we don’t have to think of them ourselves and type them all manually.

Reusable Mixins

The last feature I added was that after the joke, the AI asks whether the user wants to hear another one, using the same mixins just described. The transition line from the affirmative mixin leads back to the “Knock, knock” Speech node at the beginning, which means the cycle starts again and the user can listen to yet another knock-knock joke and they can keep on doing this forever.

Final look

This is the final look of my app. As you have just seen, truly anybody can design their own conversational AI application with the use of the Promethist Platform. It does not look so scary anymore, does it? So create your own app too!

You can try mine here:

Would you like to follow our journey? Follow us on Facebook, Twitter, YouTube, Instagram, and LinkedIn.

Check out the Promethist Platform for creating smart conversational AI applications and virtual personas.

Enjoyed the article? Click the 👏 below to recommend it to other interested readers!

--

--