Skip to content

Varsha-1605/Document-Uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 OmniQuery: Document Intelligence Platform

OmniQuery Logo

Python Streamlit LangChain License

πŸ“‹ Table of Contents

🌟 Overview

OmniQuery is an AI-powered document intelligence platform that allows users to upload documents and interact with them through natural language queries. Built with Streamlit, LangChain, and OpenAI's GPT models, OmniQuery extracts, processes, and analyzes information from your documents, providing intelligent answers to your questions in real-time.

✨ Features

🎯 Core Features

  • πŸ“‚ Multi-Format Support: Upload PDF, DOCX, TXT, and Markdown files
  • πŸ€– AI-Powered Q&A: Ask questions in natural language and get intelligent responses
  • πŸ’Ύ Vector Store: Efficient document embedding using ChromaDB for fast retrieval
  • πŸ’¬ Conversation Memory: Maintains context throughout your chat session
  • πŸ“Š Feedback System: Rate responses and visualize feedback analytics
  • πŸ“₯ Export Functionality: Download complete chat history as JSON

🎨 UI/UX Features

  • πŸŒ™ Modern Dark Theme: Sleek cyberpunk-inspired interface with gradient effects
  • ⚑ Real-time Processing: Live progress indicators during document processing
  • πŸ“ˆ Visual Analytics: Interactive feedback distribution charts using Plotly
  • 🎚️ Temperature Control: Adjust AI response creativity with temperature slider
  • ✨ Smooth Animations: Hover effects and transitions for better user experience

πŸ”§ Technical Features

  • πŸ”„ Retry Logic: Robust error handling with exponential backoff
  • πŸ“¦ Chunking Strategy: Smart document splitting for optimal processing
  • πŸ—„οΈ Session State Management: Persistent state across interactions
  • πŸ” Secure API Integration: Environment-based configuration for API keys
  • πŸ› SQLite Compatibility: Uses pysqlite3 for ChromaDB compatibility

πŸŽ₯ Demo

OmniQuery Demo

Upload a document, ask questions, and get instant AI-powered answers!

πŸš€ Installation

Prerequisites

  • Python 3.8 or higher
  • OpenAI API key
  • Git (optional)

Step 1: Clone the Repository

git clone https://github.com/Varsha-1605/Document-Uploader.git
cd Document-Uploader

Step 2: Create Virtual Environment (Recommended)

# Windows
python -m venv venv
venv\Scripts\activate

# macOS/Linux
python3 -m venv venv
source venv/bin/activate

Step 3: Install Dependencies

pip install -r requirements.txt

βš™οΈ Configuration

Environment Setup

Create a .env file in the root directory or configure Streamlit secrets:

Option 1: Using .env file

OPENAI_API_KEY=your_openai_api_key_here

Option 2: Using Streamlit Secrets Create .streamlit/secrets.toml:

OPENAI_API_KEY = "your_openai_api_key_here"

Getting OpenAI API Key

  1. Visit OpenAI Platform
  2. Sign up or log in
  3. Navigate to API Keys section
  4. Create a new API key
  5. Copy and use in your configuration

πŸ’» Usage

Running the Application

streamlit run final_document_uploader.py

The application will open in your default browser at http://localhost:8501

Step-by-Step Guide

  1. πŸ“‚ Upload a Document

    • Click "Browse files" in the sidebar
    • Select a PDF, DOCX, TXT, or MD file
    • Wait for processing to complete
  2. 🌑️ Adjust Settings (Optional)

    • Use the temperature slider (0.0 - 1.0)
    • Lower values: More focused/consistent responses
    • Higher values: More creative/varied responses
  3. ❓ Ask Questions

    • Type your question in the text input
    • Click "Generate Response" or press Enter
    • View the AI-generated answer
  4. πŸ‘πŸ‘Ž Provide Feedback

    • Rate each response as helpful or not helpful
    • View analytics in the feedback visualization chart
  5. πŸ“₯ Export Chat History

    • Click "Export Chat History" to download as JSON
    • Preserve your conversation for future reference

πŸ“„ Supported File Types

File Type Extension Loader Used
PDF .pdf PyPDFLoader
Word Document .docx UnstructuredWordDocumentLoader
Text File .txt UnstructuredFileLoader
Markdown .md UnstructuredFileLoader

