Transforming Contact Center Experiences: A Detailed Overview of Queue Selection using Generative AI

In this blog post we will be looking at using generative AI to perform queue selection in Amazon Connect

Transforming Contact Center Experiences: A Detailed Overview of Queue Selection using Generative AI

Demo video

Click here for a demo of this AI queue selection on my channel on YouTube

Transforming Contact Center Experiences: A Detailed Overview of Queue Selection using Generative AI

In the swiftly evolving digital landscape, the key to thriving in the market is superior customer service. The crux of this service often lies in the pivotal moment of customer interaction, when they reach out for help or to inquire about your offerings. It’s this precise moment that can determine whether your relationship with the customer will flourish or falter. Sadly, many contact centers grapple with the cumbersome and dated mechanisms of queue selection, leading to long waiting times and frustrating experiences. More often that not anecdotes about interactions with call center automated systems are negative with frustrated customers trying to coax the bot into the choice they are trying to make. However, the integration of artificial intelligence (AI), such as generative models like ChatGPT from OpenAI, into platforms like Amazon Connect, can revolutionize these traditional processes.

The Archaic Landscape of Contact Centers

Despite the rapid pace of technological advancement, a surprising number of contact centers cling to the tried-and-tested but significantly outdated queue selection mechanisms. This hesitation often stems from the fear of disruption or the ingrained belief that existing methods are the best. Unfortunately, this resistance often results in static, inflexible and generally poor queue selection systems.

These systems are notorious for their rigidity, leading to extended waiting times and improper routing of calls. They require a considerable amount of effort and expertise to set up and manage. Any alterations to the system or additions of new queues complicate the situation further, inviting more chances for mismanagement and errors.

The Emergence of AI in Contact Centers

The integration of AI technologies into contact centers is a game-changer. Among the various applications of AI, its potential to radically simplify queue selection stands out. Generative AI models, like ChatGPT, which we use here as an example, understand and process natural language inputs, rendering them ideal for queue selection in contact centers. They don’t need explicit training; instead, we are going to use them as a tool to select the best queue in our contact center by solely describing our queues to the AI in natural language.

The Potential of Generative AI in Queue Selection with Amazon Connect

This solution marries the capabilities of Amazon Connect and generative AI, making the queue selection process highly efficient and user-friendly:

  1. Queue creation in Amazon Connect: Queues are formulated and provided with natural language descriptions, thereby eliminating the need for cumbersome rule-based frameworks. We will simply describe the function of the queue, or describe the agents that will be handling that queue. This is purely done with natural language, so any contact center operator can update a queues description.

  2. Customer interaction: When a customer calls, Amazon Connect greets them with a simple hardcoded message such as “Why are you calling today?” to initiate the conversation. This is just so the customer can start talking, it doesn’t matter what they say as from this point on the AI will be interacting with them to find out why they are calling.

  3. Processing the customer’s response: The customer’s response is channeled through a Lambda function, which pairs the response with all of the queue descriptions. This gives the AI sufficient information about our specific contact center.

  4. Queue selection with AI: The queue descriptions, coupled with the customer’s response, are then processed by a generative AI model. The AI evaluates this data to ascertain the most suitable queue for the customer’s needs.

  5. Generating further queries: If the generative AI model is unsure about the best queue, it can formulate additional questions to further narrow down the options and ensure the most appropriate selection.

  6. Routing the call: Once the queue is selected, Amazon Connect efficiently routes the call to the appropriate queue.

A Dive into the Benefits of Queue Selection Using Generative AI

Implementing a generative AI like ChatGPT for queue selection in Amazon Connect ushers in a host of significant benefits:

  • Zero need for manual training: Traditional systems require ongoing updates to handle the multitude of variations in customer inquiries. All these variations must be manually added to models or to static rules for future reference. With a generative AI, this requirement is obliterated as the AI can natively understand the intent, generating disambiguation questions as required, thereby significantly reducing the overhead of maintenance and updates.

  • Simplicity: The only input required for the generative AI model is a natural language description of the queues and the statements from the caller. This simplicity enhances user experience and makes the system far more manageable.

  • Ease of queue addition: With every new queue addition, all that’s required is a natural language description on Amazon Connect. The solution automatically accommodates this new queue for routing, making the process substantially simpler.

  • Improved accuracy and efficiency: The AI can ask as many disambiguation questions as it needs, all in a natural conversation with the customer. Generative AI’s exceptional natural language processing capabilities enable it to make more precise queue selections, thereby reducing waiting times and bolstering overall call handling efficiency.

  • Enhanced customer experience: More accurate and quicker queue selections ensure smoother, more satisfying customer interactions with your business.

  • Cost-effectiveness: Owing to the elimination of extensive training and maintenance, using a generative AI for queue selection is a more cost-effective solution in the long run.

