Skip to content

vijaykushwaha-03/AI-Research_Assistance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 AI Research Assistant

Python Streamlit LangChain Gemini AI

A sophisticated AI-powered research assistant that transforms static PDF documents into interactive knowledge sources. Built with cutting-edge technologies, this application enables users to upload research papers, academic articles, and technical documents, then engage in natural language conversations about their content using advanced retrieval-augmented generation (RAG) techniques.

🌟 Vision & Purpose

In an era of information overload, researchers, students, and professionals often struggle to extract insights from lengthy documents efficiently. The AI Research Assistant bridges this gap by combining:

  • Intelligent Document Processing: Advanced PDF parsing and text chunking
  • Semantic Understanding: Vector embeddings for context-aware information retrieval
  • Conversational AI: Natural language interactions powered by Google's Gemini AI
  • User-Centric Design: Intuitive Streamlit interface for seamless user experience

This project demonstrates expertise in modern AI/ML engineering, full-stack development, and the practical application of large language models to solve real-world information access challenges.

✨ Key Features

  • 📄 Advanced PDF Processing: Robust text extraction from complex document layouts
  • 🧠 Intelligent Q&A System: Context-aware responses using retrieval-augmented generation
  • 🔍 Semantic Search: High-performance vector similarity search with FAISS
  • 💬 Interactive Interface: Modern web UI built with Streamlit
  • Real-time Processing: Efficient document indexing and query response
  • 🔧 Configurable Parameters: Adjustable chunk size, AI temperature, and processing settings
  • 📊 Source Transparency: Display of relevant document sections for answer verification
  • 🛡️ Error Handling: Comprehensive validation and user-friendly error messages

🛠️ Technology Stack

Core Frameworks

  • Frontend: Streamlit 1.50.0 - Interactive web application framework
  • AI/ML Pipeline: LangChain 0.3.27 - Orchestration of LLM applications
  • Large Language Model: Google Gemini 2.0-flash - Advanced conversational AI

Data Processing & Storage

  • Vector Database: FAISS 1.12.0 - High-performance similarity search
  • Embeddings: HuggingFace Sentence Transformers (all-MiniLM-L6-v2)
  • Document Processing: PyPDF2 3.0.1 - PDF text extraction and parsing

Development & Deployment

  • Programming Language: Python 3.13+
  • Environment Management: python-dotenv 1.0.1
  • Version Control: Git
  • Package Management: pip

📁 Project Architecture

AI-Research-assistant/
├── app.py                    # Main Streamlit application and UI orchestration
├── requirements.txt          # Comprehensive dependency management
├── .env                      # Secure environment variable configuration
├── README.md                 # Project documentation and setup guide
├── LICENSE                   # MIT License terms
├── run.sh / run.bat          # Cross-platform application launchers
├── setup.sh / setup.bat      # Automated environment setup scripts
└── utils/                    # Modular utility components
    ├── __init__.py
    ├── pdf_loader.py         # PDF document ingestion and text extraction
    ├── text_splitter.py      # Intelligent document chunking strategies
    ├── vector_store.py       # FAISS vector database creation and management
    └── qa_chain.py           # Retrieval-augmented generation pipeline

🚀 Quick Start Guide

Prerequisites

Before installation, ensure your system meets these requirements:

  • Python Version: 3.13 or higher
  • System Memory: Minimum 4GB RAM (8GB recommended for large documents)
  • Internet Connection: Required for API calls and model downloads
  • Google AI API Key: Obtain from Google AI Studio

Installation

Option 1: Automated Setup (Recommended)

Linux/macOS:

git clone https://github.com/vijaykushwaha-03/AI-Research_Assistance.git
cd AI-Research-assistant
chmod +x setup.sh
./setup.sh

Windows:

git clone https://github.com/vijaykushwaha-03/AI-Research_Assistance.git
cd AI-Research-assistant
setup.bat

Option 2: Manual Setup

  1. Clone the Repository

    git clone https://github.com/vijaykushwaha-03/AI-Research_Assistance.git
    cd AI-Research-assistant
  2. Create Virtual Environment

    # Linux/macOS
    python -m venv venv
    source venv/bin/activate
    
    # Windows
    python -m venv venv
    venv\Scripts\activate
  3. Install Dependencies

    pip install -r requirements.txt
  4. Configure Environment Variables Create a .env file in the project root:

    GOOGLE_API_KEY=your_google_ai_api_key_here
    GEMINI_MODEL=gemini-2.0-flash
    TEMPERATURE=0.7

Launch Application

Linux/macOS:

./run.sh

Windows:

run.bat

Manual Launch:

streamlit run app.py

Navigate to http://localhost:8501 in your web browser.

⚙️ Configuration

Environment Variables

Variable Description Default Required
GOOGLE_API_KEY Google AI Studio API key - Yes
GEMINI_MODEL Gemini model version gemini-2.0-flash No
TEMPERATURE AI response creativity (0.0-1.0) 0.7 No

Runtime Parameters

Adjust these settings through the Streamlit sidebar:

  • Chunk Size: Text segment length (500-2000 characters)
  • Chunk Overlap: Overlap between segments (0-500 characters)
  • AI Temperature: Response randomness (0.0-1.0)

💡 Usage Guide

