WhatsApp-Powered RAG Travel Support Agent: Elevating Customer Experience with PostgreSQL Knowledge Retrieval
In our previous blog post, "Elevating Customer Support With a Whatsapp Assistant," we explored how advanced technologies like Generative AI and Retrieval Augmented Generation (RAG) can revolutionize traditional customer support models in the travel industry. Today, we'd like to present an alternative approach that leverages the power of Agents for Amazon Bedrock, a vectorized Amazon Aurora a PostgreSQL knowledge base for Amazon Bedrock.
This architecture eliminates the need for complex conversation management logic, as Bedrock agents handle session tracking, while the Knowledge Base for Amazon Bedrock using Aurora PostgreSQL ensures highly accurate and contextual responses, and Amazon DynamoDB serves a dual purpose: storing both passenger information and support tickets.
Key features of our solution include:
- Intelligent query handling using RAG.
- Personalized support based on individual traveler data.
- Automatic creation of support tickets for unresolved issues.
- Ability to query and manage the support ticket database.
This application is built in four stages using infrastructure as code with AWS Cloud Development Kit (CDK) with Python to deploy. In the first stage, an Amazon Aurora PostgreSQL vector database is set up. In the second stage, the Knowledge Base for Amazon Bedrock is created using the established database. The third stage involves creating an Amazon Bedrock agent. Lastly, in the fourth stage, a WhatsApp application is deployed to provide the user interface for the system.
✅ AWS Level: Advanced - 300
Prerequisites:
- Foundational knowledge of Python
- AWS Account
- Enable model Access for the following models:
- Amazon Titan Embeddings V2
- Anthropic Claude 3 models (Haiku or Sonnet).
- Set up the AWS Command Line Interface (CLI)
- Read about AWS CDK "Get started with Python"
- Optional: Bootstrap your account/region if this is your first CDK Project
💰 Cost To Complete:
- Amazon Bedrock Pricing Note: in this project, we use Amazon Titan Embeddings v2 and Anthropic Claude 3
- Amazon S3 Pricing
- AWS Systems Manager pricing
- Amazon Aurora Pricing Note: Here we use Aurora Serverless with 0.5 ACU
- Amazon Lambda Pricing
- Amazon DynamoDB Pricing
- Whatsapp pricing
- Amazon ApiGateway
- Amazon Transcribe Pricing
🚨 Note: This series of CDK stacks should be deployed within the same AWS account and region. This is because each stack is created to store essential information in a AWS Systems Manager (SSM) Parameter Store secret, which is subsequently retrieved by the stack in the next step of the deployment process.
-
User Interaction: The process begins when a user sends a voice note/text message via WhatsApp.
-
Message Processing: The voice/text message is received through an Amazon API Gateway and processed by AWS Lambda Function.
-
Data Storage: The message details are stored in Amazon DynamoDB table for record-keeping.
-
Audio Processing: The voice note is streamed to an Amazon S3 bucket.
-
Transcription: Amazon Transcribe converts the audio to text.
-
Intelligent Assistance: The transcribed text is sent to an Agent for Amazon Bedrock.
-
Response Generation: The Agent processes the query and generates a response, potentially accessing additional data from DynamoDB table or a knowledge base.
-
Action Execution: Depending on the user's request, various actions can be triggered, such as creating support tickets or retrieving passenger information.
-
Response Delivery: The final response is sent back to the user via WhatsApp.
git clone https://github.com/build-on-aws/rag-postgresql-agent-bedrock
Part 1: Building an Amazon Aurora PostgreSQL vector database as a Knowledge Base for Amazon Bedrock.
Part 3: Building an Agent for Amazon Bedrock to Search Knowledge Base and Manage Amazon DynamoDB Data.
👾 Tip: If you don't want to use WhatsApp, that's fine! You can use the following JavaScript application, which creates a UI that allows you to use the Agents and Knowledge Bases for Amazon Bedrock available in your AWS account --> Building ReactJS Generative AI apps with Amazon Bedrock and AWS JavaScript SDK
This enhanced WhatsApp Travel Assistant demonstrates the power of AWS's integrated AI and database services. By leveraging Amazon Bedrock's agent and knowledge base capabilities, along with Aurora PostgreSQL and DynamoDB, we've created a more streamlined, powerful, and maintainable solution.
The addition of the support ticket system provides a complete end-to-end customer service experience, allowing for seamless escalation of complex issues while maintaining the benefits of AI-powered initial interactions.
We encourage you to build upon this foundation, perhaps by expanding the knowledge base, fine-tuning the Bedrock agent's responses, or integrating with additional travel-related services.
Thank you for joining us on this journey to revolutionize travel customer support with AWS technologies!
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.