A Real-World Implementation

In this section, we’ll provide a step-by-step overview of implementing this solution, using Amazon Connect, a Lex bot, Lambda functions, and a generative AI model. We will build a financial services implementation as an example. This implementation will use ChatGPT as the generative AI for the natural language processing, but any AI could be used in its place, ChatGPT is just selected due to the current ease of implementation.

Queue setup in Amazon Connect

The first step involves setting up the queues in Amazon Connect. Each queue is given a natural language description that encapsulates the purpose and function of the queue. These descriptions are set on the queues in Amazon Connect. Its highly likely an existing Amazon Connect solution would already have these set by the operators of the queues. In our case though we are going to give nice clean descriptions of each queue, for example these are the names of the queues and their descriptions:


Queue Name Description
General Banking Inquiries This queue is for customers who have basic questions or need information about their banking accounts, such as balances, transfer capabilities, or interest rates.
Loan Inquiries Customers interested in applying for a loan or getting information about their existing loans are directed to this queue. This could include home loans, personal loans, auto loans, or business loans.
Credit Card Services This queue is specifically for customers who have inquiries about credit cards, including application status, balance inquiries, disputes, or rewards programs.
Fraud Detection and Prevention This queue is for customers who suspect fraudulent activity on their accounts or cards. The agents in this queue are trained to handle such sensitive matters, and they can guide the customer through the necessary steps to secure their accounts.
Technical Support Customers who are experiencing issues with online banking or mobile banking apps are directed to this queue. Agents here are trained to resolve technical issues and guide customers through troubleshooting steps.
Investment Services This queue is designed for customers interested in or currently involved with investment services like stocks, bonds, or mutual funds. Agents in this queue can provide specific information about these services.
Business Banking This queue is designed to handle inquiries from business clients. They could have questions or require assistance with business accounts, merchant services, commercial loans, or payroll services.
Customer Complaint This queue deals specifically with customer complaints and issues. The agents in this queue are trained to handle a variety of complex situations and are empowered to make decisions to resolve customer issues.

Creating the Lex bot

The Lex bot is responsible for initiating conversations with the customers. It does this by asking a hardcoded question such as “Why are you calling today?”. This is a very simple Lex bot as all we want it to do is capture the content of the utterance of the caller. We just need one intent to make the bot build successfully:

And we create a fulfillment Lambda for the lex bot that sets the actual spoken text as a slot value. Something like this:


export const handler = async(event) => {
    
  let response = {
    "sessionState": {
        'sessionAttributes': {},
        'dialogAction': {
            'type': 'Close',
            'fulfillmentState': 'Fullfilled',
            'message': 'message'
        },
        "intent": {
          "name": "CaptureAllIntent",
          "confirmationState": "Confirmed",
          "state": "Fulfilled",
          "slots":{"content": {
                      "value": {
                        "interpretedValue": event.inputTranscript,
                        "originalValue": event.inputTranscript,
                        "resolvedValues": [
                            event.inputTranscript
                        ]
                      } 
                  }
          }
        }
    }
  }

    return response
  
};


We are doing this so that we can then just pass this raw spoken text through to the the AI.

AI interaction Lambda function

A Lambda function is set up to process the customer’s response. This function reads the queue descriptions and pairs them with the customer’s response. The generative AI model is then used to determine the best queue for the customer’s inquiry. It uses the queue descriptions and the customer’s response to make this decision.

We have in previous blog posts discussed how to call ChatGPT using Stored Prompts. We are going to be using this same lambda and functionality here. In our flow we will call a stored prompt that has a format such as:

"Given the following queue information:

{queue_information}

Select the best queue for a customer who has just said:

{caller_utterance}

If there is not enough detail ask additional questions to select the best queue.

The JSON object returned should be in this format without deviation:
{
    "QueueId":"String",
    "QueueName":"String",
    "AdditionalQuestion":"String",
    "HasAdditionalQuestion":"Boolean",
    "SummaryOfQuery":"String"    
}
    
Do not include any explanations, only provide a  RFC8259 compliant JSON response."