Basic Workflow

  1. Document Upload

    • Click "Upload a PDF document"
    • Select your research paper or document (max 10MB)
    • Wait for processing confirmation
  2. Ask Questions

    • Enter natural language queries in the text input
    • Examples:
      • "What is the main hypothesis of this study?"
      • "Summarize the methodology section"
      • "What are the key findings and conclusions?"
  3. Review Responses

    • Read AI-generated answers
    • Expand "Source Information" to verify context
    • Ask follow-up questions for deeper insights

Advanced Features

  • Multi-turn Conversations: Reference previous context in follow-up questions
  • Source Verification: Always check source documents for critical information
  • Parameter Tuning: Adjust settings based on document complexity

🔧 Development & Extension

Code Structure Overview

  • app.py: Main application logic, UI components, and workflow orchestration
  • utils/pdf_loader.py: Document ingestion with error handling and validation
  • utils/text_splitter.py: Configurable text chunking with overlap management
  • utils/vector_store.py: Embedding generation and FAISS database operations
  • utils/qa_chain.py: RAG pipeline implementation with Gemini AI integration

Extending Functionality

Adding New Document Types

# In pdf_loader.py, extend for additional formats
from langchain_community.document_loaders import Docx2txtLoader

def load_document(file_path, file_type):
    if file_type == 'pdf':
        return PyPDFLoader(file_path).load()
    elif file_type == 'docx':
        return Docx2txtLoader(file_path).load()

Integrating Alternative AI Models

# In qa_chain.py, add model selection
def create_qa_chain(vector_store, model_provider='gemini'):
    if model_provider == 'openai':
        llm = ChatOpenAI(model="gpt-4", temperature=temperature)
    elif model_provider == 'gemini':
        llm = ChatGoogleGenerativeAI(model=model_name, temperature=temperature)

Testing & Validation

Run the test suite:

python -m pytest tests/

Validate document processing:

python -c "from utils.pdf_loader import load_pdf; print(len(load_pdf('sample.pdf')))"

🐛 Troubleshooting

Common Issues & Solutions

Issue Symptom Solution
API Key Error "Google AI API key not found" Verify .env file exists and contains valid key
Import Errors "Module not found" Run pip install -r requirements.txt in activated virtual environment
PDF Processing Failure "Failed to extract text" Ensure PDF is not image-based; try converting to searchable PDF
Memory Issues Application crashes on large files Reduce chunk size in settings or increase system RAM
CUDA Warning "CUDA not available" Normal behavior; application uses CPU fallback

Performance Optimization

  • Large Documents: Increase chunk overlap for better context preservation
  • Slow Responses: Reduce chunk size or use smaller embedding models
  • Memory Usage: Process documents in batches for very large files

📊 Technical Specifications

Performance Metrics

  • Document Processing: ~2-5 seconds per MB of PDF content
  • Query Response Time: 3-8 seconds for typical questions
  • Memory Usage: 500MB-2GB depending on document size
  • Concurrent Users: Single-user application (can be scaled with session management)

Supported Formats

  • PDF documents with embedded text
  • File size limit: 10MB per document
  • Languages: English (primary), with multi-language model support

🤝 Contributing

We welcome contributions that enhance the project's capabilities and user experience.

Development Workflow

  1. Fork the Repository

    git clone https://github.com/your-username/AI-Research_Assistance.git
  2. Create Feature Branch

    git checkout -b feature/enhanced-pdf-processing
  3. Implement Changes

    • Follow existing code style and documentation patterns
    • Add comprehensive tests for new functionality
    • Update README for significant feature additions
  4. Submit Pull Request

    • Provide detailed description of changes
    • Reference related issues if applicable
    • Ensure all tests pass

Contribution Guidelines

  • Code Quality: Maintain PEP 8 standards and add type hints
  • Documentation: Update docstrings and README for API changes
  • Testing: Add unit tests for new components
  • Compatibility: Ensure cross-platform compatibility

📄 License

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

🙏 Acknowledgments

  • LangChain Team: For the comprehensive LLM application framework
  • Google AI: For providing access to powerful Gemini models
  • Streamlit Community: For the intuitive web application framework
  • HuggingFace: For open-source transformer models and embeddings
  • FAISS Team: For high-performance similarity search capabilities

📞 Let's Connect

Hi, I'm Vijay Kumar Kushwaha! I'm passionate about leveraging AI to solve real-world problems and democratize access to information. As an AI enthusiast, I'm deeply committed to exploring the transformative potential of Machine Learning, Large Language Models, and Generative AI technologies. I'm eager to learn and innovate in the rapidly evolving field of artificial intelligence.

This AI Research Assistant represents my expertise in:

  • Full-Stack AI Development: Integrating LLMs, vector databases, and modern web frameworks
  • Retrieval-Augmented Generation: Implementing state-of-the-art RAG pipelines
  • Production-Ready Applications: Building scalable, user-friendly AI solutions
  • Research & Innovation: Applying cutting-edge AI techniques to practical challenges

Portfolio & Professional Links

Featured Projects

Explore my other AI/ML projects:

  • NLP Text Analyzer: Advanced text processing and sentiment analysis
  • Computer Vision Classifier: Deep learning image recognition systems
  • Data Science Dashboards: Interactive analytics and visualization tools

Transforming Research Through AI 🚀

Built with ❤️ by Vijay Kumar Kushwaha using Python, Streamlit, and Google's Gemini AI

About

A powerful AI-powered research assistant that allows you to upload PDF documents and ask intelligent questions about their content. Built with Streamlit, LangChain, and Google's Gemini AI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors