# yousef-koura/personal-rag-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/yousef-koura/personal-rag-assistant
- Repository: https://github.com/yousef-koura/personal-rag-assistant

## Overview

YK Assistant is a personal portfolio chatbot: a visitor asks a question in the chat UI, the API retrieves relevant PDF knowledge, and a Groq language model produces a grounded answer for display. The backend builds the retrieval-and-generation chain at startup. README documentation supports the overall UI/API workflow and RAG capabilities; the sampled backend shows the chain construction and endpoint behavior. The UI implementation itself was not sampled, so its link is based on README documentation.

Main entry points: [`api/app.py`](https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py) (Chat API), [`index.html`](https://github.com/yousef-koura/personal-rag-assistant/blob/main/index.html) (Chat UI), [`Data/Yousef_Koura_RAG_Knowledge_Base_v2.pdf`](https://github.com/yousef-koura/personal-rag-assistant/blob/main/Data/Yousef_Koura_RAG_Knowledge_Base_v2.pdf) (Knowledge PDF)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Chat interface"]
  node_chat_ui["Chat UI<br/>[index.html]"]
  node_chat_api["Chat API<br/>[app.py]"]
end

subgraph group_retrieval["Knowledge retrieval"]
  node_knowledge_pdf["Knowledge PDF"]
  node_pdf_loader["PDF loader<br/>[app.py]"]
  node_chunker["Text splitter<br/>[app.py]"]
  node_embeddings["Embeddings<br/>[app.py]"]
  node_vector_store[("Chroma store<br/>[app.py]")]
  node_retriever["Retriever<br/>[app.py]"]
end

subgraph group_generation["Answer generation"]
  node_prompt["Context prompt<br/>[app.py]"]
  node_groq_llm["Groq LLM"]
  node_parser["Output parser<br/>[app.py]"]
end

node_visitor(("Visitor"))

node_visitor -->|"asks"| node_chat_ui
node_chat_ui -->|"sends question"| node_chat_api
node_knowledge_pdf -->|"loaded from"| node_pdf_loader
node_pdf_loader -->|"splits documents"| node_chunker
node_chunker -->|"embedded by"| node_embeddings
node_embeddings -->|"indexes chunks"| node_vector_store
node_vector_store -->|"retrieves top six"| node_retriever
node_chat_api -->|"supplies context"| node_retriever
node_chat_api -->|"supplies question"| node_prompt
node_prompt -->|"formats request"| node_groq_llm
node_groq_llm -->|"generates text"| node_parser
node_parser -->|"returns answer"| node_chat_api
node_chat_api -->|"returns answer"| node_chat_ui

click node_chat_ui "https://github.com/yousef-koura/personal-rag-assistant/blob/main/index.html"
click node_chat_api "https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py"
click node_knowledge_pdf "https://github.com/yousef-koura/personal-rag-assistant/blob/main/Data/Yousef_Koura_RAG_Knowledge_Base_v2.pdf"
click node_pdf_loader "https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py"
click node_chunker "https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py"
click node_embeddings "https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py"
click node_vector_store "https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py"
click node_retriever "https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py"
click node_prompt "https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py"
click node_parser "https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/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_chat_ui,node_chat_api toneBlue
class node_knowledge_pdf,node_pdf_loader,node_chunker,node_embeddings,node_vector_store,node_retriever toneAmber
class node_prompt,node_groq_llm,node_parser toneMint
class node_visitor toneIndigo
```

## Components

### Chat interface

- [Chat UI](https://github.com/yousef-koura/personal-rag-assistant/blob/main/index.html): `index.html`
- [Chat API](https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py): `api/app.py`

### Knowledge retrieval

- [Knowledge PDF](https://github.com/yousef-koura/personal-rag-assistant/blob/main/Data/Yousef_Koura_RAG_Knowledge_Base_v2.pdf): `Data/Yousef_Koura_RAG_Knowledge_Base_v2.pdf`
- [PDF loader](https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py): `api/app.py`
- [Text splitter](https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py): `api/app.py`
- [Embeddings](https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py): `api/app.py`
- [Chroma store](https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py): `api/app.py`
- [Retriever](https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py): `api/app.py`

### Answer generation

- [Context prompt](https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py): `api/app.py`
- **Groq LLM**
- [Output parser](https://github.com/yousef-koura/personal-rag-assistant/blob/main/api/app.py): `api/app.py`

### Other components

- **Visitor**

## Connections

- Visitor → Chat UI: asks (evidence: `README.md`)
- Chat UI → Chat API: sends question (evidence: `README.md`)
- Knowledge PDF → PDF loader: loaded from (evidence: `api/app.py`)
- PDF loader → Text splitter: splits documents (evidence: `api/app.py`)
- Text splitter → Embeddings: embedded by (evidence: `api/app.py`)
- Embeddings → Chroma store: indexes chunks (evidence: `api/app.py`)
- Chroma store → Retriever: retrieves top six (evidence: `api/app.py`)
- Chat API → Retriever: supplies context (evidence: `api/app.py`)
- Chat API → Context prompt: supplies question (evidence: `api/app.py`)
- Context prompt → Groq LLM: formats request (evidence: `api/app.py`)
- Groq LLM → Output parser: generates text (evidence: `api/app.py`)
- Output parser → Chat API: returns answer (evidence: `api/app.py`)
- Chat API → Chat UI: returns answer (evidence: `README.md`)