Using this stored prompt we will insert the queue information, and the callers utterance. The constructed prompt is then sent to the AI for evaluation. The AI will then either give us follow up questions or will specify the queue to which we route the caller.

Amazon Connect Flow

The Amazon Connect flow that combines all of these parts is very simple. It will just call the lex bot, call the Generative AI lambda function with our stored prompt, and then loop around if there are any additional questions. It looks very simple, something like this:

What is more impressive though is how this sounds and how it responds. Make sure you listen to the demo video where I will interact with this example described above, it becomes very apparent then about how a simple solution can far outperform substantially more complicated designs.

Example Conversation

When we interact with this system (see the video linked at the top of this post) the responses from the AI are very natural and conversational. As we have directed the AI to only perform a singular function it narrows down the queue choice rapidly. In our example we allow any number of disambiguation questions, allowing for any case where the caller is not sure what they want, they can interact with the AI until it decides what is the best queue. Of course if we so wished we could limit the number of loops and just push the customer to the best queue at that point in time.

An example of a conversation with the AI would look something like this. Included here are the JSON responses to and from the AI.

1. AI: “Thanks for calling Ians test Contact Center, how can I help you today?”

(This is the initial hardcoded question in Amazon Connect)

2. Customer: “I have a question about business banking”

(The query is now constructed with this input and sent to the AI. Note that we are just sending raw queue descriptions from Amazon Connect to the AI, we don’t try or need to do anything clever here, the AI is able to interpret this format just fine.)

Given the following queue information:
[
    {
        "Name": "GeneralBankingInquiries",
        "QueueArn": "arn:aws:connect:ap-southeast-2:202030678599:instance/681052d8-ae0f-49da-8583-b561df5cbee5/queue/f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "QueueId": "f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "Description": "This queue is for customers who have basic questions or need information about their banking accounts, such as balances, transfer capabilities, or interest rates.",
        "HoursOfOperationId": "26ad5acb-dc56-4718-b778-7d55afd7ea25",
        "Status": "ENABLED",
        "Tags": {}
    },
    {
        "Name": "LoanInquiries",
        "QueueArn": "arn:aws:connect:ap-southeast-2:202030678599:instance/681052d8-ae0f-49da-8583-b561df5cbee5/queue/f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "QueueId": "f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "Description": "Customers interested in applying for a loan or getting information about their existing loans are directed to this queue. This could include home loans, personal loans, auto loans, or business loans.",
        "HoursOfOperationId": "26ad5acb-dc56-4718-b778-7d55afd7ea25",
        "Status": "ENABLED",
        "Tags": {}
    },
    {
        "Name": "CreditCardServices",
        "QueueArn": "arn:aws:connect:ap-southeast-2:202030678599:instance/681052d8-ae0f-49da-8583-b561df5cbee5/queue/f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "QueueId": "f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "Description": "This queue is specifically for customers who have inquiries about credit cards, including application status, balance inquiries, disputes, or rewards programs.",
        "HoursOfOperationId": "26ad5acb-dc56-4718-b778-7d55afd7ea25",
        "Status": "ENABLED",
        "Tags": {}
    },
    {
        "Name": "FraudDetectionPrevention",
        "QueueArn": "arn:aws:connect:ap-southeast-2:202030678599:instance/681052d8-ae0f-49da-8583-b561df5cbee5/queue/f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "QueueId": "f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "Description": "This queue is for customers who suspect fraudulent activity on their accounts or cards. The agents in this queue are trained to handle such sensitive matters, and they can guide the customer through the necessary steps to secure their accounts.",
        "HoursOfOperationId": "26ad5acb-dc56-4718-b778-7d55afd7ea25",
        "Status": "ENABLED",
        "Tags": {}
    },
    {
        "Name": "TechnicalSupport",
        "QueueArn": "arn:aws:connect:ap-southeast-2:202030678599:instance/681052d8-ae0f-49da-8583-b561df5cbee5/queue/f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "QueueId": "f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "Description": "Customers who are experiencing issues with online banking or mobile banking apps are directed to this queue. Agents here are trained to resolve technical issues and guide customers through troubleshooting steps.",
        "HoursOfOperationId": "26ad5acb-dc56-4718-b778-7d55afd7ea25",
        "Status": "ENABLED",
        "Tags": {}
    },
    {
        "Name": "InvestmentServices",
        "QueueArn": "arn:aws:connect:ap-southeast-2:202030678599:instance/681052d8-ae0f-49da-8583-b561df5cbee5/queue/f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "QueueId": "f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "Description": "This queue is designed for customers interested in or currently involved with investment services like stocks, bonds, or mutual funds. Agents in this queue can provide specific information about these services.",
        "HoursOfOperationId": "26ad5acb-dc56-4718-b778-7d55afd7ea25",
        "Status": "ENABLED",
        "Tags": {}
    },
    {
        "Name": "BusinessBanking",
        "QueueArn": "arn:aws:connect:ap-southeast-2:202030678599:instance/681052d8-ae0f-49da-8583-b561df5cbee5/queue/f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "QueueId": "f7e7a224-5f8c-4f5b-a919-55336820e55c",
        "Description": "This queue is designed to handle inquiries from business clients. They could have questions or require assistance with business accounts, merchant services, commercial loans, or payroll services.",
        "HoursOfOperationId": "26ad5acb-dc56-4718-b778-7d55afd7ea25",
        "Status": "ENABLED",
        "Tags": {}
    }
]

