Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

DreamWeave Brain 🧠✨

An intelligent document ingestion and retrieval system that forms the AI backbone of the DreamWeave project.

The system accepts multiple content formats, extracts information from them, structures the data, generates embeddings, and eventually enables context-aware conversational retrieval (RAG).


System Architecture

User Upload
     │
     ▼
File Processor
     │
     ├── Image → OCR
     ├── PDF → Text Extraction / OCR Fallback
     ├── Notes → Raw Text
     │
     ▼
Raw Text
     │
     ▼
AI Cleanup / Structuring
     │
     ▼
Clean Text
     │
     ▼
Embedding Generator
     │
     ▼
Vector Store
     │
     ▼
Retriever
     │
     ▼
LLM
     │
     ▼
Answer

Supported Upload Types

Images

  • PNG
  • JPG / JPEG
  • WEBP
  • Other PIL-supported image formats

Documents

  • PDF (text PDFs)
  • Scanned PDFs (OCR fallback)

Notes

  • Plain text files
  • User-entered notes

Current Pipeline

Step 1 : Upload Content

Supported inputs:

  • Images
  • PDFs
  • Notes

Files are stored locally in:

uploads/

Step 2 : Text Extraction

Images

Image
↓
Tesseract OCR
↓
Raw Text

PDFs

Text-based PDFs

PDF
↓
Direct Text Extraction
↓
Raw Text

Scanned PDFs

PDF
↓
No Text Found
↓
Convert Pages To Images
↓
OCR
↓
Raw Text

Temporary page images are created in the background using Python's tempfile module and automatically deleted after OCR.


Notes

Notes
↓
Raw Text

No extraction required.


Step 3 : Document Normalization

All extracted content is stored using a unified document structure.

Example:

{
    "id": 1782210867,
    "source": "image",
    "filename": "test.png",

    "raw_content": "...",
    "clean_content": "",

    "metadata": {
        "ocr_used": true,
        "page_count": 1,
        "language": "en",
        "ocr_engine": "tesseract"
    },

    "timestamp": "2026-06-23 16:04:27"
}

Step 4 : AI Cleanup & Structuring (Upcoming)

Pipeline:

Raw Text
↓
LLM Cleanup
↓
Clean Text

Examples:

  • Reconstruct menus
  • Fix OCR errors
  • Preserve structure
  • Improve formatting
  • Enhance semantic quality before embedding generation

Both raw_content and clean_content are preserved.


Step 5 : Embedding Generation (Upcoming)

Text
↓
SentenceTransformer
↓
Vector Embeddings

Embeddings will be generated primarily from:

clean_content

with fallback to:

raw_content

Step 6 : Vector Storage (Upcoming)

Embeddings and metadata will initially be stored locally.

Future migration:

  • PostgreSQL
  • pgvector

Step 7 : Semantic Search (Upcoming)

Query
↓
Embedding
↓
Cosine Similarity
↓
Relevant Documents

Purpose:

  • Intelligent search
  • Context retrieval
  • Recommendation engine support

Step 8 : Retrieval-Augmented Generation (RAG)

User Query
↓
Semantic Search
↓
Relevant Documents
↓
Prompt Construction
↓
LLM
↓
Answer

The LLM answers using only the retrieved context from uploaded data.


OCR Roadmap

Current OCR Engine

Tesseract OCR

Advantages:

  • Lightweight
  • Fast
  • Good for clean screenshots and documents

Future OCR Engine

EasyOCR

Potential use cases:

  • Stylized fonts
  • Menus
  • Posters
  • Multilingual text
  • Symbols and currencies
  • Complex backgrounds

Future architecture:

Image
↓
Simple Document?
    ↓ yes → Tesseract
    ↓ no
       EasyOCR

Future Features

  • Automatic language detection
  • Multi-language OCR
  • Emoji support
  • Document chunking
  • Metadata extraction
  • Summarization
  • Recommendation engine
  • Vision boards
  • Collaborative AI search
  • Full RAG-powered assistant

Final System Flow

UPLOAD
   ↓
TEXT EXTRACTION (RAW TEXT)
   ↓
AI CLEANUP / STRUCTURING
   ↓
CLEAN TEXT
   ↓
EMBEDDINGS
   ↓
VECTOR STORAGE
   ↓
SEMANTIC SEARCH
   ↓
RAG
   ↓
CHAT RESPONSE

About

DreamWeave is an AI-powered collaborative workspace for sharing boards (travel itinerary, bucket lists, moodboards). Simply save content from anywhere like images, videos, PDFs, links, social media, or local files; AI organizes everything semantically to offer smart planning assistance, vision boards, context-aware chat, and seamless planning.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages