How spidy20/aws-assistant-rag-chatbot works
Project type and purpose
• This is a full-stack, serverless RAG (retrieval-augmented generation) ChatBot.
• Frontend: Streamlit app for demo (app.py).
• Backend: AWS Lambda function (Langchain GPT-4 handler) exposed via API Gateway, deployed via AWS SAM (Lambda-App/template.yaml).
• Vector DB: PostgreSQL + PGVector on an EC2 instance.
• Auxiliary scripts: data ingestion (DataIngestion.py) and connectivity test (connect.py).
File structure
• Top level:
• app.py – Streamlit UI
• DataIngestion.py – loads aws_sample_qa.csv into PGVector DB
• connect.py – verifies DB connectivity
• aws_sample_qa.csv – sample Q&A data
• Lambda-App/ (SAM app)
• template.yaml – defines AWS::Serverless::Function (Lambda) and API Gateway
• Backend/
– Lambda_Response_App.py – Lambda handler implementing Langchain + DB calls
– requirements.txt – Lambda dependencies (langchain, psycopg2, etc.)
Insights from the README
• Architecture uses AWS SAM to deploy a Lambda + API Gateway REST endpoint.
• EC2 hosts the PostgreSQL with PGVector extension.
• Data flow: ingest → query via REST → Lambda → VectorDB → (optionally OpenAI GPT-4) → response.