Select the best queue for a customer who has just said:

"I have a question about business banking"

If there is not enough detail ask an additional question, prompting the caller with possible options.

The JSON object returned should be in the format:

{
"QueueId":"String",
"QueueName":"String",
"AdditionalQuestion":"String",
"HasAdditionalQuestion":"Boolean",
"SummaryOfConversation":"String"
}

Do not include any explanations, only provide a  RFC8259 compliant JSON response.

3. AI: “Sure, could you please specify if your question is about business accounts, merchant services, commercial loans, or payroll services?”

(The AI at this point already has an idea about which queue the customer wants, but it clarifies to get more detail. There is a running summary, not just a transcript, of the conversation so far also that can be provided to the Agent for context.)

{
"QueueId": "f7e7a224-5f8c-4f5b-a919-55336820e55c",
"QueueName": "BusinessBanking",
"AdditionalQuestion": "Sure, could you please specify if your question is about business accounts, merchant services, commercial loans, or payroll services?",
"HasAdditionalQuestion": true,
"SummaryOfConversation": "The customer has a question about business banking."
}

4. Customer: “Actually its about my business credit card”

(Customer clarifies)

customer says: "Actually its about my business credit card"

5. AI: “Thank you for your clarification. Could you specify if your question is about your application status, balance inquiry, disputes, or rewards programs?”

(Further clarification is needed)

{
"QueueId": "f7e7a224-5f8c-4f5b-a919-55336820e55c",
"QueueName": "CreditCardServices",
"AdditionalQuestion": "Thank you for your clarification. Could you specify if your question is about your application status, balance inquiry, disputes, or rewards programs?",
"HasAdditionalQuestion": true,
"SummaryOfConversation": "The customer initially had a question about business banking, but then clarified that the question is actually about their business credit card."
}

6. Customer: “I want to increase the limit on it”

(As we are using a generative AI all context in the conversation is preserved, so the customers can refer to previous things in the conversation all in a natural way)

customer says: "I want to increase the limit on it"

7. AI:

(AI now knows enough and so it will end its interaction and the flow is returned to Amazon Connect where our customer is routed to the CredCardServices Queue. The summary is succinct and clear to the actual intent of the caller.)

{
"QueueId": "f7e7a224-5f8c-4f5b-a919-55336820e55c",
"QueueName": "CreditCardServices",
"AdditionalQuestion": "",
"HasAdditionalQuestion": false,
"SummaryOfConversation": "The customer has a question about increasing the limit on their business credit card."
}

With this example interaction the AI narrowed down the actual intent of the caller. The caller could of course said anything, they could have asked about products or services that were not defined in our queue structure, but that no longer matters, as the AI can handle any interaction and will coax the intent of the customer to a specific queue. The conversation is always completely natural.

Conclusion

So what have we shown here? Well the primary goal is simplification by using an abstracted highly advanced tool. In this case we have just described our contact center queue structure to an AI and then allowed it to make all the decisions around routing to those queues. This is a hugely simplified routing model. You may be asking yourself at this point questions such as “what about queue opening hours, or what about priority queues?” and these are great follow up questions to this post. Of course the answer is so simple it can just be said here in the conclusion, just describe any other business requirements to the AI as well and let it work it out. This is where I see these contact centers going, no more of these custom rules, simply a description of what you want your customer experience to be and then an AI will front and handle all customer interactions.

essential