Skip to content

pushpendra-tripathi/docwhisperer

Repository files navigation

DocWhisperer

A powerful document question-answering system using RAG (Retrieval Augmented Generation) technology. This application allows users to upload PDF documents and ask questions about their contents, receiving accurate answers based on the document context.

DocWhisperer Home

Example Response Interface

DocWhisperer Response

Features

  • 📚 PDF document processing and storage
  • 🔍 Semantic search using vector embeddings
  • 🤖 Advanced LLM-based question answering
  • 💻 User-friendly web interface
  • 📊 Source tracking and analysis details
  • ⚡ Performance optimizations with caching
  • 🛡️ Robust error handling and logging

Prerequisites

  • Python 3.8+
  • Ollama installed and running locally
  • Sufficient disk space for document storage and vector embeddings

Installation

  1. Clone the repository:
git clone https://github.com/pushpendra-tripathi/docwhisperer.git
cd docwhisperer
  1. Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Create a .env file (optional):
CHROMA_PATH=chroma
DATA_PATH=data
DEFAULT_MODEL=deepseek-r1:1.5b
EMBEDDING_MODEL=snowflake-arctic-embed2
CHUNK_SIZE=800
CHUNK_OVERLAP=80
TOP_K_RESULTS=20
TEMPERATURE=0.0

Usage

  1. Start the web application:
streamlit run app.py
  1. Open your browser and navigate to the provided URL (typically http://localhost:8501)

  2. Use the sidebar to:

    • Upload PDF documents
    • Process uploaded documents
    • Reset the database if needed
  3. Ask questions in the chat interface about the uploaded documents

Project Structure

  • app.py: Main Streamlit web application
  • query_data.py: Core RAG query engine implementation
  • populate_database.py: Document processing and database management
  • config.py: Configuration settings
  • get_embedding_function.py: Embedding model configuration
  • test_rag.py: Test suite for RAG functionality

Configuration

The application can be configured through environment variables or the config.py file:

  • CHROMA_PATH: Directory for vector store
  • DATA_PATH: Directory for uploaded documents
  • DEFAULT_MODEL: Ollama model for question answering
  • EMBEDDING_MODEL: Model for document embeddings
  • CHUNK_SIZE: Document chunk size for processing
  • CHUNK_OVERLAP: Overlap between chunks
  • TOP_K_RESULTS: Number of relevant chunks to retrieve
  • TEMPERATURE: LLM temperature setting

Performance Optimization

The application includes several performance optimizations:

  • LRU caching for document retrieval
  • Efficient document chunking
  • Optimized vector similarity search
  • Retries for LLM queries
  • Streamlined UI updates

Error Handling

The application implements comprehensive error handling:

  • Graceful handling of upload errors
  • Retry mechanism for LLM queries
  • Detailed error logging
  • User-friendly error messages
  • Database state validation

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

DocWhisperer is a powerful document question-answering system using RAG (Retrieval Augmented Generation) technology. It allows users to upload documents and ask questions, receiving accurate answers based on document context with semantic search and LLM integration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages