Skip to content

hzjanuary/easyResearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 easyResearch - AI Research Assistant

Advanced Research Assistant powered by RAG (Retrieval-Augmented Generation)


πŸ“– Introduction

easyResearch is an AI application that helps you query and ask questions on your own documents. The system uses advanced RAG technology to:

  • πŸ“„ Read and analyze documents (PDF, DOCX, TXT, Code)
  • πŸ” Hybrid Search (Vector + BM25 keyword search)
  • πŸ’¬ Answer questions based on document content
  • 🌍 Multi-language support (Vietnamese & English)
  • 🎯 Cross-Encoder Reranking for better accuracy

✨ Features

Feature Description
πŸ“‚ Workspace Management Organize documents by project/topic separately
πŸ“₯ Multi-format Import Support PDF, DOCX, TXT, Python code
🧠 Parent Document Small chunks for search, large chunks for context
⚑ GPU Acceleration Optimized for NVIDIA GPU (CUDA)
πŸ”‘ Multi-LLM Support Groq (LLaMA 3.3) or Google Gemini
🌐 RESTful API Easy integration via FastAPI
🎨 AnythingLLM Theme Dark zinc UI inspired by AnythingLLM
πŸ“Š Workspace Stats Mini stat cards (docs, vectors, storage size)
πŸ“ Auto-Summarizer Automatic summary generation after document upload
πŸ”„ Smart Context Only contextualize when needed (faster response)
πŸ’¬ Chat Persistence Auto-save/load chat history per workspace
🎚️ Context Depth Fast / Accurate / Detailed search modes
πŸ—‘οΈ File Management Delete individual files from workspace
πŸ• Recent Questions Quick access to recent queries in sidebar

πŸ—οΈ System Architecture

easyResearch/
β”œβ”€β”€ app.py              # Streamlit Interface (Web UI)
β”œβ”€β”€ main.py             # FastAPI Server (REST API)
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ loader.py       # Parent Document Retrieval & Smart Splitter
β”‚   β”œβ”€β”€ embedder.py     # Vectorization & ChromaDB Management
β”‚   β”œβ”€β”€ generator.py    # Advanced RAG Pipeline
β”‚   └── summarizer.py   # Auto-Summarization
β”œβ”€β”€ database/
β”‚   β”œβ”€β”€ chroma_db/      # Vector Database Storage
β”‚   └── chat_history/   # Persistent Chat History (JSON per workspace)
└── uploads/            # Temporary File Storage

Tech Stack

  • LLM: Groq (LLaMA 3.3 70B) or Google Gemini 2.0 Flash
  • Embedding: HuggingFace paraphrase-multilingual-MiniLM-L12-v2
  • Reranker: CrossEncoder ms-marco-MiniLM-L-6-v2
  • Vector DB: ChromaDB
  • Keyword Search: BM25 (rank-bm25)
  • Framework: LangChain, Streamlit, FastAPI

πŸ”¬ Advanced RAG Pipeline

Question β†’ Smart Contextualization β†’ Vector Search
                                          ↓
                                    BM25 Scoring
                                          ↓
                              Cross-Encoder Reranking
                                          ↓
               Hybrid Score (0.7Γ—Rerank + 0.3Γ—BM25)
                                          ↓
                 Parent Document Retrieval β†’ LLM Answer

Key Optimizations

Component Benefit
Hybrid Search Combines semantic + keyword matching
Parent Document Small chunks (400) for search, large (2000) for context
Smart Contextualization Only calls LLM when pronouns/references detected
Cross-Encoder Local reranking (no API calls)

πŸš€ Installation

System Requirements

  • Python 3.10+
  • NVIDIA GPU with CUDA (recommended) or CPU

