DEV Community

Cover image for Generative AI Call Center
Vuong Bach Doan
Vuong Bach Doan

Posted on

Generative AI Call Center

First Cloud Journey Cloud Day - Generative AI Call Center

This guide provides step-by-step instructions to create a call center solution that integrates Amazon Bedrock as an AI assistant and uses OpenAI's Whisper model for real-time voice-to-text transcription. The implementation will utilize Amazon SageMaker to deploy Whisper and Amazon Bedrock to enhance the interaction with AI-driven responses.

Table of Contents

Prerequisites

Download resource at here

or using

git clone https://github.com/vuongbachdoan/fcj-cd-demo.git
Enter fullscreen mode Exit fullscreen mode

Before getting started, ensure you have the following:

  • An AWS account with access to:

    • Amazon Connect
    • Kinesis Video Stream
    • Bedrock
    • SQS
    • Lambda
    • SageMaker
    • DynamoDB
  • Basic knowledge of Python, Jupyter Notebook, and familiarity with AWS services.

  • AWS CLI and SageMaker Studio set up on your machine.

Architecture Overview

Architecture

Setup Instructions

Step 1: Create Whisper Endpoint

About Whisper

The Whisper endpoint is a powerful tool for speech recognition, offering extensive capabilities for transcription and understanding spoken language across various applications. It leverages advanced machine learning techniques to deliver accurate and efficient transcriptions.

How it Works

The Jupyter notebook deploys a SageMaker endpoint with a custom inference script similar to this example in the SageMaker SDK documentation. The components required to deploy a pre-trained model to an endpoint in SageMaker are:

  1. A serialized model artifact (tar file) in Amazon S3.
  2. The code and requirements that run inference.

These components are packaged into a SageMaker endpoint, which serves the serialized model with custom code behind it as an API. See the architecture below for a visual description.

Architecture

Setup SageMaker Notebook

  1. Navigate to the SageMaker dashboard.
  2. Go to Application and IDEs > Notebooks in the left sidebar.
  3. Click Create notebook instance and complete the following configurations:
    • For Notebook instance name, enter a unique name.
    • For Notebook instance type, choose ml.m5.2xlarge.
    • Expand Additional configuration and set the Volume size in GB to 10GB.
    • Leave other fields as default.
  4. Wait until the status of the notebook instance changes to In service before using the instance.
  5. Open JupyterLab to run your notebook.

Run Notebook

  1. Navigate to the /whisper folder in your current repository.
  2. Copy all files and folders, upload them to the current notebook, and run the notebook.
  3. It is recommended to run every cell one by one.
  4. The folder structure will look like this:

Folder Structure

You will have an endpoint named whisper-endpoint under Inference > Endpoints.

Step 2: Deploy Lambda Function

  1. Navigate to /amazon-connect in your current repository.
  2. Run the following command on your local computer:

    aws configure
    

Then enter your AWS Access Key ID, AWS Secret Access Key, and Default region name (us-west-2).

  1. Clone the repository:

    git clone https://github.com/vuongbachdoan/fcj-cd-demo.git
    cd amazon-connect
    
  2. Create a .env file:

    cat << EOF > .env
    WHISPER_ENDPOINT="whisper-endpoint"
    EOF
    
  3. Execute the following script once:

    ./scripts/create_deployment_bucket.sh dev
    
  4. To deploy, execute this script as often as required:

    ./scripts/serverless_deploy.sh dev
    
  5. Set up a contact flow that starts media streaming and passes the following parameters to the ProcessStream Lambda:

    • kvsStreamArn: the stream ARN from the contact attribute in Connect.
    • kvsStartFragment: the KVS start fragment number from the contact attribute in Connect.
  6. Add any Lambda functions used to the Amazon Connect instance. The ContactId is fetched from the standard request attribute:

    event.Details.ContactData.ContactId
    
  7. This should start populating an IVR real-time transcript into DynamoDB.

  8. Enable KVS media streaming in your Amazon Connect instance and set a sane retention period for KVS (24 hours minimum during testing).

KVS Enable

Step 3: Set Up Amazon Connect Flow

  1. Access your Amazon Connect instance with your account credentials.
  2. Create a flow using the template located at amazon-connect/contact_flow/prsv-aws-connect-flow.json.
  3. Claim a phone number by navigating to Phone numbers > Voice > Toll free > Choose the flow you imported previously.
  4. You're all set! Call your contact center now.

DEMO

https://github.com/user-attachments/assets/dfa474e0-186e-428e-873c-f7f2c991da4d

🎉 Congratulations! 🎉

In this workshop, you have learned how to implement a call center using Amazon Connect and Generative AI. You’ve gained valuable insights into setting up efficient customer support systems that leverage cutting-edge technology to enhance user experience.

Feel free to ask me any questions about this solution! Connect with me on LinkedIn.

Top comments (0)