AWS Logo
Menu
Travel Support Agent Powered With RAG PostgreSQL

Travel Support Agent Powered With RAG PostgreSQL

Travel support agent using RAG, PostgreSQL KB, and Amazon Bedrock. Leverages AWS Aurora, DynamoDB, Transcribe, API Gateway to process text/voice, retrieve context, generate personalized responses.

Elizabeth Fuentes
Amazon Employee
Published Jul 25, 2024
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:
  1. Intelligent query handling using RAG technique.
  2. Personalized support based on individual traveler data.
  3. Automatic creation of support tickets for unresolved issues.
  4. 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) for python. 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. And in the fourth stage, a WhatsApp application is deployed to provide the user interface for the system.
Key features of our solution
āœ… AWS Level: Advanced - 300
Prerequisites:
šŸ’° Cost To Complete:
šŸšØ 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.

This is what you are going to build:

This is what you are going to build
  1. Inbound Message Webhook: The process begins when a user sends a voice note/text message via WhatsApp. The voice/text message is received through an Amazon API Gateway and processed by AWS Lambda Function.The message details are stored in Amazon DynamoDB table for decoupling and processing.
  2. Audio Text Process: If there is a voice message, it is stored in an Amazon S3 bucket. Then, Amazon Transcribe converts the audio to text, which is sent to the assistant.If it is only a text message it will go directly to the assitant input.
  3. Assistant Response: The Agent processes the query and generates a response, potentially accessing additional data from DynamoDB table or a knowledge base.Depending on the user's request, various actions can be triggered, such as creating support tickets or retrieving passenger information.The final response is sent back to the user via WhatsApp.

Let's build!

Part 0: Clone the repo

For setting up an Amazon Aurora PostgreSQL vector database. It explains the importance of vector databases for implementing Retrieval Augmented Generation (RAG). AWS Cloud Development Kit (CDK) for Python is used to set up the database infrastructure. This also includes detailed steps for preparing the database, such as installing extensions, creating schemas and roles, and setting up tables and indexes using Custom Constructs.

It focuses on creating a Knowledge Base for Amazon Bedrock, which involves setting up an S3 bucket as a data source, configuring necessary IAM roles and permissions, and storing information in AWS Systems Manager Parameter Store. The Knowledge Base automatically processes unstructured text data from PDFs, converts it into text chunks, generates vector embeddings, and stores them in a PostgreSQL database. The guide provides step-by-step instructions for setup and deployment.

The project demonstrates how to build an AI-powered agent capable of querying and analyzing data stored in a PostgreSQL database using natural language prompts.

The final part of a four-part series on building an advanced WhatsApp-powered RAG Travel Support Agent using Amazon Bedrock Agent. The project integrates various AWS services, including API Gateway, Lambda, DynamoDB, S3, and Transcribe, to create a workflow for processing and responding to user messages. The application can handle both text and voice messages, transcribe audio, and leverage a knowledge base built on Aurora PostgreSQL for information retrieval.
šŸ‘¾ 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

Conclusion

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, changing the agent's responses, or integrating with additional services.
Thank you for joining us on this journey to revolutionize travel customer support with AWS technologies!
Ā 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments