⬡ Hub
Skip to content

AWS GenAI Use Case 3: HR Q&A RAG System

An end-to-end Retrieval-Augmented Generation (RAG) architecture tailored for Human Resources. This allows employees to ask complex questions about company policies, benefits, and handbooks, receiving highly accurate answers grounded entirely in the company's proprietary documents.

Architecture Overview

  1. Document Storage (Amazon S3): HR uploaded PDF handbooks and TXT policy files into a secure S3 bucket.
  2. Vectorization & Memory (FAISS): The application downloads the documents, parses the text into chunks, and uses Amazon Titan Embeddings to convert those chunks into mathematical vectors stored in a local FAISS database.
  3. User Interface (Streamlit): An interactive web dashboard where employees type questions.
  4. Retrieval (LangChain): When a user asks "What is the parental leave policy?", LangChain converts the question to a vector, searches FAISS, and retrieves the specific 3 paragraphs from the 500-page handbook containing the answer.
  5. Generation (Anthropic Claude 3 on Bedrock): LangChain wraps the user's question and the retrieved paragraphs into a strict prompt and sends it to Claude 3 on Amazon Bedrock.
  6. Infrastructure (ECS/Fargate): The entire application runs inside a Docker container orchestrated by AWS ECS Serverless Fargate.

Component Breakdown

1. terraform/ (Infrastructure as Code)

  • main.tf: Provisions the S3 bucket for HR documents, an ECR container registry, and the IAM Roles allowing the container to read from S3 and call Bedrock.

2. src/ (Application Code)

  • app.py: The Streamlit frontend and LangChain RAG pipeline.
  • requirements.txt: Python dependencies (streamlit, langchain, faiss-cpu, pypdf, boto3).
  • Dockerfile: Packaging instructions.

3. CI/CD (.github/workflows/deploy.yml)

Automates the Docker build and push to AWS Elastic Container Registry.