# nandakumar005/orian_ai architecture

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

- Interactive diagram: https://gitdiagram.com/nandakumar005/orian_ai
- Repository: https://github.com/nandakumar005/orian_ai

## Overview

Orian AI is a local browser-based RAG app for asking questions about office documents. A user selects a document folder and loads TXT, PDF, or DOCX files; the server routes that action to document loading, chunking, embedding, and persistent Chroma storage. For questions, the server opens the vector database and calls retrieval and answer generation, returning the response to the page. The README documents Ollama models and persistent local vectors. Edges follow the sampled app.py and rag.py calls or README workflow; no unsampled source behavior is assumed.

Main entry points: [`app.py`](https://github.com/nandakumar005/orian_ai/blob/main/app.py) (Flask routes), [`config.py`](https://github.com/nandakumar005/orian_ai/blob/main/config.py) (RAG settings), [`rag.py`](https://github.com/nandakumar005/orian_ai/blob/main/rag.py) (Similarity search), [`templates/index.html`](https://github.com/nandakumar005/orian_ai/blob/main/templates/index.html) (Question form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser interface"]
  node_form["Question form<br/>[index.html]"]
  node_server["Flask routes<br/>[app.py]"]
end

subgraph group_rag["Document question answering"]
  node_loader["Format loaders<br/>[rag.py]"]
  node_splitter["Text chunking<br/>[rag.py]"]
  node_retrieval["Similarity search<br/>[rag.py]"]
  node_prompt["Context prompt<br/>[rag.py]"]
  node_settings["RAG settings<br/>[config.py]"]
end

subgraph group_local["Local models and storage"]
  node_embed["Document embeddings<br/>[rag.py]"]
  node_vector[("Vector database<br/>[rag.py]")]
  node_answer["Answer generation<br/>[rag.py]"]
end

node_user(("User"))
node_documents["Office documents"]

node_user -->|"submits actions"| node_form
node_form -->|"sends requests"| node_server
node_server -->|"loads documents"| node_loader
node_documents -->|"reads files"| node_loader
node_loader -->|"splits text"| node_splitter
node_splitter -->|"creates vectors"| node_embed
node_embed -->|"stores vectors"| node_vector
node_server -->|"opens database"| node_vector
node_server -->|"asks question"| node_retrieval
node_retrieval -->|"searches vectors"| node_vector
node_retrieval -->|"builds context"| node_prompt
node_prompt -->|"generates answer"| node_answer
node_answer -->|"returns response"| node_server
node_settings -->|"sets chunking"| node_splitter
node_settings -->|"sets model"| node_embed
node_settings -->|"sets search"| node_retrieval
node_settings -->|"sets model"| node_answer
node_vector -->|"persists locally"| node_user

click node_form "https://github.com/nandakumar005/orian_ai/blob/main/templates/index.html"
click node_server "https://github.com/nandakumar005/orian_ai/blob/main/app.py"
click node_loader "https://github.com/nandakumar005/orian_ai/blob/main/rag.py"
click node_splitter "https://github.com/nandakumar005/orian_ai/blob/main/rag.py"
click node_embed "https://github.com/nandakumar005/orian_ai/blob/main/rag.py"
click node_vector "https://github.com/nandakumar005/orian_ai/blob/main/rag.py"
click node_retrieval "https://github.com/nandakumar005/orian_ai/blob/main/rag.py"
click node_prompt "https://github.com/nandakumar005/orian_ai/blob/main/rag.py"
click node_answer "https://github.com/nandakumar005/orian_ai/blob/main/rag.py"
click node_settings "https://github.com/nandakumar005/orian_ai/blob/main/config.py"

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_form,node_server,node_user toneBlue
class node_loader,node_splitter,node_retrieval,node_prompt,node_settings toneAmber
class node_embed,node_vector,node_answer toneMint
class node_documents toneIndigo
```

## Components

### Browser interface

- [Question form](https://github.com/nandakumar005/orian_ai/blob/main/templates/index.html): `templates/index.html`
- [Flask routes](https://github.com/nandakumar005/orian_ai/blob/main/app.py): `app.py`

### Document question answering

- [Format loaders](https://github.com/nandakumar005/orian_ai/blob/main/rag.py): `rag.py`
- [Text chunking](https://github.com/nandakumar005/orian_ai/blob/main/rag.py): `rag.py`
- [Similarity search](https://github.com/nandakumar005/orian_ai/blob/main/rag.py): `rag.py`
- [Context prompt](https://github.com/nandakumar005/orian_ai/blob/main/rag.py): `rag.py`
- [RAG settings](https://github.com/nandakumar005/orian_ai/blob/main/config.py): `config.py`

### Local models and storage

- [Document embeddings](https://github.com/nandakumar005/orian_ai/blob/main/rag.py): `rag.py`
- [Vector database](https://github.com/nandakumar005/orian_ai/blob/main/rag.py): `rag.py`
- [Answer generation](https://github.com/nandakumar005/orian_ai/blob/main/rag.py): `rag.py`

### Other components

- **User**
- **Office documents**

## Connections

- User → Question form: submits actions (evidence: `README.md`)
- Question form → Flask routes: sends requests (evidence: `app.py`)
- Flask routes → Format loaders: loads documents (evidence: `app.py`)
- Office documents → Format loaders: reads files (evidence: `README.md`)
- Format loaders → Text chunking: splits text (evidence: `rag.py`)
- Text chunking → Document embeddings: creates vectors (evidence: `README.md`)
- Document embeddings → Vector database: stores vectors (evidence: `rag.py`)
- Flask routes → Vector database: opens database (evidence: `app.py`)
- Flask routes → Similarity search: asks question (evidence: `app.py`)
- Similarity search → Vector database: searches vectors (evidence: `rag.py`)
- Similarity search → Context prompt: builds context (evidence: `rag.py`)
- Context prompt → Answer generation: generates answer (evidence: `rag.py`)
- Answer generation → Flask routes: returns response (evidence: `app.py`)
- RAG settings → Text chunking: sets chunking (evidence: `rag.py`)
- RAG settings → Document embeddings: sets model (evidence: `rag.py`)
- RAG settings → Similarity search: sets search (evidence: `rag.py`)
- RAG settings → Answer generation: sets model (evidence: `rag.py`)
- Vector database → User: persists locally (evidence: `README.md`)
