# bala-kopparthi/ragpilot architecture

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

- Interactive diagram: https://gitdiagram.com/bala-kopparthi/ragpilot
- Repository: https://github.com/bala-kopparthi/ragpilot

## Overview

RAGPilot is a local document-question-answering assistant. Its workflow has two stages: ingesting supported QA documents into a persistent vector index, then retrieving relevant chunks for a question and generating a grounded answer with source previews. The graph preserves document loading, chunking, embedding, vector storage, retrieval, prompting, and answer presentation. Relationships are based on the README and the sampled scripts; the local Ollama service and generated ChromaDB directory are runtime dependencies, not source-tree modules.

Main entry points: [`query.py`](https://github.com/bala-kopparthi/ragpilot/blob/main/query.py) (Question CLI), [`ingest.py`](https://github.com/bala-kopparthi/ragpilot/blob/main/ingest.py) (Index Embedding), [`documents`](https://github.com/bala-kopparthi/ragpilot/tree/main/documents) (QA Documents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Document Ingestion"]
  node_qa_documents["QA Documents"]
  node_document_loading["Document Loading<br/>[ingest.py]"]
  node_chunking["Chunking<br/>[ingest.py]"]
  node_index_embedding["Index Embedding<br/>[ingest.py]"]
end

subgraph group_querying["Question Answering"]
  node_query_cli["Question CLI<br/>[query.py]"]
  node_query_embedding["Query Embedding<br/>[query.py]"]
  node_retrieval["Chunk Retrieval<br/>[query.py]"]
  node_prompting["Context Prompt<br/>[query.py]"]
  node_answer_generation["Answer Generation<br/>[query.py]"]
  node_source_display["Answer and Sources<br/>[query.py]"]
end

subgraph group_local_services["Local AI Services"]
  node_ollama{{"Ollama"}}
end

node_operator(("User"))
node_vector_store[("Vector Store")]

node_operator -->|"asks"| node_query_cli
node_qa_documents -->|"loads"| node_document_loading
node_document_loading -->|"splits"| node_chunking
node_chunking -->|"embeds chunks"| node_index_embedding
node_index_embedding -->|"requests embeddings"| node_ollama
node_index_embedding -->|"stores vectors"| node_vector_store
node_query_cli -->|"configures"| node_query_embedding
node_query_embedding -->|"requests embeddings"| node_ollama
node_query_cli -->|"invokes"| node_retrieval
node_retrieval -->|"searches"| node_vector_store
node_retrieval -->|"supplies chunks"| node_prompting
node_query_cli -->|"builds chain"| node_prompting
node_prompting -->|"formats prompt"| node_answer_generation
node_answer_generation -->|"generates answer"| node_ollama
node_query_cli -->|"prints answer and sources"| node_source_display

click node_qa_documents "https://github.com/bala-kopparthi/ragpilot/tree/main/documents"
click node_document_loading "https://github.com/bala-kopparthi/ragpilot/blob/main/ingest.py"
click node_chunking "https://github.com/bala-kopparthi/ragpilot/blob/main/ingest.py"
click node_index_embedding "https://github.com/bala-kopparthi/ragpilot/blob/main/ingest.py"
click node_query_cli "https://github.com/bala-kopparthi/ragpilot/blob/main/query.py"
click node_query_embedding "https://github.com/bala-kopparthi/ragpilot/blob/main/query.py"
click node_retrieval "https://github.com/bala-kopparthi/ragpilot/blob/main/query.py"
click node_prompting "https://github.com/bala-kopparthi/ragpilot/blob/main/query.py"
click node_answer_generation "https://github.com/bala-kopparthi/ragpilot/blob/main/query.py"
click node_source_display "https://github.com/bala-kopparthi/ragpilot/blob/main/query.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_qa_documents,node_document_loading,node_chunking,node_index_embedding,node_operator toneBlue
class node_query_cli,node_query_embedding,node_retrieval,node_prompting,node_answer_generation,node_source_display,node_vector_store toneAmber
class node_ollama toneMint
```

## Components

### Document Ingestion

- [QA Documents](https://github.com/bala-kopparthi/ragpilot/tree/main/documents): `documents`
- [Document Loading](https://github.com/bala-kopparthi/ragpilot/blob/main/ingest.py): `ingest.py`
- [Chunking](https://github.com/bala-kopparthi/ragpilot/blob/main/ingest.py): `ingest.py`
- [Index Embedding](https://github.com/bala-kopparthi/ragpilot/blob/main/ingest.py): `ingest.py`

### Question Answering

- [Question CLI](https://github.com/bala-kopparthi/ragpilot/blob/main/query.py): `query.py`
- [Query Embedding](https://github.com/bala-kopparthi/ragpilot/blob/main/query.py): `query.py`
- [Chunk Retrieval](https://github.com/bala-kopparthi/ragpilot/blob/main/query.py): `query.py`
- [Context Prompt](https://github.com/bala-kopparthi/ragpilot/blob/main/query.py): `query.py`
- [Answer Generation](https://github.com/bala-kopparthi/ragpilot/blob/main/query.py): `query.py`
- [Answer and Sources](https://github.com/bala-kopparthi/ragpilot/blob/main/query.py): `query.py`

### Local AI Services

- **Ollama**

### Other components

- **User**
- **Vector Store**

## Connections

- User → Question CLI: asks (evidence: `query.py`)
- QA Documents → Document Loading: loads (evidence: `ingest.py`)
- Document Loading → Chunking: splits (evidence: `ingest.py`)
- Chunking → Index Embedding: embeds chunks (evidence: `ingest.py`)
- Index Embedding → Ollama: requests embeddings (evidence: `ingest.py`)
- Index Embedding → Vector Store: stores vectors (evidence: `ingest.py`)
- Question CLI → Query Embedding: configures (evidence: `query.py`)
- Query Embedding → Ollama: requests embeddings (evidence: `query.py`)
- Question CLI → Chunk Retrieval: invokes (evidence: `query.py`)
- Chunk Retrieval → Vector Store: searches (evidence: `query.py`)
- Chunk Retrieval → Context Prompt: supplies chunks (evidence: `query.py`)
- Question CLI → Context Prompt: builds chain (evidence: `query.py`)
- Context Prompt → Answer Generation: formats prompt (evidence: `query.py`)
- Answer Generation → Ollama: generates answer (evidence: `query.py`)
- Question CLI → Answer and Sources: prints answer and sources (evidence: `query.py`)
