A Retrieval Augmented Generation (RAG) application that allows you to ask questions about documents. The system includes ManishKumar's resume as a permanent document and supports uploading additional PDFs for temporary use during your session.
- Permanent Resume: ManishKumar's resume is always available in the vector database
- Temporary Upload: Upload additional PDFs for your current session
- Auto Cleanup: Session documents are automatically removed when the session ends
- Smart Q&A: Ask questions about any loaded document using Google Gemini
- Web Interface: User-friendly Streamlit frontend
- API Backend: FastAPI backend for document processing
- Backend: FastAPI with ChromaDB for vector storage
- Frontend: Streamlit web interface
- AI Model: Google Gemini 2.0 Flash for text generation
- Embeddings: HuggingFace GIST-large-Embedding-v0
- Document Processing: Docling for PDF processing and chunking
For Streamlit Cloud deployment, a separate streamlit_app.py file is provided that combines both frontend and backend functionality into a single Streamlit application.
- Python 3.8+
- Google API Key (for Gemini)
-
Clone and navigate to the project:
cd d:\Project\RAG
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile in the project root:GOOGLE_API_KEY=your_google_api_key_here LANGSMITH_API_KEY=your_langsmith_api_key_here # Optional
-
Ensure the resume file exists: Make sure
ManishKumarResume.pdfis in thepdfs/folder
python run_app.pystart.bat-
Start the API server:
uvicorn api:app --host 0.0.0.0 --port 8000 --reload
-
Start the Streamlit frontend (in another terminal):
streamlit run frontend.py
-
Access the application:
- Frontend: http://localhost:8501
- API Documentation: http://localhost:8000/docs
-
Ask questions about the resume:
- The system always has access to ManishKumar's resume
- Ask questions like "What is ManishKumar's experience in Python?"
-
Upload additional documents:
- Use the sidebar to upload PDF files
- These files are processed and added to the current session
- Ask questions about the uploaded content
-
Session management:
- Uploaded documents are automatically removed when the session ends
- Use the "Clear Session Documents" button to manually clean up
- The resume file remains permanently available
GET /health- Health checkPOST /query- Ask questions about documentsPOST /upload- Upload a PDF for the current sessionPOST /cleanup-session- Clean up session documentsGET /loadedpdfs- List available documents
d:\Project\RAG\
├── api.py # FastAPI backend
├── frontend.py # Streamlit frontend
├── textRAG.py # Core RAG implementation
├── run_app.py # Startup script
├── start.bat # Windows batch file
├── requirements.txt # Python dependencies
├── README.md # Documentation
├── .env # Environment variables (create this)
├── pdfs/ # PDF storage
│ └── ManishKumarResume.pdf
└── test_chroma_db/ # Vector database storage
- API not starting: Check if port 8000 is available
- Streamlit not starting: Check if port 8501 is available
- Missing resume: Ensure
ManishKumarResume.pdfis in thepdfs/folder - Upload failures: Check file size and ensure it's a valid PDF
- Google API errors: Verify your
GOOGLE_API_KEYin the.envfile
To extend the application:
- Add new document types: Modify the file upload validation in
api.py - Change embedding models: Update the model in
textRAG.py - Customize UI: Modify the Streamlit interface in
frontend.py - Add new endpoints: Extend the FastAPI routes in
api.py
Key dependencies include:
fastapi- Web API frameworkstreamlit- Web interfacelangchain- LLM frameworkchromadb- Vector databasetransformers- HuggingFace modelsdocling- Document processinggoogle-generativeai- Google Gemini integration
See requirements.txt for the complete list.