Installation Steps

  1. Clone repository

    git clone https://github.com/your-username/easyResearch.git
    cd easyResearch
  2. Create virtual environment

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

    pip install -r requirements.txt
  4. Configure API Key

    Create a .env file in the root directory:

    GROQ_API_KEY=your_groq_api_key_here
    GOOGLE_API_KEY=your_gemini_api_key_here  # Optional

    πŸ’‘ Get Groq API Key at console.groq.com πŸ’‘ Get Gemini API Key at aistudio.google.com/apikey

πŸ“– Usage Guide

Run Web UI (Streamlit)

streamlit run app.py

Access: http://localhost:8501

Run REST API (FastAPI)

uvicorn main:app --reload

Access Swagger UI: http://localhost:8000/docs

πŸ”Œ API Endpoints

1. Question & Answer - POST /ask

{
  "question": "Your question here",
  "collection_name": "notebook_name",
  "k_target": 10,
  "api_key": "your_api_key_here"
}

Response:

{
  "answer": "AI generated answer",
  "sources": ["file1.pdf", "file2.docx"]
}

2. Upload Document - POST /upload

curl -X POST "http://localhost:8000/upload?collection_name=my_research" \
  -F "file=@document.pdf"

βš™οΈ Advanced Configuration

Parent Document Chunking

File Type Parent Size Child Size Notes
PDF, DOCX 2500 500 Preserve long text context
Code (.py, .js) 1500 400 Split by function/class
JSON, CSV 1000 300 Don't split mid-object
Default Text 2000 400 Balanced

Search Parameters

  • Hybrid Score: 0.7 Γ— Rerank + 0.3 Γ— BM25
  • Min Score Threshold: 0.1 (filter low relevance)

Context Depth Modes

Mode k (documents) Use Case
⚑ Fast 5 Quick answers, low latency
🎯 Accurate 10 Balanced (default)
πŸ“š Detailed 18 Deep research, comprehensive info

πŸ“ Workspace Management

  • Create New: Select "βž• New workspace…" from dropdown and name it
  • Switch: Select workspace from dropdown β€” badge shows active workspace
  • Delete Workspace: Go to βš™οΈ Settings tab β†’ "πŸ—‘ Delete workspace"
  • Delete File: Click βœ• next to any file in the πŸ“ Files list
  • Clear Chat: Go to βš™οΈ Settings tab β†’ "πŸ—‘ Clear chat"
  • Chat Persistence: Conversations auto-save per workspace and reload on switch
  • Recent Questions: Quick access to last 5 questions in sidebar
  • Auto-Summary: Generated automatically after uploading documents

Sidebar Layout

Tab / Section Function
πŸ“‚ Workspace Selector Select/create workspace with stats cards
πŸ“„ Documents Tab Upload files, view summary, file list with delete
πŸ” Recent Questions Quick-access to recent queries (in Documents tab)
βš™οΈ Settings Tab LLM provider, API key, clear chat, delete workspace
🎚️ Context Depth Fast / Accurate / Detailed radio pills (main area)

UI Theme

The interface uses an AnythingLLM-inspired dark theme:

Element Color Description
Sidebar #111111 Deep dark background
Main area #1c1c1f Slightly lighter dark
Inputs / Cards #27272a Zinc-800 for form elements
Borders #3f3f46 Subtle zinc-700 borders
Accent (buttons) #4f46e5 Indigo primary buttons
Chat input #303034 Unified single-color box
Font Inter Clean sans-serif via Google Fonts

Note: CSS targets specific selectors (not *) to preserve Streamlit's Material Symbols Rounded icons.

πŸ› οΈ Troubleshooting

Issue Solution
Missing API Key Create .env file or enter key in sidebar
CUDA Error Check NVIDIA driver or run on CPU
VRAM Overflow Reduce batch size in embedder.py
Slow Response Already optimized (1-2 LLM calls only)

πŸ“„ License

MIT License - See LICENSE file for more details.


Made with ❀️ by easyResearch

About

Adaptive Multilingual RAG system. Features LLaMA 3.3 integration, dynamic chunking, and notebook-based document management.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages