What is chatbot architecture?
Chatbot architecture is a vital component in the development of a chatbot. It is based on the usability and context of business operations and the client requirements.
Developers construct elements and define communication flow based on the business use case, providing better customer service and experience. At the same time, clients can also personalize chatbot architecture to their preferences to maximize its benefits for their specific use cases.
What are the components of a chatbot?
Regardless of how simple or complex the chatbot is, the chatbot architecture remains the same. You have the front-end, where the user interacts with the bot. The responses get processed by the NLP Engine which also generates the appropriate response.
1. The user flow - Starting with intents
The NLU Engine is composed of multiple components of chatbot. To generate a response, that chatbot has to understand what the user is trying to say i.e., it has to understand the user’s intent.
Message processing starts with intent classification, which is trained on a variety of sentences as inputs and the intents as the target. For example, if the user asks “What is the weather in Berlin right now?” the intent is that the user’s query is to know the weather.
Then, we need to understand the specific intents within the request, this is referred to as the entity. In the previous example, the weather, location, and number are entities. There is also entity extraction, which is a pre-trained model that’s trained using probabilistic models or even more complex generative models.
2. Fetching a response
To predict a response, previous user conversations are stored in a database with a dictionary object that has information about the current intent, entities, and information provided by the user. This information is used to:
- Respond to the user with a message defined by the rules set by the bot builder
- Retrieve data from your database
- Make an API call to get results matching intent
The first option is easier, things get a little more complicated with option 2 and 3. The control flow handle will remain within the ‘dialogue management’ component to predict the next action, once again. The dialogue manager will update its current state based on this action and the retrieved results to make the next prediction. Once the action corresponds to responding to the user, then the ‘message generator’ component takes over.
3. Backend Integration
Since chatbots rely on information and services exposed by other systems or applications through APIs, this module interacts with those applications or systems via APIs.
Thus, the bot makes available to the user all kinds of information and services, such as weather, bus or plane schedules or booking tickets for a show, etc.
Channels
It is the medium that the chatbot inhabits and where it communicates. On platforms such as Engati for example, the integration channels are usually WhatsApp, Facebook Messenger, Telegram, Slack, Web, etc.
External Integration services
These services are present in some chatbots, with the aim of collecting information from external systems, services or databases.
This is a reference structure and architecture that is required to create a chatbot.
Although the use of chatbots is increasingly simple, we must not forget that there is a lot of complex technology behind it. There is also a lot of design and work in what has to do with defining the personality of the chatbot and the conversation flow and, finally, a lot of functionality and information that we normally access as third-party services via integration.
What are the different types of chatbot architectures?
1. Generative models
Generative models are the future of chatbots, they make bots smarter. This approach is not widely used by chatbot developers, it is mostly in the labs now.
2. Retrieval-based models
Retrieval-based models are much easier to build. They also provide more predictable results. You probably won’t get 100% accuracy of responses, but at least you know all possible responses and can make sure that there are no inappropriate or grammatically incorrect responses.
Retrieval-based models are more practical at the moment, many algorithms and APIs are readily available for developers. The chatbot uses the message and context of conversation for selecting the best response from a predefined list of bot messages. The context can include current position in the dialog tree, all previous messages in the conversation, previously saved variables (e.g. username).
3. Pattern-based heuristics
Heuristics for selecting a response can be engineered in many different ways, from if-else conditional logic to machine learning classifiers. The simplest technology is using a set of rules with patterns as conditions for the rules. This type of models is very popular for entertainment bots. AIML is a widely used language for writing patterns and response templates.
4. Machine learning for intent classification
The inherent problem of pattern-based heuristics is that patterns should be programmed manually, and it is not an easy task, especially if the chatbot has to correctly distinguish hundreds of intents. Imagine that you are building a customer service bot and the bot should respond to a refund request. Users can express it in hundreds of different ways: “I want a refund”, “Refund my money”, “I need my money back”. At the same time, the bot should respond differently if the same words are used in another context: “Can I request a refund if I don’t like the service?”, “What is your refund policy?”. Humans are not good at writing patterns and rules for natural language understanding, computers are much better at this task.
Machine learning lets us train an intent classification algorithm. You just need a training set of a few hundred or thousands of examples, and it will pick up patterns in the data.
Chatbot architecture for voice bots
This chatbot architecture may be similar to the one for text chatbots, with additional layers to handle speech.
First of all we have two blocks for the treatment of voice, which only make sense if our chatbot communicates by voice.
- Speech recognition: To take care of recognizing what the user says.
- Speech synthesis: Generating the bot response with a voice
- Conversation manager: It is the module that decides the flow of the conversation or the answers to what the user asks or requests. Basically this is the central element that defines the conversation, the personality, the style and what the chatbot is basically capable of offering.
- Natural Language Understanding: To take care of the meaning of what the user wanted to say, either by voice or text.
What should you consider while developing your chatbot’s architecture?
Before building your chatbot, remember your audience. The following factors must be considered to ensure usability and a seamless customer experience:
- User-friendliness
- Speed
- Support for languages
- Compatibility with channels such as WhatsApp, Facebook Messenger, Slack, etc.
- Back-end integrations such as CRM solutions, Shopify, Google Calendar for extended usability.
- Analytics and feedback provision
What are the components of a conversational chatbot architecture?
Following are the components of a conversational chatbot architecture despite their use-case, domain, and chatbot type.
Environment
The environment is primarily responsible for contextualizing users’ messages/inputs using natural language processing (NLP). It is one of the important parts of chatbot architecture, giving meaning to the customer queries and figuring the intent of the questions.
Question and Answer System
The Q&A system is responsible for answering or handling frequent customer queries. Developers can manually train the bot or use automation to respond to customer queries. The Q&A system automatically pickups up the answers or solutions from the given database based on the customer intent.
Plugins/Components
Plugins and intelligent automation components offer a solution to a chatbot that enables it to connect with third-party apps or services. These services are generally put in place for internal usages, like reports, HR management, payments, calendars, etc.
Node Server / Traffic Server
Node servers handle the incoming traffic requests from users and channelize them to relevant components. The traffic server also directs the response from internal components back to the front-end systems to retrieve the right information to solve the customer query.
Front-end Systems
Having an array of front-end systems like Facebook Messenger, WhatsApp Business, Slack, Google Hangouts is extremely important apart from the website or mobile app-based chatbots to secure the possibility of interacting with the majority of the customer base.
How is questions and answer training done in chatbot architecture?
Following are the two ways to train bots in chatbot architecture.
Manual Training
The process in which an expert creates FAQs (Frequently asked questions) and then maps them with relevant answers is known as manual training. This helps the bot identify important questions and answer them effectively.
Automated Training
Automated training involves submitting the company’s documents like policy documents and other Q&A style documents to the bot and asking it to the coach itself. The engine comes up with a listing of questions and answers from these documents. The bot can then answer these questions confidently.