# knowrohit/alfred_local_gpt architecture

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

- Interactive diagram: https://gitdiagram.com/knowrohit/alfred_local_gpt
- Repository: https://github.com/knowrohit/alfred_local_gpt

## Overview

##### Project type and purpose
- This is a standalone, full-stack Python CLI (with optional HTTP API hooks) that allows users to:
- Load and vectorize documents (load_docs.py)
- Store/retrieve embeddings in a local Chroma vector database (db_vector/)
- Serve queries to a local LLM binary (ggml-gpt4all-j-v1.3-groovy.bin or alternative) using SentenceTransformers for context
- Return generated answers to the user

##### File structure
- Top-level files:
- alfredGPT.py — entrypoint for CLI/possibly API server
- load_docs.py — ingestion & indexing pipeline
- constants.py — shared configuration
- requirements.txt / .env (implied) — dependency and environment configuration
- Virtual environment folder (alfred_gpt/) contains all installed packages and CLI scripts (langchain, uvicorn, huggingface-cli, etc.)
- db_vector/ — local Chroma database storage: embeddings, parquet collections, index binaries & metadata
- .github & CI configs — project governance, not part of runtime

##### README for additional insights
- Instructs user to download a local LLM binary and choose a SentenceTransformers model via .env
- No external cloud services are required—everything runs locally

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User"]:::external

    subgraph "Local Host"
        CLI["alfredGPT.py\n(CLI/API)"]:::compute
        Config["Config Loader\n(constants.py)"]:::compute

        subgraph "Dependencies"
            Req["requirements.txt"]:::compute
            Venv["alfred_gpt/"]:::compute
        end

        subgraph "Ingestion Pipeline"
            Ingest["load_docs.py"]:::compute
            Encoder["SentenceTransformers Encoder"]:::model
        end

        ChromaDB[(Chroma DB)]:::storage

        subgraph "Query Pipeline"
            QueryNode["Query Processor"]:::compute
        end

        LLM["Local LLM Engine\n(ggml-gpt4all-j)"]:::model
        Output["Output Renderer"]:::compute
    end

    User -->|uses| CLI
    CLI -->|loads config| Config
    CLI -->|runs ingestion| Ingest
    Ingest -->|encodes docs| Encoder
    Encoder -->|writes embeddings| ChromaDB
    CLI -->|handles query| QueryNode
    QueryNode -->|reads embeddings| ChromaDB
    QueryNode -->|invokes model| LLM
    LLM -->|returns text| Output
    Output -->|displays| User

    click CLI "https://github.com/knowrohit/alfred_local_gpt/blob/main/alfredGPT.py"
    click Config "https://github.com/knowrohit/alfred_local_gpt/blob/main/constants.py"
    click Ingest "https://github.com/knowrohit/alfred_local_gpt/blob/main/load_docs.py"
    click Encoder "https://github.com/knowrohit/alfred_local_gpt/blob/main/load_docs.py"
    click ChromaDB "https://github.com/knowrohit/alfred_local_gpt/tree/main/db_vector/"
    click QueryNode "https://github.com/knowrohit/alfred_local_gpt/blob/main/alfredGPT.py"
    click LLM "https://github.com/knowrohit/alfred_local_gpt/blob/main/alfredGPT.py"
    click Req "https://github.com/knowrohit/alfred_local_gpt/blob/main/requirements.txt"
    click Venv "https://github.com/knowrohit/alfred_local_gpt/tree/main/alfred_gpt/"

    classDef compute fill:#cfe2ff,stroke:#0366d6
    classDef storage fill:#dcfce7,stroke:#15803d
    classDef model fill:#ffedd5,stroke:#ea580c
    classDef external fill:#f0f0f0,stroke:#999
```
