CoolFace
Apppublic

dev-arpit5462/augmented-research-assistant

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
README.md227 linesDownload Raw Back to root
1---2sdk: streamlit3---4 5sdk: streamlit6 7# ๐Ÿ” Augmented Research Assistant8 9A stunning dark-mode Streamlit RAG (Retrieval-Augmented Generation) application that allows users to upload documents and query information from them using cutting-edge AI technology.10 11## โœจ Features12 13- **Modern Dark UI**: Professional dark theme with smooth animations and responsive design14- **Multi-format Support**: Upload PDF, TXT, DOCX, and Markdown files15- **Intelligent RAG Pipeline**: LangChain orchestration with LlamaIndex document processing16- **Google Gemini Integration**: Powered by Google's latest Gemini API for inference and embeddings17- **Vector Search**: ChromaDB for efficient document retrieval18- **Source Attribution**: Display retrieved chunks to prevent hallucinations19- **Smart Caching**: Embedding and query caching for improved performance20- **Chat Interface**: Interactive chat with conversation history21- **Document Management**: Upload, process, and manage your knowledge base22 23## ๐Ÿ—๏ธ Architecture24 25```26โ”œโ”€โ”€ config/27โ”‚   โ”œโ”€โ”€ __init__.py28โ”‚   โ””โ”€โ”€ settings.py          # Configuration management29โ”œโ”€โ”€ core/30โ”‚   โ”œโ”€โ”€ __init__.py31โ”‚   โ””โ”€โ”€ rag_chain.py         # LangChain RAG orchestration32โ”œโ”€โ”€ services/33โ”‚   โ”œโ”€โ”€ __init__.py34โ”‚   โ”œโ”€โ”€ document_processor.py # LlamaIndex document loaders35โ”‚   โ””โ”€โ”€ vector_store.py      # ChromaDB + LangChain integration36โ”œโ”€โ”€ utils/37โ”‚   โ”œโ”€โ”€ __init__.py38โ”‚   โ””โ”€โ”€ cache_manager.py     # Performance caching39โ”œโ”€โ”€ app.py                   # Streamlit frontend40โ”œโ”€โ”€ requirements.txt         # Dependencies41โ””โ”€โ”€ README.md               # This file42```43 44## ๐Ÿš€ Tech Stack45 46- **Frontend**: Streamlit with custom dark theme CSS47- **Orchestration**: LangChain for RAG pipeline management48- **Document Processing**: LlamaIndex for intelligent chunking and loading49- **LLM & Embeddings**: Google Gemini API (free tier)50- **Vector Database**: ChromaDB (local, no external dependencies)51- **Caching**: Custom caching system for performance optimization52 53## ๐Ÿ“‹ Prerequisites54 55- Python 3.8+56- Google API Key (free from Google AI Studio)57 58## ๐Ÿ› ๏ธ Installation59 601. **Clone the repository**:61```bash62git clone <repository-url>63cd augmented-research-assistant64```65 662. **Create virtual environment**:67```bash68python -m venv venv69source venv/bin/activate  # On Windows: venv\Scripts\activate70```71 723. **Install dependencies**:73```bash74pip install -r requirements.txt75```76 774. **Set up Google API Key**:78   - Visit [Google AI Studio](https://makersuite.google.com/app/apikey)79   - Create a new API key (free, no credit card required)80   - Set environment variable:81   ```bash82   export GOOGLE_API_KEY="your_api_key_here"83   ```84   Or create a `.env` file:85   ```86   GOOGLE_API_KEY=your_api_key_here87   ```88 89## ๐ŸŽฏ Usage90 911. **Start the application**:92```bash93streamlit run app.py94```95 962. **Upload Documents**:97   - Use the sidebar to upload PDF, TXT, DOCX, or MD files98   - Documents are automatically processed and indexed99 1003. **Ask Questions**:101   - Type questions in the chat interface102   - Get AI-powered answers with source citations103   - View retrieved document chunks for transparency104 105## ๐Ÿ”ง Configuration106 107Modify `config/settings.py` to customize:108 109- **Chunk Settings**: `CHUNK_SIZE`, `CHUNK_OVERLAP`110- **Retrieval**: `TOP_K_RETRIEVAL`111- **Model Parameters**: `TEMPERATURE`, `MAX_TOKENS`112- **Caching**: `ENABLE_CACHING`, `CACHE_TTL`113 114## ๐Ÿ“Š Features Breakdown115 116### Document Processing117- **LlamaIndex Loaders**: Specialized loaders for each file type118- **Smart Chunking**: Overlapping chunks for better context retention119- **Metadata Preservation**: File names and chunk information maintained120 121### Vector Storage122- **ChromaDB Integration**: Local vector database via LangChain123- **Embedding Caching**: Avoid recomputing embeddings for performance124- **Deduplication**: Prevent duplicate document processing125 126### RAG Pipeline127- **Context-Aware Retrieval**: Top-k similarity search128- **Hallucination Prevention**: Strict context-only responses129- **Source Attribution**: Display retrieved chunks with relevance scores130 131### User Experience132- **Dark Mode**: Professional dark theme with gradients133- **Responsive Design**: Works on desktop and mobile134- **Real-time Processing**: Progress bars and status updates135- **Chat History**: Persistent conversation memory136 137## ๐Ÿš€ Deployment138 139### Streamlit Community Cloud140 1411. **Push to GitHub**:142```bash143git add .144git commit -m "Initial commit"145git push origin main146```147 1482. **Deploy on Streamlit Cloud**:149   - Visit [share.streamlit.io](https://share.streamlit.io)150   - Connect your GitHub repository151   - Add `GOOGLE_API_KEY` in secrets management152   - Deploy!153 154### Local Production155 156```bash157streamlit run app.py --server.port 8501 --server.address 0.0.0.0158```159 160## ๐ŸŽจ Customization161 162### Styling163- Modify CSS in `app.py` `load_custom_css()` function164- Adjust colors, animations, and layout165 166### Models167- Change Gemini model in `core/rag_chain.py`168- Adjust embedding model in `services/vector_store.py`169 170### Processing171- Modify chunk parameters in `config/settings.py`172- Add new file type support in `services/document_processor.py`173 174## ๐Ÿ” Resume Highlights175 176This project demonstrates:177 178- **Modern AI Stack**: LangChain + LlamaIndex + Gemini API integration179- **Production Architecture**: Modular, scalable design with separation of concerns180- **Performance Optimization**: Caching, efficient chunking, and vector search181- **User Experience**: Professional UI/UX with dark theme and animations182- **Free Tier Usage**: Entirely built on free APIs (no credit card required)183 184## ๐Ÿค Contributing185 1861. Fork the repository1872. Create a feature branch1883. Make your changes1894. Add tests if applicable1905. Submit a pull request191 192## ๐Ÿ“ License193 194MIT License - see LICENSE file for details.195 196## ๐Ÿ†˜ Troubleshooting197 198### Common Issues199 2001. **API Key Error**:201   - Ensure `GOOGLE_API_KEY` is set correctly202   - Verify key is active in Google AI Studio203 2042. **Import Errors**:205   - Check Python version (3.8+)206   - Reinstall requirements: `pip install -r requirements.txt`207 2083. **Performance Issues**:209   - Enable caching in settings210   - Reduce chunk size for large documents211   - Clear cache periodically212 2134. **Upload Failures**:214   - Check file size limits (10MB default)215   - Verify file format is supported216   - Ensure sufficient disk space217 218### Support219 220For issues and questions:221- Check the troubleshooting section222- Review configuration settings223- Ensure all dependencies are installed correctly224 225---226 227Built with โค๏ธ using LangChain, LlamaIndex, and Google Gemini API