Skip to content

Latest commit

 

History

39 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 AI RAG Chatbot (PDF + Conversational UI)

Python FastAPI Streamlit LangChain OpenAI FAISS AI Project


A full-stack Retrieval-Augmented Generation (RAG) Chatbot with an interactive Streamlit user interface, allowing users to upload PDF documents and ask context-aware questions in a chat-style experience.

🚀 Features

🧠 AI Capabilities

  • PDF-based Question Answering (RAG)
  • Context-aware responses using chat history
  • Semantic search with vector embeddings
  • Accurate answers using retrieved document context

🎨 User Interface (Streamlit)

  • 💬 Chat-style UI (like ChatGPT)
  • 📄 Upload PDF directly from browser
  • ⏳ Real-time processing indicator (spinner)
  • ⌨️ Typing animation effect for responses
  • 🧹 Clear chat button
  • ⚠️ Upload validation (prevents asking before upload)

⚡ Backend

  • FastAPI REST API
  • Modular RAG pipeline using LangChain
  • Clean answer post-processing

🏗️ Tech Stack

Layer Technology
Frontend Streamlit
Backend FastAPI
AI Model OpenAI (gpt-4o-mini)
Framework LangChain
Vector DB FAISS
Embeddings OpenAI Embeddings

🖼️ UI Preview (Streamlit)

Main Features:

  • Upload PDF → Ask Questions → Get AI Answers
  • Chat history maintained during session

FastAPI Screenshots

Streamlit Screenshot

Streamlit Screenshot


📂 Project Structure

AI-RAG-Chatbot/
│
├── api/
│   └── main.py              # FastAPI backend
│
├── dashboard/
│   └── app.py      # Streamlit UI (chat interface)
│
├── rag/
│   └── rag_pipline.py              # RAG logic (LangChain)
│
├── data/                   # Uploaded PDFs
├── .env
├── requirements.txt
└── README.md

⚙️ Installation

git clone https://github.com/your-username/AI-RAG-Chatbot.git
cd AI-RAG-Chatbot
pip install -r requirements.txt

Create .env file:

OPENAI_API_KEY=your_api_key_here

▶️ Run Locally

1️⃣ Start Backend

uvicorn api.main:app --reload

2️⃣ Start Frontend (Streamlit UI)

streamlit run dashboard/app.py

⚠️ Important: FastAPI must be running before starting Streamlit.


📡 API Endpoints

📄 Upload PDF

POST /upload

💬 Ask Question

POST /ask

🧠 How It Works

  1. User uploads PDF via Streamlit UI
  2. Backend processes document → splits into chunks
  3. Embeddings created using OpenAI
  4. Stored in FAISS vector database
  5. User asks question via chat UI
  6. Relevant chunks retrieved
  7. LLM generates final answer

🧠 System Workflow

1. User interacts with Streamlit UI
2. Streamlit sends request to FastAPI backend
3. FastAPI processes PDF + embeddings
4. Response returned to Streamlit UI

⚠️ FastAPI server must be running first


✨ Key Highlight (Important for Portfolio)

👉 This project demonstrates:

  • End-to-end AI application development
  • RAG (Retrieval-Augmented Generation) implementation
  • Frontend + Backend integration
  • Real-world AI use case (Document QA system)
  • API deployment (Render)

🌐 Live Demo

⚠️ Important: Please run the FastAPI backend first before using the Streamlit app.
Otherwise, the app will not return any responses.


🔮 Future Improvements

  • Multi-PDF support
  • Persistent vector DB (Chroma / Pinecone)
  • User login system
  • Chat history database
  • Drag & drop UI
  • Open-source LLM support

👨‍💻 Author

Wai Phyo Ko

Junior Python / AI Developer

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages