# pragatigaddewar-hub/rag-notes-qa architecture

> Architecture diagram of the GitHub repository pragatigaddewar-hub/rag-notes-qa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pragatigaddewar-hub/rag-notes-qa
- Repository: https://github.com/pragatigaddewar-hub/rag-notes-qa

## Overview

RAG Notes QA is a small interactive question-answering program: it reads the local notes, chunks them by paragraph, embeds the chunks, retrieves the two most similar chunks for each question, and asks Gemini to answer from that context. The main program owns these actions; the nodes separate its domain stages rather than imply separate modules. The source excerpt shows the complete runtime flow. Gemini is external, and notes.txt is the local knowledge source.

Main entry points: [`rag_app.py`](https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/rag_app.py) (Interactive RAG app), [`notes.txt`](https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/notes.txt) (Notes corpus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Knowledge and input"]
  node_app["Interactive RAG app<br/>[rag_app.py]"]
  node_notes["Notes corpus<br/>[notes.txt]"]
  node_chunking["Paragraph chunking<br/>[rag_app.py]"]
end

subgraph group_retrieval["Retrieval"]
  node_gemini_embed["Gemini embeddings"]
  node_search["Top-two similarity search<br/>[rag_app.py]"]
end

subgraph group_answering["Answer generation"]
  node_prompt["Context prompt assembly<br/>[rag_app.py]"]
  node_gemini_generate["Gemini answer generation"]
  node_answer["Answer and cited chunks<br/>[rag_app.py]"]
end

node_user(("Questioner"))

node_user -->|"enters question"| node_app
node_app -->|"reads notes"| node_notes
node_notes -->|"provides text"| node_chunking
node_app -->|"splits paragraphs"| node_chunking
node_app -->|"requests embeddings"| node_gemini_embed
node_chunking -->|"supplies chunks"| node_gemini_embed
node_app -->|"scores similarities"| node_search
node_gemini_embed -->|"returns vectors"| node_search
node_app -->|"assembles context"| node_prompt
node_search -->|"supplies top chunks"| node_prompt
node_app -->|"requests answer"| node_gemini_generate
node_prompt -->|"supplies prompt"| node_gemini_generate
node_app -->|"prints response"| node_answer
node_gemini_generate -->|"returns answer"| node_answer

click node_app "https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/rag_app.py"
click node_notes "https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/notes.txt"
click node_chunking "https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/rag_app.py"
click node_search "https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/rag_app.py"
click node_prompt "https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/rag_app.py"
click node_answer "https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/rag_app.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_app,node_notes,node_chunking toneBlue
class node_gemini_embed,node_search toneAmber
class node_prompt,node_gemini_generate,node_answer toneMint
class node_user toneIndigo
```

## Components

### Knowledge and input

- [Interactive RAG app](https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/rag_app.py): `rag_app.py`
- [Notes corpus](https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/notes.txt): `notes.txt`
- [Paragraph chunking](https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/rag_app.py): `rag_app.py`

### Retrieval

- **Gemini embeddings**
- [Top-two similarity search](https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/rag_app.py): `rag_app.py`

### Answer generation

- [Context prompt assembly](https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/rag_app.py): `rag_app.py`
- **Gemini answer generation**
- [Answer and cited chunks](https://github.com/pragatigaddewar-hub/rag-notes-qa/blob/main/rag_app.py): `rag_app.py`

### Other components

- **Questioner**

## Connections

- Questioner → Interactive RAG app: enters question (evidence: `rag_app.py`)
- Interactive RAG app → Notes corpus: reads notes (evidence: `rag_app.py`)
- Notes corpus → Paragraph chunking: provides text (evidence: `rag_app.py`)
- Interactive RAG app → Paragraph chunking: splits paragraphs (evidence: `rag_app.py`)
- Interactive RAG app → Gemini embeddings: requests embeddings (evidence: `rag_app.py`)
- Paragraph chunking → Gemini embeddings: supplies chunks (evidence: `rag_app.py`)
- Interactive RAG app → Top-two similarity search: scores similarities (evidence: `rag_app.py`)
- Gemini embeddings → Top-two similarity search: returns vectors (evidence: `rag_app.py`)
- Interactive RAG app → Context prompt assembly: assembles context (evidence: `rag_app.py`)
- Top-two similarity search → Context prompt assembly: supplies top chunks (evidence: `rag_app.py`)
- Interactive RAG app → Gemini answer generation: requests answer (evidence: `rag_app.py`)
- Context prompt assembly → Gemini answer generation: supplies prompt (evidence: `rag_app.py`)
- Interactive RAG app → Answer and cited chunks: prints response (evidence: `rag_app.py`)
- Gemini answer generation → Answer and cited chunks: returns answer (evidence: `rag_app.py`)
