Backend service for DocMind AI, an AI-powered document assistant that lets users chat with one or multiple PDF documents using Retrieval-Augmented Generation (RAG).
Built with FastAPI, LangChain, Google Gemini, ChromaDB, and SQLAlchemy.
- 📄 Upload and process PDF documents
- 💬 AI-powered conversational chat
- 📚 Multi-document RAG (chat across multiple PDFs)
- 🔍 Source citations with page numbers
- 📝 AI-generated document summaries
- ⚡ Streaming responses (Server-Sent Events)
- 💡 Suggested follow-up questions
- 🧠 Conversational history with question rewriting
- 📂 Session management
- 📌 Pin and organize chat sessions
- FastAPI
- LangChain
- Google Gemini
- ChromaDB
- SQLAlchemy
- SQLite
- PyMuPDF
- Server-Sent Events (Streaming)
app/
├── api/
├── services/
├── models/
├── repositories/
├── prompts/
├── utils/
└── ...
git clone https://github.com/<your-username>/docmind-ai-backend.git
cd docmind-ai-backendpython -m venv .venvActivate it.
Windows
.venv\Scripts\activateLinux / macOS
source .venv/bin/activatepip install -r requirements.txtCreate a .env file.
GOOGLE_API_KEY=your_google_api_keyuvicorn app.main:app --reloadThe API will be available at
http://localhost:8000
| Method | Endpoint | Description |
|---|---|---|
| POST | /upload |
Upload a PDF |
| POST | /chat/stream |
Stream AI responses |
| POST | /summarize |
Generate document summary |
| GET | /documents |
List uploaded PDFs |
| DELETE | /documents |
Delete a PDF |
| GET | /sessions |
Get chat sessions |
| POST | /sessions |
Create a session |
| PATCH | /sessions/{id}/pin |
Pin/Unpin session |
| GET | /source |
View source page |
React Frontend
│
▼
FastAPI API
│
▼
LangChain
│
▼
Google Gemini
│
▼
ChromaDB Vector Store
│
▼
PDF Documents
- Streaming AI responses
- Multi-document semantic retrieval
- Context-aware conversations
- Source-grounded answers
- Modular service architecture
- Responsive frontend integration
This project is created for learning and portfolio purposes.
Omkar Parab
If you found this project interesting, feel free to connect or explore the frontend repository.