A modern Retrieval-Augmented Generation (RAG) application that enables users to upload PDF documents and have interactive conversations with their content via OpenAI's GPT models. This application features parallel query processing for enhanced response quality.
- PDF Document Uploads: Upload and process any PDF document
- Interactive Chat Interface: Modern UI with chat history
- Vector Search: Semantic search powered by Qdrant
- Persistent Chat History: Conversations are saved locally
- Responsive Design: Works on desktop and mobile devices
The application is built as a monorepo with three main components:
- Backend: Python • FastAPI • LangChain • OpenAI embeddings & chat completions
- Vector DB: Qdrant for vector storage and similarity search
- Frontend: React • Tailwind CSS • Modern chat UI with chat history
RagParallelQuery/
├── docker-compose.yml # Containers for all three services
├── README.md
├── frontend/ # React app with modern UI
│ ├── Dockerfile
│ ├── package.json # Node.js dependencies
│ ├── postcss.config.js # PostCSS for Tailwind
│ ├── tailwind.config.js # Tailwind configuration
│ └── src/
│ ├── components/ # React components
│ │ ├── ChatWindow.jsx
│ │ └── DocumentUploader.jsx
│ ├── api/
│ │ └── ragService.js # API service for backend communication
│ ├── App.jsx # Main application component
│ └── index.js # Application entry point
└── backend/ # FastAPI application
├── Dockerfile
├── requirements.txt # Python dependencies
├── .env # OpenAI API key
├── uploads/ # Directory for uploaded PDFs
└── app/
├── core/
│ └── config.py # Environment settings
├── utils/
│ └── file_loader.py # PDF loading utilities
├── services/
│ ├── embeddings.py # OpenAI embeddings service
│ └── vector_store.py # Qdrant integration
└── api/
├── routers/
│ ├── upload.py # PDF upload endpoint
│ └── rag.py # Chat query endpoint
└── main.py # FastAPI application entry point
- Docker & Docker Compose (recommended for easy setup)
- Python 3.11+ & pip (for local backend development)
- Node.js v18+ & npm (for local frontend development)
- OpenAI API key with access to GPT-4o and embeddings
The easiest way to run the application is using Docker Compose.
-
Create .env file in the
backenddirectory with your OpenAI API key:OPENAI_API_KEY=sk-...
-
Start all services from the project root:
docker-compose up --build
-
Access the application at http://localhost:3001
-
Access Qdrant dashboard at http://localhost:6343/dashboard
- Upload a PDF document using the interface
- Start asking questions about your document
- Previous conversations are saved automatically
- Switch between documents using the sidebar
-
Start Qdrant (or use your existing instance):
docker run -d --name qdrant -p 6333:6333 qdrant/qdrant:latest
-
Set up Python environment:
cd backend python -m venv venv source venv/bin/activate # macOS/Linux # or venv\Scripts\activate # Windows pip install -r requirements.txt
-
Configure API key in
.env:OPENAI_API_KEY=sk-...
-
Create uploads directory:
mkdir -p uploads
-
Run the FastAPI backend:
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
-
Install dependencies:
cd frontend npm install -
Start the development server:
npm start
-
Access the frontend at http://localhost:3000
GET /health- Check API healthPOST /api/upload- Upload and process a PDF filePOST /api/rag- Submit a question about a document
- Backend settings: Found in
backend/.envandbackend/app/core/config.py - Qdrant settings: Collection name set to "parallel_query"
- Frontend proxy: Configured to forward API requests to the backend
- Add authentication and user accounts
- Support for multiple file formats (beyond PDF)
- Advanced RAG techniques like hypothetical document embeddings
- Custom model selection
- Cloud deployment guide
This project is open source under the MIT License.
Enjoy your powerful RAG Chat application! 🎉