- QUICKSTART.md - 5-minute setup guide
- README.md - Complete user documentation
- DOCUMENTATION.md - Technical deep-dive
- PROJECT_SUMMARY.md - Implementation summary
src/
├── config/ Configuration management
├── rag/ RAG pipeline components
└── utils/ Helper utilities
RAG Document Assistant is a production-ready system that combines:
- Document processing (PDF, DOCX, TXT)
- AI-powered semantic search (Google Gemini embeddings)
- Vector database storage (Pinecone)
- Conversational AI (Google Gemini LLM)
- Web interface (Streamlit)
✅ File Upload - Support for .txt, .pdf, .docx
✅ Smart Chunking - Automatic text splitting with overlap
✅ Vector Embeddings - Google Gemini semantic vectors
✅ Semantic Search - Pinecone vector similarity
✅ AI Responses - Context-grounded answers
✅ Source Attribution - All answers cited
✅ Chat Interface - Streamlit web app
✅ CLI Tools - Command-line utilities
app.py- Streamlit web interfacemain.py- CLI entry pointsetup_project.py- Project setup scriptrequirements.txt- Python dependencies.env.template- Configuration templateMakefile- Convenient commands
README.md- User guideQUICKSTART.md- 5-minute setupDOCUMENTATION.md- Technical detailsPROJECT_SUMMARY.md- Implementation statusINDEX.md- This file
src/
├── __init__.py
├── config/
│ ├── __init__.py
│ └── config.py Configuration class
├── rag/
│ ├── __init__.py
│ ├── pinecone_manager.py Pinecone operations
│ ├── embedding_service.py Google Gemini embeddings
│ ├── document_processor.py Document pipeline
│ └── rag_chain.py RAG chain & LLM
└── utils/
├── __init__.py
├── helpers.py Logging & utilities
├── chunking.py Text splitting
└── text_processor.py File extraction
pip install -r requirements.txt
python setup_project.py# Edit .env with your API keys
GOOGLE_API_KEY=sk-...
PINECONE_API_KEY=...
PINECONE_ENVIRONMENT=us-east-1python main.py initstreamlit run app.pystreamlit run app.py
# Then:
# 1. Upload documents
# 2. Process them
# 3. Ask questions# Initialize index
python main.py init
# Process documents
python main.py process documents/
# Process single file
python main.py process document.txt
# With namespace
python main.py process docs/ --namespace my-projectfrom src.rag import RAGChain
chain = RAGChain()
result = chain.query("What is the main topic?")
print(result["answer"])✅ Context Verification - Answers based only on uploaded documents
✅ Hallucination Prevention - Refuses out-of-scope questions
✅ Source Attribution - All answers include source references
✅ Error Handling - Comprehensive logging and error messages
✅ Config Validation - Required API keys are checked
┌─────────────────────────────────┐
│ Streamlit Web Interface │
│ - File Upload │
│ - Chat Interface │
│ - Source Display │
└────────────┬────────────────────┘
│
┌────────────▼────────────────────┐
│ RAG Processing Pipeline │
├─────────────────────────────────┤
│ 1. Document Processing │
│ - Extract text from files │
│ - Split into chunks │
│ │
│ 2. Embedding Service │
│ - Generate vectors │
│ - Dimension: 768 │
│ │
│ 3. Vector Storage │
│ - Upsert to Pinecone │
│ - Store metadata │
│ │
│ 4. RAG Chain │
│ - Retrieve documents │
│ - Generate responses │
│ - Cite sources │
└─────────────────────────────────┘
Edit .env to customize behavior:
# API Keys (required)
GOOGLE_API_KEY=your_key
PINECONE_API_KEY=your_key
PINECONE_ENVIRONMENT=us-east-1
# Processing
CHUNK_SIZE=1000
CHUNK_OVERLAP=200
# Retrieval
RETRIEVAL_TOP_K=5
# Model
GOOGLE_MODEL_NAME=gemini-2.5-flash
EMBEDDING_MODEL=models/embedding-001
# Logging
LOG_LEVEL=INFOmake help # Show all commands
make install # Install dependencies
make setup # Setup project
make init # Initialize Pinecone
make run # Start Streamlit
make clean # Clean uppython main.py init # Initialize
python main.py process <path> # Process documents
python main.py process <path> --namespace <name> # With namespacestreamlit run app.py # Start web UI| Format | Extension | Notes |
|---|---|---|
| Text | .txt | Plain text files |
| Using PyPDF2 | ||
| Word | .docx | Using python-docx |
- Embeddings:
models/embedding-001- Dimension: 768
- Semantic understanding
- LLM:
gemini-2.5-flash- Chat capabilities
- Context-aware responses
- Vector Storage: Scalable cloud database
- Similarity Search: Cosine distance
- Metadata Support: Store source info
- Namespaces: Organize documents
- Ensure
.envexists with API keys - Run
python setup_project.py
- Check internet connection
- Verify API key validity
- Test API access
- Check file format (.txt, .pdf, .docx)
- Verify chunk size settings
- Review error logs
- Ensure documents are processed
- Check index statistics
- Verify query format
- Faster Processing: Increase
CHUNK_SIZE - Better Context: Increase
CHUNK_OVERLAP - More Results: Increase
RETRIEVAL_TOP_K - Organized Storage: Use different namespaces
python -c "from src.rag import *; print('✓ OK')"# Create sample file
echo "Sample content for testing" > sample.txt
# Process it
python main.py process sample.txt
# Query via Streamlit
streamlit run app.pyREADME.md- User guideQUICKSTART.md- 5-minute setupDOCUMENTATION.md- Technical detailsPROJECT_SUMMARY.md- Implementation status
| Metric | Value |
|---|---|
| Total Files | 15+ |
| Lines of Code | 1200+ |
| Classes | 7 |
| Functions | 40+ |
| Documentation Files | 5 |
| Configuration Options | 15+ |
Status: ✅ PRODUCTION READY
All requirements from the project specification have been implemented with:
- Production-grade code quality
- Comprehensive documentation
- Full feature set
- Error handling
- Security considerations
- Read QUICKSTART.md
- Follow the 5-minute setup
- Upload sample documents
- Test queries
- Review DOCUMENTATION.md
- Explore source code in
src/ - Check PROJECT_SUMMARY.md
- Extend functionality as needed
- Configure
.envwith production keys - Run
python main.py init - Set up document pipeline
- Monitor via logs
For issues:
- Check troubleshooting in README.md
- Review logs for error details
- Verify API key configuration
- Check documentation for guidance
Last Updated: December 2024
Version: 1.0.0
Status: Production Ready ✅
Start with QUICKSTART.md for the fastest way to get running!