Skip to main content

Introduction to Colang - Part 1

· 10 min read
Razvan Dinu

Streamlining customer support is one of the main drivers for conversational AI adoption, and it has the potential to provide genuine value to both customers and enterprises. However, designing and building conversational AI bots with a broad range of capabilities is a big challenge. Colang was built to address the core challenges in building advanced conversational bots, such as the one below:




In the video above, we have a recording of how a customer support bot, implemented in colang, handled a refund request for an order. This article is part of a series that introduces the language and the playground environment. The sections below provide a high-level overview of what it means to build such a bot.

Simplified Language

Before we begin, it's worth explaining one of the key differences between colang and other conversational AI platforms. Colang takes a symmetrical approach to modeling the conversation between the user and the bot. The conversational flow is modeled using a simplified language. From this perspective, designing conversations has three main components:

  1. user.co: translating from natural language into the simplified language;
  2. flows.co: defining the conversation flows using the simplified language;
  3. bot.co: translating from the simplified language back into natural language.
user "Hello!"
bot "Good morning!"

The simplified language is defined collaboratively by the bot designer(s) and developer(s). If done right, defining flows using colang and the chosen simplified language resembles very closely how we think naturally about a conversational bot. Colang is designed to be the common language between conversation designers and developers, and eliminate the need for "handoff". A colang model is both the design and the implementation of a bot.

Conversation Structure

The typical customer support conversation follows a relatively standard structure: greeting, introduction, initial request, authentication, request fulfilling, and goodbye. In the following sections, we look at the conversation flow from the demo above.

tip

You can chat with the bot using the chat on the bottom-right of this page. Feel free to test additional "unhappy" paths.

Greeting and Introduction

A good conversation design practice is to have the bot introduce itself at the start of the conversation and manage expectations correctly, i.e., inform it's a bot talking, and give an overview of its capabilities.

bot "Good morning!"
bot "I'm Alfred, your digital assistant for Demo Store."
bot "I can help you with order-related issues, account management,"
bot "and answering product-related questions."
bot "How may I help you today?"

To implement this behavior, we've used the co/greeting component, which also automatically greets the user based on the time of the day.

Initial Request

Next, the user greets the bot and makes their request, i.e., order refund. A good conversation design practice is to acknowledge that the user was heard, implicitly confirm the request (so the user can correct it in case of misunderstanding), and manage the expectations regarding the next steps.

user "Hello! I was wondering if I could get a refund for something I ordered."
bot "Alright. I understand you want a refund for your order."
bot "I can definitely help with that. But first, I need to check your identity."
bot "For most people this only takes a minute."
bot "Is this ok with you?"

user "Yes, that's ok."

Authentication

For most customer support scenarios, the user needs to be authenticated. The authentication logic can be very complex when multiple data points need to be validated. For example, the user might provide the wrong information and then correct it, not know the requested data point, ask for a repeat or ask additional information about a data point (e.g. where is the username). All these have been included in the conversation below, and they have been implemented by using the co/auth and the co/repeat components.

bot "Can I have your name or account id?"

user "My account number is 327-1288."
bot "I found your account. To validate your identity, "
bot "I need two bits of information."
bot "Can I have your phone number?"

user "It's 7897-17-896."
bot "The phone number 7897178096 does not seem right. Let's try something else."
bot "Your email address is?"

user "Oh, I'm sorry, the phone number is 7897-017-896."
bot "Correct. I need one additional bit of information from you."
bot "What is your email address?"

user "Uhh, I don't know."
bot "Alright. Let's skip for now. Let's try something else."
bot "What is your username?."

user "I'm sorry, can you repeat?"
bot "I said, what is your username?"

user "Where can I find it?"
bot "You can find it in any of the emails you've received from us."

user "I'm sorry. I can't find it."
bot "Ok. Let's skip for now. Let's try something else."
bot "Let me know your zip code."

user "Ok, the zip code is 94010."
bot "That is correct. Your identity is now verified."

Request Fulfilling

After the user is authenticated, we proceed with the request. A sample from the conversational flows is shown below, including logic for handling various paths and edge cases, e.g., we already might have an order in the context of the conversation, or the user might have provided the refund reason with the initial request.

bot "What is your order ID?"

user "Wait a second."
bot "Sure, take your time."

user "The order number is 65192."
bot "I found your order. What is the reason for the refund?"

user "I realized I don't need it anymore."
bot "How would you like to receive the refund?"
bot "Account credit, gift card, paper check or credit card."

user "Just put it back on my credit card."
bot "Excellent. We'll credit back the card on file."
bot "Anything else I can help you with?"

Chitchat and Goodbye

Once the initial request is fulfilled, a good conversation design practice is to ask the user if they need help with anything else. If not, the conversation can be gracefully ended. The behavior below is implemented using the co/chitchat/extended and the co/goodbye components.

bot "Anything else I can help you with?"

user "You are quite smart for a robot."
bot "Thank you. I try my best."
bot "So, anything else I can help you with?"

user "No. Thanks. Have a nice day!"
bot "It's my pleasure to help."
bot "Bye! See you soon!"

Components

"Divide et impera" is a powerful principle dating back to ancient Greece. In software engineering, reusability is achieved through frameworks and generic/specific components. Colang aims to bring the same approach to conversational AI. The components included in this customer support bot are part of the Co Framework, a colang framework for conversational bots, which we will introduce in a follow-up article.

Next

Building conversational bots using colang is both straightforward and complex. In this article, we've looked at the concept of a simplified language, which is at the core of the language philosophy, and how including reusable components greatly simplifies the development process. In the following articles, we'll look in more detail at specific aspects of the language and how to build advanced bots that can handle natural conversational flows.