Skip to content

oramirezvital/rag-postgresql-agent-bedrock

 
 

Repository files navigation

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:

  1. Intelligent query handling using RAG.
  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) 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.

Digrama parte 1

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:

Digrama parte 1

  1. User Interaction: The process begins when a user sends a voice note/text message via WhatsApp.

  2. Message Processing: The voice/text message is received through an Amazon API Gateway and processed by AWS Lambda Function.

  3. Data Storage: The message details are stored in Amazon DynamoDB table for record-keeping.

  4. Audio Processing: The voice note is streamed to an Amazon S3 bucket.

  5. Transcription: Amazon Transcribe converts the audio to text.

  6. Intelligent Assistance: The transcribed text is sent to an Agent for Amazon Bedrock.

  7. Response Generation: The Agent processes the query and generates a response, potentially accessing additional data from DynamoDB table or a knowledge base.

  8. Action Execution: Depending on the user's request, various actions can be triggered, such as creating support tickets or retrieving passenger information.

  9. Response Delivery: The final response is sent back to the user via WhatsApp.

Let's build!

Part 0: Clone the repo

git clone https://github.com/build-on-aws/rag-postgresql-agent-bedrock

👾 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, 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!

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 90.3%
  • Jupyter Notebook 8.4%
  • Batchfile 1.3%