# amitmanchella/realestatellm architecture

> Architecture diagram of the GitHub repository amitmanchella/realestatellm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amitmanchella/realestatellm
- Repository: https://github.com/amitmanchella/realestatellm

## Overview

##### Project type and purpose
- This is a local LLM-based real-estate document analysis tool and chatbot, with an accompanying browser extension.
- It ingests PDF guides into a vector store, generates embeddings, provides an interactive CLI/chatbot, supports fine-tuning, and exposes an API for the extension.

##### File structure
Top-level directories and files:
- RealEstateLLM-Extension/        ← Browser extension UI & background scripts
- api/                            ← HTTP server (likely Flask or FastAPI) exposing search/chat endpoints
- data/                           ← Raw real-estate PDF documents
- data_processors.py             ← Preprocessing pipeline for text extraction
- enhanced_rag.py                ← Retrieval-Augmented-Generation orchestration
- fine_tuning.py                 ← Prepares data for LLM fine-tuning
- main.py                        ← CLI entrypoint (process, embeddings, chat, finetune)
- real_estate_chatbot.py         ← Chatbot logic and loop implementation
- requirements.txt               ← Python dependencies

##### README for additional insights
- Workflow steps: venv setup → document processing → embedding generation → chat launch → optional fine-tuning.
- The extension likely calls the API server (api/server.py) to deliver answers inside the browser.

##### Detail and coverage
- Two workflows: (1) preprocessing→embedding→chat, (2) preprocessing→embedding→finetune.
- That both CLI and extension share the same API/RAG layer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    subgraph "Clients"
        CLI["CLI Client"]:::client
        BE["Browser Extension"]:::client
    end

    CLI -->|"commands"| API
    BE -->|"HTTP requests"| API

    %% Serving Layer
    subgraph "Serving Layer"
        API["API Server"]:::service
        Orch["Retrieval & RAG Orchestrator"]:::service
        Chat["Chatbot Logic"]:::service
        LLM["LLM API"]:::external
    end

    API -->|"calls orchestrator"| Orch
    Orch -->|"queries Vector DB"| VectorDB
    Orch -->|"delegates to chat logic"| Chat
    Chat -->|"calls LLM"| LLM
    Chat -->|"returns answer"| Orch
    Orch -->|"responds"| API

    %% Local Processing Pipeline
    subgraph "Local Processing Pipeline"
        Docs["Document Store"]:::storage
        Pre["Preprocessing Module"]:::service
        Embed["Embedding Service"]:::service
        VectorDB["Vector Store"]:::storage
        Fine["Fine-Tuning Module"]:::service
    end

    Docs -->|"reads PDFs"| Pre
    Pre -->|"outputs cleaned text"| Embed
    Embed -->|"stores embeddings"| VectorDB
    Pre -->|"provides data"| Fine
    Embed -->|"provides embeddings"| Fine

    %% Browser Extension Components
    subgraph "Browser Extension UI"
        manifest["manifest.json"]:::service
        popupHTML["popup.html"]:::service
        bgJS["background.js"]:::service
        contentJS["content.js"]:::service
        popupJS["popup.js"]:::service
        styleCSS["overlay.css"]:::service
        icons["icons/README.txt"]:::service
    end

    %% Click events
    click Docs "https://github.com/amitmanchella/realestatellm/tree/main/data/"
    click Pre "https://github.com/amitmanchella/realestatellm/blob/main/data_processors.py"
    click Embed "https://github.com/amitmanchella/realestatellm/blob/main/enhanced_rag.py"
    click Orch "https://github.com/amitmanchella/realestatellm/blob/main/enhanced_rag.py"
    click Chat "https://github.com/amitmanchella/realestatellm/blob/main/real_estate_chatbot.py"
    click Fine "https://github.com/amitmanchella/realestatellm/blob/main/fine_tuning.py"
    click CLI "https://github.com/amitmanchella/realestatellm/blob/main/main.py"
    click API "https://github.com/amitmanchella/realestatellm/blob/main/api/server.py"
    click manifest "https://github.com/amitmanchella/realestatellm/blob/main/RealEstateLLM-Extension/manifest.json"
    click popupHTML "https://github.com/amitmanchella/realestatellm/blob/main/RealEstateLLM-Extension/popup.html"
    click bgJS "https://github.com/amitmanchella/realestatellm/blob/main/RealEstateLLM-Extension/scripts/background.js"
    click contentJS "https://github.com/amitmanchella/realestatellm/blob/main/RealEstateLLM-Extension/scripts/content.js"
    click popupJS "https://github.com/amitmanchella/realestatellm/blob/main/RealEstateLLM-Extension/scripts/popup.js"
    click styleCSS "https://github.com/amitmanchella/realestatellm/blob/main/RealEstateLLM-Extension/styles/overlay.css"
    click icons "https://github.com/amitmanchella/realestatellm/blob/main/RealEstateLLM-Extension/icons/README.txt"

    %% Styles
    classDef storage fill:#cde9c7,stroke:#2c662d,stroke-width:2px
    classDef service fill:#c7d8e9,stroke:#274472,stroke-width:2px
    classDef external fill:#f9e0c7,stroke:#a65c00,stroke-width:2px
    classDef client fill:#e9c7de,stroke:#702c5c,stroke-width:2px
```