πŸ› οΈ Technology Stack

Frontend

  • Streamlit: Web application framework
  • Custom CSS: Cyberpunk-themed dark UI

AI & ML

  • OpenAI GPT-3.5-turbo: Language model for Q&A
  • OpenAI Embeddings: Document vectorization
  • LangChain: LLM application framework

Data Processing

  • ChromaDB: Vector database for embeddings
  • Unstructured: Document parsing
  • PyPDF: PDF processing
  • python-docx: Word document handling

Utilities

  • Tenacity: Retry logic and error handling
  • Pandas: Data manipulation
  • Plotly: Interactive visualizations
  • pysqlite3: SQLite compatibility

πŸ“ Project Structure

Document-Uploader/
β”‚
β”œβ”€β”€ final_document_uploader.py    # Main application file
β”œβ”€β”€ requirements.txt              # Python dependencies
β”œβ”€β”€ New_logo.png                 # Application logo
β”œβ”€β”€ .env                         # Environment variables (create this)
β”œβ”€β”€ .gitignore                   # Git ignore rules
β”œβ”€β”€ README.md                    # Project documentation
β”‚
β”œβ”€β”€ .devcontainer/               # Dev container configuration
β”‚   └── devcontainer.json
β”‚
└── temp_docs/                   # Temporary document storage

πŸ” How It Works

1. Document Processing Pipeline

graph LR
A[Upload Document] --> B[Load Document]
B --> C[Split into Chunks]
C --> D[Generate Embeddings]
D --> E[Store in ChromaDB]
E --> F[Create Vector Store]
Loading

2. Query Processing

User Query β†’ Agent Executor β†’ Vector Store Search β†’ Retrieve Relevant Chunks β†’ 
LLM Processing β†’ Generate Answer β†’ Stream Response β†’ Display to User

3. Key Components

Document Loading

def load_document(file_path):
    # Automatically detects file type and uses appropriate loader
    # Supports PDF, DOCX, TXT, MD

Text Chunking

  • Chunk Size: 1000 characters
  • Overlap: 200 characters
  • Strategy: RecursiveCharacterTextSplitter

Vector Store

  • Database: ChromaDB
  • Embeddings: OpenAI Ada-002
  • Collection: document_store

Agent

  • Type: VectorStore Agent
  • Memory: ConversationBufferMemory
  • Callbacks: Streamlit streaming handler

πŸ“Š Features in Detail

Temperature Control

Controls the randomness of AI responses:

  • 0.0: Deterministic, focused answers
  • 0.7: Balanced (default)
  • 1.0: Creative, varied responses

Feedback Analytics

  • Visual pie chart showing response helpfulness
  • Real-time feedback collection
  • Exportable feedback data

Conversation Memory

  • Maintains context across multiple questions
  • Stores full chat history in session state
  • Exportable as JSON for record-keeping

🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the Repository

    git fork https://github.com/Varsha-1605/Document-Uploader.git
  2. Create a Feature Branch

    git checkout -b feature/AmazingFeature
  3. Commit Your Changes

    git commit -m 'Add some AmazingFeature'
  4. Push to the Branch

    git push origin feature/AmazingFeature
  5. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guidelines
  • Add comments for complex logic
  • Test thoroughly before submitting PR
  • Update documentation as needed

πŸ› Known Issues & Limitations

  • Large documents (>50 pages) may take longer to process
  • API rate limits apply based on OpenAI plan
  • Temporary files created during upload are automatically cleaned up
  • Session state is lost on browser refresh

πŸ”œ Future Enhancements

  • Support for more file formats (CSV, Excel, PPT)
  • Multi-document upload and querying
  • Document comparison features
  • Advanced search filters
  • User authentication and saved sessions
  • Export to different formats (PDF, Word)
  • Support for other LLM providers
  • Cloud deployment options

πŸ“ License

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

πŸ“§ Contact

Varsha

πŸ™ Acknowledgments


⭐ Star this repository if you find it helpful!

Made with ❀️ using Streamlit and LangChain

About

A secure and efficient document uploader application that leverages retrieval-augmented generation (RAG) systems, OpenAI, and LangChain to allow users to upload, store, and manage documents while enabling personalized queries on the uploaded content.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages