A Retrieval-Augmented Generation (RAG) system to search across multiple text/PDF documents and synthesize answers to user queries using the Google Gemini API.
- Backend: Python + FastAPI
- Vector Database: FAISS (In-memory, ephemeral)
- Embeddings & LLM: Google Gemini (
gemini-3-flash-previewandgemini-embedding-2-previewwith automatic fallback togemini-embedding-001). - Frontend: React (Vite) + Vanilla CSS
This system is designed to have minimal local dependencies. FAISS runs entirely in-memory, and all heavy ML computation (embeddings and synthesis) is offloaded to the Google Gemini API. No local Docker containers or PostgreSQL installations are required.
- Python 3.9+
- Node.js 18+
- A Google Gemini API Key
The backend handles document ingestion, text chunking, FAISS vector storage, and interacting with the Gemini API.
- Navigate to the backend directory:
cd backend - Create a virtual environment (optional but recommended):
python -m venv venv # python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Run the FastAPI server:
The API will be available at
python main.py
http://localhost:8000.
The frontend provides a clean, professional React interface to input your API key, upload documents, and ask questions.
- Navigate to the frontend directory:
cd frontend - Install dependencies:
npm install
- Start the development server:
The application will be available at
npm run dev
http://localhost:5173.
- Open the frontend application in your browser (
http://localhost:5173). - In the left sidebar, paste your Google Gemini API Key. (It is stored securely in your browser's local storage and passed in the headers of API requests. It is never logged or stored on the backend).
- Click Upload Document and select a PDF or Text file. Wait for the success message confirming the document was chunked and indexed.
- Use the main chat area to ask questions about the uploaded documents. The LLM will synthesize an answer, and you can click "Show Sources" to view the specific chunks of text it used.
- Minimal Dependencies: Avoided heavy database systems (Postgres/Milvus) by using purely in-memory FAISS.
- No Hardcoded Secrets: The API key is provided dynamically via the UI.
- Aesthetics: Used standard CSS variables and a flexbox layout to create a modern, clean, custom UI without relying on generic template libraries.