Now, we’ve already talked about bots and the benefits of using them.
By Iffy Kukkoo
12 Jul, 2017
Now, we’ve already talked about bots and the benefits of using them.
But, have you ever wondered if you can directly contribute to the creation of one? Yes, we’re talking about an artificial mind! And, no, we’re not just selling this article: we’re really saying that you can start developing one today.
In fact, the chances are that you may already know something about the technology. Especially, if you’re reading us. (If not, you may be interested in finding a bit more about how to approach machine learning, about its basics, some of its more advanced forms and future prospects, but also about some relevant limitations).
We’re nice people and we tend not to hold any grudges if it’s your first time here. We’ll be gentle and walk you through the process step by step.
So, let’s go and find out if you need a smart virtual assistant and where is the best place to start looking for one.
At the outset, you have to be aware that building a chatbot may not be the solution you’re looking for. In other words, constructing complex systems every time you need a virtual assistant isn’t the right thing to do. This is why understanding the difference between existing chatbots is crucial. And this is why you need to learn a thing or two about chatbots before rushing your decision to build one.
If you are a complete newcomer, before proceeding, you may want to read the article linked above, in the first sentence of the text you’re reading. That way, you’ll get a better idea what are bots and when you’ll need them. However, we promised to make things as clear as possible – even for those who haven’t read it and don’t have time for it now. So –
Chatbots are closely associated with web applications. They owe their functionality to numerous HTTP requests and responses (hypertext transfer protocol is the set of rules allowing the communication between the client and the server) of either “POST” (for submitting information) or “GET” (for requesting information) nature.
Using a particular programming environment and certain libraries, a programmer builds a web application able to exchange information with the messaging platform you’re interested in (see below, 4.).
The information flow depends exclusively on events taking place at the user’s end. To put it in layman terms, this means that the application is programmed to react automatically in response to certain changes in the user’s behaviour.
At the end of the day, the structure of a basic chatbot is the combination of the following two elements:
A connection between the chatbot application and the application programming interface (APIs) of a chosen messaging platform by means of HTTP requests and responses; and
A communication with the users, based on the “if-then-else” programming logic (conditional statements enable chatbots to check whether the user’s input matches the case predicted in the code: whether it’s true of false).
Every messaging platform has its own application programming interface (API), or, in other words, its own set of techniques and methods which allow you to connect with it and deploy your application.
As a result, before building your chatbot, you need to carefully choose the messaging platform (Facebook Messenger, Telegram, KIK, Slack) where you would want to run it.
ELIZA (1966) and PARRY (1972) are the names of the first two chatbots ever built. Both owed their functionality to hard-coded logic exclusively.
Hard-coding means embedding an input or configuration data directly into the source code. It means including as many “if-then-else” lines as there are expected inputs. In this case, the responses of a chatbot depend solely on predicting the users’ input. Since it is impossible to predict everything a person might say, programmers need to rely on a trick or two to cheat the user into sharing with the bot the right information. For example, ELIZA was programmed to respond to every input containing the word “mother” with either “Tell me more about your family” or “Does talking about this bother you?” or “I’m not sure I understand you fully”. But, of course, these are not the only three viable options and predicting inputs means that a lot of stuff will be inevitably left uncovered.
However, back in 1966, it was impossible to create a program able to understand human language in any other way but simulating this through hard-coded logic. In fact, even though the “behaviour” of ELIZA and PARRY was entirely hard-coded, both chatbots attempted to pass the Turing test and fascinated first users with their intelligence (a modern JavaScript version of ELIZA is available here, so have a go and see if you’ll be similarly fascinated as well). Until recently, in fact, due to the lack of computing resources, chatbots similar to ELIZA and PARRY were the only chatbots available.
Nowadays, fortunately, language understanding (LU) services, are widely available now and hard-coded programming isn’t the only option. But, if you think that each and every chatbot you come across at messaging platforms is more intelligent than its ancestors – think again. Sometimes, chatbots such as ELIZA and PARRY work just fine and plain hard-coded logic is more than enough. Because, in more cases than one, humans are predictable.
Conventional Chatbots: Problems and Advantages
In general, there are two, or better yet one two-sided problem with conventional chatbots:
We are humans and we are different enough to often use diverse words to express pretty much the same things. Therefore, it frequently happens that a chatbot relies on a set of inputs which doesn’t include the one you use. This leads to him being unable to understand you. You might as well have been talking Chinese.
The second problem is a direct consequence of the first one: in order to prevent misunderstanding, a developer must offer the user a list of possible options, out of which he or she should choose one. This, however, makes the dialogue seem unnatural.
But, as far as customer service is concerned, neither should be crucial. Because an artificially looking chatbot which incorporates a lot of buttons or drop-down list control menus (to avoid ambiguous inputs), but still performs fast searches through huge amounts of data and ends up either offering the user the best possible information or redirecting him to a human assistance may be even more than what you need.
Therefore, before deciding you need something much more complicated than a conventional chatbot, carefully think about the needs of your users and the purpose of your bot. Bear in mind that even when hard-coded, modern chatbots are far more efficient than their ancestors, due to increased computer power, which allows them to deal efficiently with much larger input/output sets. Also, bear in mind that even if you build something complicated, users may still be interested in merely some parts of its functionality. Then, why not offer them those only and save yourself the money and the time?
OK, you got it: conventional chatbots are not as bad as they seem. But what if you really need a smart chatbot?
Well, you’re lucky – because we live in a day and age when “if-else” bots are practically a thing of the past. And when we say “day and age” we really mean “these days”. Because, during the past year or two, things have gotten a lot better. And it’s not because computers are becoming ever more powerful. It’s because the technology is more readily available. Nowadays, in fact, practically every developer can try himself/herself in AI fairly straightforwardly.
It’s as easy as 1-2-3.
This is both the most undemanding and the most important part of your job. Because you must choose the messaging platform your customers use more often (or even exclusively). No need to tell you this, but different messaging platforms are used by different people and for varying purposes. Some are used for chilling and talking to friends (Facebook), while others are for work purposes only (Slack). Some can be used for either (Telegram) and some are popular with teenagers (KIK). Make sure that you know your audience before choosing the right messenger.
Platforms such as Microsoft Bot Framework offer a wide range of useful tools which can simplify the development process and reduce the number of lines of code. In fact, Microsoft offers an all-in-one solution: create the bot application in Microsoft’s development environment, use the tools offered by Microsoft’s Bot Framework, add Microsoft Cognitive Services, and then publish the final product on Microsoft Azure.
Here’s a short list of the services which can help you create a chatbot which understands human language:
Some of these services don’t even require you to code anything (Botsify, Chatfuel), which, as far as beginners are concerned, is more than useful. On the other hand, services such as Microsoft Cognitive Services and IBM Watson offer a wide array of functions, so they are a great tool for proficient developers (even though, learning them is simplified for newcomers as well).
The rest of these tools are something in the middle between the large platforms and the services which allow you to get around without coding: proficiency may be necessary, but they too have a highly intuitive interface and convenient tools to get you started.
It’s Been a Long Time…
Almost sixty years have passed since the first conversation between two chatbots – ELIZA and PARRY. You can find the conversation here and compare it with a recently recorded discussion between two AI-based Google Home chatbots named Estragon and Vladimir. The difference is striking.
And it owes much to the fact that, as we explained above, the “if-then-else” conditional logic behind ELIZA and PARRY has been superseded by the LU abilities of Estragon and Vladimir, which, as opposed to hard coding, rely on machine learning (ML) algorithms.
Here is how Sebastian Thrun, the chairman and co-founder of Udacity, and the founder of Google X, describes the difference between the old-fashioned hard-coded logic and the LU based on ML algorithms: