Transforming Customer Care: An Introduction to DTDL's Autonomous Assistant

Hello, and welcome to the first blog in my DTDL-CustomerCare Series! In this post, I’ll introduce the overall concept and architecture in more depth. But first, let me share how this project began.

The idea of developing a chatbot for the customer care department came to me during some discussions with my current client, who expressed interest in this area. I started brainstorming and planning, but due to a busy few months both professionally and personally, I couldn’t dedicate enough time to it.

Recently, I heard about the Microsoft Developers AI Learning Hackathon, which focuses on “Learning to build AI apps with Azure Cosmos DB.”

This sparked my enthusiasm again, and I decided to bring my idea to life.

Before we dive into the challenges we’re addressing and the architecture’s details, here are the key takeaways from this series:

  • Familiarity with building AI apps using Azure Cosmos DB 🚀
  • How to perform data ingestion with Azure Document Intelligence Service 📄
  • Working with Langchain agents 🤖
  • Understanding function calling concepts 🧠
  • Using completion and embedding models with Azure OpenAI 🔍

Stay tuned as we delve into each of these components in the upcoming posts!

Lately, many clients have shown a keen interest in exploring the capabilities of LLMs/SLMs by addressing various challenges. This sparked a discussion with my current client about enhancing operational efficiency in the customer care department. However, other priorities soon took precedence, and the project was put on hold. It wasn’t until I recently heard about a hackathon focused on AI solutions that my desire to tackle this challenge was reignited.

I chose customer service as my problem statement because it’s something many of us can easily relate to. My idea is to build a smart, autonomous assistant that can handle customer queries, such as answering FAQs, and intelligently respond to questions about past orders without the need for long waits or multiple transfers. A key focus was ensuring this assistant could verify users and provide personalized information securely.

Imagine a customer needing to check the status of their last order. With our assistant, they could simply input their query, receive an OTP on their phone, and verify their identity securely. The assistant would then fetch the details from the database and provide the information instantly. No more waiting on hold, no more frustration.

I wanted to tackle this challenge by leveraging LangChain Agent to build an autonomous solution with minimal human intervention. The core idea behind agents is to use a language model to determine a sequence of actions to take, unlike traditional chains where the sequence is hardcoded. LangChain Agents act as reasoning engines, deciding which actions to take and in what order, making the system both flexible and intelligent. For instance, if a customer asks about their last order, the agent can simultaneously initiate OTP authentication, query the database for order details, and handle any additional requests in the proper sequence. This ensures that each task is executed efficiently and accurately.

“In the movie “The Matrix,” Agent Smith famously says, “Human beings are a disease, a cancer of this planet. You are a plague, and we are the cure.”
I believe that is where we are heading these days with multi agents taking over”

Bringing this idea to life was not an easy task. It required seamlessly integrating various technologies. We used OTP authentication for secure user verification, Twilio API to send OTPs, and Azure Cosmos DB to store and verify customer information. The challenge was to make this process smooth and autonomous, ensuring customers received quick and accurate responses without compromising security. We utilized Azure Cosmos DB for MongoDB vCore’s vector search capability to retrieve relevant documents when a customer asks a query.

We set up two vector indexes: one for retrieving relevant product information from our product collection and another based on FAQs. Using Azure Document Intelligence Service, we retrieved information from existing FAQ PDFs, created a data ingestor to chunk the data, and generated embeddings in our database.

This approach transforms customer service by creating a smart, autonomous assistant that operates with high efficiency and minimal delay. The integration of LangChain Agent with Azure Cosmos DB, Twilio API, and Azure Document Intelligence Service ensures a robust, secure, and intelligent solution for handling customer queries.

Through the DTDL-CustomerCare series, we will explore the architecture and components that make this innovative solution possible. From data ingestion and AI integration to secure authentication and function calling, we’ll delve into each aspect in detail. Our goal is to share insights and knowledge that can help others build similar solutions, ultimately enhancing the customer service experience for everyone.

The idea behind this process was to scrape the website or generate some potential dummy FAQs related to Telekom services using ChatGPT. I then compiled all the possible FAQs into a PDF.

  • First, I analyzed the PDF using the Azure Document Intelligence Studio and found that the Layout model was the best fit for this case.
  • Next, I created a Data Ingestor using an Azure Function HTTP trigger to upload the file and extract relevant information with the Azure Document Intelligence service client.
  • The content was then semantically chunked based on their headings and stored as separate chunks in Azure CosmosDB for MongoDB vCore, within a collection called “KnowledgeBase.”

A separate blog detailing how to create this will be provided in the next blog of this series.

  • For general queries, the query is transformed into an embedding format using the embedding Ada model.
  • The query is then subjected to a vector search on the FAQ collection, which we chunked and stored in our Azure CosmosDB for Mongo vCore during our earlier process.
  • We retrieve the top k relevant documents from this search and provide them to the LLM.
  • Finally, the LLM responds to the customer.
  • If the query pertains to product information, it is transformed into an embedding format and a vector search is performed on the Products collection.
  • We retrieve the top k relevant documents from this search and provide them to the LLM.
  • Finally, the LLM responds to the customer.
  • If the query is customer-specific, we start by obtaining the phone number via the agent.
  • We then generate an OTP and store it in the database.
  • The generated OTP is sent to the customer via the Twilio SMS API.
  • The customer is prompted to input the OTP for verification.
  • The customer inputs the OTP.
  • We verify the OTP against the database and, upon successful verification, fetch the customer-related information.
  • Once the information is retrieved, it is added to the LLM context.
  • Finally, the LLM responds to the past order or customer-specific query.

DTDL-CustomerCare

https://dghx6mmczrmj4mk-web.azurewebsites.net/

CAUTION : If the site is slow, it is due to the serverless infrastructure used for this application.