A full-stack AI-powered chatbot that lets you upload any PDF and ask questions about it in plain English. Built with a Retrieval-Augmented Generation (RAG) pipeline using LangChain, ChromaDB, and Anthropic's Claude LLM — deployed on AWS.
Instead of asking an LLM to guess answers, this app first retrieves the most relevant content from your document, then passes it to Claude as context — so every answer is grounded in what's actually in the PDF.
Upload PDF → Extract & Chunk Text → Generate Embeddings → Store in ChromaDB
↓
User Question → Semantic Search → Claude → Answer
| Layer | Technology |
|---|---|
| Language | Python 3.10+ |
| Backend API | FastAPI + Uvicorn |
| AI Orchestration | LangChain |
| LLM | Anthropic Claude API |
| Vector Database | ChromaDB |
| Embeddings | HuggingFace (all-MiniLM-L6-v2) |
| File Storage | AWS S3 |
| Deployment | AWS EC2 (Ubuntu) |
| Frontend | Streamlit |
| Environment | python-dotenv |
rag-chatbot/
├── app/
│ ├── __init__.py
│ ├── ingest.py # PDF loading, chunking, ChromaDB storage
│ ├── rag.py # Semantic search + Claude integration
│ └── main.py # FastAPI endpoints
├── uploads/ # Temporary local storage before S3 upload
├── .env # API keys (never committed)
├── .gitignore
├── requirements.txt
└── streamlit_app.py # Frontend chat UI
- Python 3.10+
- An Anthropic API key
- An AWS account with an S3 bucket
git clone https://github.com/xMayble/rag-chatbot.git
cd rag-chatbotpython -m venv venv
# Windows
venv\Scripts\activate
# Mac/Linux
source venv/bin/activatepip install -r requirements.txt
pip install sentence-transformersCreate a .env file in the root directory:
ANTHROPIC_API_KEY=your_anthropic_api_key
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_BUCKET_NAME=your_s3_bucket_name
AWS_REGION=us-east-1
Terminal 1 — Start the API:
uvicorn app.main:app --reloadTerminal 2 — Start the frontend:
streamlit run streamlit_app.pyThen open http://localhost:8501 in your browser.
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Health check |
POST |
/upload |
Upload and ingest a PDF |
POST |
/ask |
Ask a question about the document |
- S3 — Stores uploaded PDFs for scalable, production-grade file handling
- EC2 (t2.micro, Ubuntu) — Hosts the FastAPI backend with a live public URL
RAG (Retrieval-Augmented Generation) — A technique that improves LLM accuracy by retrieving relevant context from a knowledge base before generating a response. This prevents hallucinations and grounds answers in real document content.
Vector Embeddings — Text chunks are converted into numerical vectors that capture semantic meaning. ChromaDB stores these and enables similarity search — finding relevant chunks by meaning, not just keywords.
- Multi-PDF support
- Chat history / memory
- Source citations showing which page the answer came from
- User authentication
- Frontend rebuild in React