# tejsaxena-0811/haven architecture

> Architecture diagram of the GitHub repository tejsaxena-0811/haven, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tejsaxena-0811/haven
- Repository: https://github.com/tejsaxena-0811/haven

## Overview

Haven is a local command-line document assistant. Users ask questions; the main loop routes supported CSV-analysis questions to Pandas, or sends other questions through retrieval and a prompted local LLM. Documents are loaded by file type, embedded, and indexed in ChromaDB. The README describes PDF, CSV, and DOCX support and local Ollama models; the sampled source confirms these paths, though the repository does not show a separate UI or upload flow.

Main entry points: [`main.py`](https://github.com/tejsaxena-0811/haven/blob/main/main.py) (CLI loop), [`vector.py`](https://github.com/tejsaxena-0811/haven/blob/main/vector.py) (Index construction), [`loader.py`](https://github.com/tejsaxena-0811/haven/blob/main/loader.py) (File-type loader), [`data`](https://github.com/tejsaxena-0811/haven/tree/main/data) (CSV data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Question handling"]
  node_main["CLI loop<br/>[main.py]"]
  node_routing["Question routing<br/>[main.py]"]
  node_csv_analysis["CSV analysis<br/>[main.py]"]
  node_csv_data["CSV data"]
end

subgraph group_ingestion["Document ingestion"]
  node_source_files["Data files"]
  node_loader["File-type loader<br/>[loader.py]"]
  node_documents["Loaded documents<br/>[loader.py]"]
end

subgraph group_retrieval["Local retrieval"]
  node_embeddings["Embedding model<br/>[vector.py]"]
  node_indexing["Index construction<br/>[vector.py]"]
  node_chroma[("ChromaDB store<br/>[vector.py]")]
  node_retriever["Top-5 retriever<br/>[vector.py]"]
end

subgraph group_answers["Answer generation"]
  node_ollama["Local Ollama"]
  node_prompt_chain["RAG prompt chain<br/>[main.py]"]
  node_answer_model["Llama 3.2<br/>[main.py]"]
end

node_user(("User"))

node_user -->|"asks questions"| node_main
node_main -->|"routes questions"| node_routing
node_routing -->|"selects CSV analysis"| node_csv_analysis
node_main -->|"reads CSV"| node_csv_data
node_csv_analysis -->|"analyzes data"| node_csv_data
node_main -->|"invokes retrieval"| node_retriever
node_main -->|"invokes chain"| node_prompt_chain
node_prompt_chain -->|"prompts model"| node_answer_model
node_answer_model -->|"runs through"| node_ollama
node_source_files -->|"provides input"| node_loader
node_loader -->|"loads documents"| node_documents
node_indexing -->|"loads documents"| node_loader
node_indexing -->|"embeds documents"| node_embeddings
node_embeddings -->|"runs through"| node_ollama
node_indexing -->|"stores documents"| node_chroma
node_retriever -->|"searches index"| node_chroma

click node_main "https://github.com/tejsaxena-0811/haven/blob/main/main.py"
click node_routing "https://github.com/tejsaxena-0811/haven/blob/main/main.py"
click node_csv_analysis "https://github.com/tejsaxena-0811/haven/blob/main/main.py"
click node_source_files "https://github.com/tejsaxena-0811/haven/tree/main/data"
click node_loader "https://github.com/tejsaxena-0811/haven/blob/main/loader.py"
click node_documents "https://github.com/tejsaxena-0811/haven/blob/main/loader.py"
click node_embeddings "https://github.com/tejsaxena-0811/haven/blob/main/vector.py"
click node_indexing "https://github.com/tejsaxena-0811/haven/blob/main/vector.py"
click node_chroma "https://github.com/tejsaxena-0811/haven/blob/main/vector.py"
click node_retriever "https://github.com/tejsaxena-0811/haven/blob/main/vector.py"
click node_prompt_chain "https://github.com/tejsaxena-0811/haven/blob/main/main.py"
click node_answer_model "https://github.com/tejsaxena-0811/haven/blob/main/main.py"
click node_csv_data "https://github.com/tejsaxena-0811/haven/tree/main/data"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_routing,node_csv_analysis,node_csv_data,node_user toneBlue
class node_source_files,node_loader,node_documents toneAmber
class node_embeddings,node_indexing,node_chroma,node_retriever toneMint
class node_ollama,node_prompt_chain,node_answer_model toneRose
```

## Components

### Question handling

- [CLI loop](https://github.com/tejsaxena-0811/haven/blob/main/main.py): `main.py`
- [Question routing](https://github.com/tejsaxena-0811/haven/blob/main/main.py): `main.py`
- [CSV analysis](https://github.com/tejsaxena-0811/haven/blob/main/main.py): `main.py`
- [CSV data](https://github.com/tejsaxena-0811/haven/tree/main/data): `data`

### Document ingestion

- [Data files](https://github.com/tejsaxena-0811/haven/tree/main/data): `data`
- [File-type loader](https://github.com/tejsaxena-0811/haven/blob/main/loader.py): `loader.py`
- [Loaded documents](https://github.com/tejsaxena-0811/haven/blob/main/loader.py): `loader.py`

### Local retrieval

- [Embedding model](https://github.com/tejsaxena-0811/haven/blob/main/vector.py): `vector.py`
- [Index construction](https://github.com/tejsaxena-0811/haven/blob/main/vector.py): `vector.py`
- [ChromaDB store](https://github.com/tejsaxena-0811/haven/blob/main/vector.py): `vector.py`
- [Top-5 retriever](https://github.com/tejsaxena-0811/haven/blob/main/vector.py): `vector.py`

### Answer generation

- **Local Ollama**
- [RAG prompt chain](https://github.com/tejsaxena-0811/haven/blob/main/main.py): `main.py`
- [Llama 3.2](https://github.com/tejsaxena-0811/haven/blob/main/main.py): `main.py`

### Other components

- **User**

## Connections

- User → CLI loop: asks questions
- CLI loop → Question routing: routes questions
- Question routing → CSV analysis: selects CSV analysis
- CLI loop → CSV data: reads CSV
- CSV analysis → CSV data: analyzes data
- CLI loop → Top-5 retriever: invokes retrieval
- CLI loop → RAG prompt chain: invokes chain
- RAG prompt chain → Llama 3.2: prompts model
- Llama 3.2 → Local Ollama: runs through
- Data files → File-type loader: provides input
- File-type loader → Loaded documents: loads documents
- Index construction → File-type loader: loads documents
- Index construction → Embedding model: embeds documents
- Embedding model → Local Ollama: runs through
- Index construction → ChromaDB store: stores documents
- Top-5 retriever → ChromaDB store: searches index
