CoolFace
Apppublic

dev-arpit5462/augmented-research-assistant

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

sdk: streamlit

๐Ÿ” Augmented Research Assistant

A 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.

โœจ Features

  • โ€”Modern Dark UI: Professional dark theme with smooth animations and responsive design
  • โ€”Multi-format Support: Upload PDF, TXT, DOCX, and Markdown files
  • โ€”Intelligent RAG Pipeline: LangChain orchestration with LlamaIndex document processing
  • โ€”Google Gemini Integration: Powered by Google's latest Gemini API for inference and embeddings
  • โ€”Vector Search: ChromaDB for efficient document retrieval
  • โ€”Source Attribution: Display retrieved chunks to prevent hallucinations
  • โ€”Smart Caching: Embedding and query caching for improved performance
  • โ€”Chat Interface: Interactive chat with conversation history
  • โ€”Document Management: Upload, process, and manage your knowledge base

๐Ÿ—๏ธ Architecture

โ”œโ”€โ”€ config/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ settings.py          # Configuration management
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ rag_chain.py         # LangChain RAG orchestration
โ”œโ”€โ”€ services/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ document_processor.py # LlamaIndex document loaders
โ”‚   โ””โ”€โ”€ vector_store.py      # ChromaDB + LangChain integration
โ”œโ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ cache_manager.py     # Performance caching
โ”œโ”€โ”€ app.py                   # Streamlit frontend
โ”œโ”€โ”€ requirements.txt         # Dependencies
โ””โ”€โ”€ README.md               # This file

๐Ÿš€ Tech Stack

  • โ€”Frontend: Streamlit with custom dark theme CSS
  • โ€”Orchestration: LangChain for RAG pipeline management
  • โ€”Document Processing: LlamaIndex for intelligent chunking and loading
  • โ€”LLM & Embeddings: Google Gemini API (free tier)
  • โ€”Vector Database: ChromaDB (local, no external dependencies)
  • โ€”Caching: Custom caching system for performance optimization

๐Ÿ“‹ Prerequisites

  • โ€”Python 3.8+
  • โ€”Google API Key (free from Google AI Studio)

๐Ÿ› ๏ธ Installation

  1. 1.Clone the repository:
bash
git clone <repository-url>
cd augmented-research-assistant
  1. 1.Create virtual environment:
bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. 1.Install dependencies:
bash
pip install -r requirements.txt
  1. 1.Set up Google API Key:
  2. 2.Visit Google AI Studio
  3. 3.Create a new API key (free, no credit card required)
  4. 4.Set environment variable:
bash
   export GOOGLE_API_KEY="your_api_key_here"

Or create a .env file:

   GOOGLE_API_KEY=your_api_key_here

๐ŸŽฏ Usage

  1. 1.Start the application:
bash
streamlit run app.py
  1. 1.Upload Documents:
  2. 2.Use the sidebar to upload PDF, TXT, DOCX, or MD files
  3. 3.Documents are automatically processed and indexed
  1. 1.Ask Questions:
  2. 2.Type questions in the chat interface
  3. 3.Get AI-powered answers with source citations
  4. 4.View retrieved document chunks for transparency

๐Ÿ”ง Configuration

Modify config/settings.py to customize:

  • โ€”Chunk Settings: CHUNK_SIZE, CHUNK_OVERLAP
  • โ€”Retrieval: TOP_K_RETRIEVAL
  • โ€”Model Parameters: TEMPERATURE, MAX_TOKENS
  • โ€”Caching: ENABLE_CACHING, CACHE_TTL

๐Ÿ“Š Features Breakdown

Document Processing

  • โ€”LlamaIndex Loaders: Specialized loaders for each file type
  • โ€”Smart Chunking: Overlapping chunks for better context retention
  • โ€”Metadata Preservation: File names and chunk information maintained

Vector Storage

  • โ€”ChromaDB Integration: Local vector database via LangChain
  • โ€”Embedding Caching: Avoid recomputing embeddings for performance
  • โ€”Deduplication: Prevent duplicate document processing

RAG Pipeline

  • โ€”Context-Aware Retrieval: Top-k similarity search
  • โ€”Hallucination Prevention: Strict context-only responses
  • โ€”Source Attribution: Display retrieved chunks with relevance scores

User Experience

  • โ€”Dark Mode: Professional dark theme with gradients
  • โ€”Responsive Design: Works on desktop and mobile
  • โ€”Real-time Processing: Progress bars and status updates
  • โ€”Chat History: Persistent conversation memory

๐Ÿš€ Deployment

Streamlit Community Cloud

  1. 1.Push to GitHub:
bash
git add .
git commit -m "Initial commit"
git push origin main
  1. 1.Deploy on Streamlit Cloud:
  2. 2.Visit share.streamlit.io
  3. 3.Connect your GitHub repository
  4. 4.Add GOOGLE_API_KEY in secrets management
  5. 5.Deploy!

Local Production

bash
streamlit run app.py --server.port 8501 --server.address 0.0.0.0

๐ŸŽจ Customization

Styling

  • โ€”Modify CSS in app.py load_custom_css() function
  • โ€”Adjust colors, animations, and layout

Models

  • โ€”Change Gemini model in core/rag_chain.py
  • โ€”Adjust embedding model in services/vector_store.py

Processing

  • โ€”Modify chunk parameters in config/settings.py
  • โ€”Add new file type support in services/document_processor.py

๐Ÿ” Resume Highlights

This project demonstrates:

  • โ€”Modern AI Stack: LangChain + LlamaIndex + Gemini API integration
  • โ€”Production Architecture: Modular, scalable design with separation of concerns
  • โ€”Performance Optimization: Caching, efficient chunking, and vector search
  • โ€”User Experience: Professional UI/UX with dark theme and animations
  • โ€”Free Tier Usage: Entirely built on free APIs (no credit card required)

๐Ÿค Contributing

  1. 1.Fork the repository
  2. 2.Create a feature branch
  3. 3.Make your changes
  4. 4.Add tests if applicable
  5. 5.Submit a pull request

๐Ÿ“ License

MIT License - see LICENSE file for details.

๐Ÿ†˜ Troubleshooting

Common Issues

  1. 1.API Key Error:
  2. 2.Ensure GOOGLE_API_KEY is set correctly
  3. 3.Verify key is active in Google AI Studio
  1. 1.Import Errors:
  2. 2.Check Python version (3.8+)
  3. 3.Reinstall requirements: pip install -r requirements.txt
  1. 1.Performance Issues:
  2. 2.Enable caching in settings
  3. 3.Reduce chunk size for large documents
  4. 4.Clear cache periodically
  1. 1.Upload Failures:
  2. 2.Check file size limits (10MB default)
  3. 3.Verify file format is supported
  4. 4.Ensure sufficient disk space

Support

For issues and questions:

  • โ€”Check the troubleshooting section
  • โ€”Review configuration settings
  • โ€”Ensure all dependencies are installed correctly

Built with โค๏ธ using LangChain, LlamaIndex, and Google Gemini API