# captain-sabahat/dynamic-ai-quiz-generator architecture

> Architecture diagram of the GitHub repository captain-sabahat/dynamic-ai-quiz-generator, 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/captain-sabahat/dynamic-ai-quiz-generator
- Repository: https://github.com/captain-sabahat/dynamic-ai-quiz-generator

## Overview

This is a Streamlit AI quiz generator. A student selects a class, subject, language, and question count; the app uses performance data to identify weak subjects, generates questions, collects answers, and presents personalized feedback while updating performance. The LangGraph workflow coordinates generation, evaluation, and optional RAG updates. The README also identifies LangGraph and RAG as product capabilities. Some app sections are omitted from the excerpts, so the RAG initialization link is shown as unverified.

Main entry points: [`rag_engine.py`](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/rag_engine.py) (RAG retrieval and indexing), [`quiz_agent.py`](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_agent.py) (Answer evaluation), [`app.py`](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/app.py) (Streamlit quiz app), [`quiz_core.py`](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_core.py) (Quiz and prompt services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Quiz interface"]
  node_app["Streamlit quiz app<br/>[app.py]"]
end

subgraph group_workflow["Quiz workflow"]
  node_agent["LangGraph workflow<br/>[quiz_agent.py]"]
  node_generation["Question generation<br/>[quiz_agent.py]"]
  node_evaluation["Answer evaluation<br/>[quiz_agent.py]"]
  node_rag_update["RAG feedback update<br/>[quiz_agent.py]"]
end

subgraph group_personalization["Performance"]
  node_performance[("Student performance<br/>[quiz_core.py]")]
end

subgraph group_knowledge["AI and retrieval"]
  node_core["Quiz and prompt services<br/>[quiz_core.py]"]
  node_vector_store[("FAISS vector store<br/>[rag_engine.py]")]
  node_rag["RAG retrieval and indexing<br/>[rag_engine.py]"]
  node_config["Model and RAG settings<br/>[config.py]"]
end

node_student(("Student"))
node_gemini{{"Google Gemini"}}

node_student -->|"uses"| node_app
node_app -->|"invokes workflow"| node_agent
node_app -->|"loads performance"| node_performance
node_app -.->|"initializes index"| node_rag
node_agent -->|"dispatches"| node_generation
node_generation -->|"retrieves context"| node_rag
node_generation -->|"generates and parses"| node_core
node_agent -->|"dispatches"| node_evaluation
node_evaluation -->|"requests feedback"| node_core
node_evaluation -->|"updates scores"| node_performance
node_agent -->|"dispatches"| node_rag_update
node_rag_update -->|"adds feedback"| node_rag
node_generation -->|"routes to"| node_evaluation
node_evaluation -->|"routes to"| node_rag_update
node_core -->|"calls model"| node_gemini
node_rag -->|"searches and updates"| node_vector_store
node_rag -->|"embeds text"| node_gemini
node_core -->|"reads model settings"| node_config
node_rag -->|"reads chunk settings"| node_config

click node_app "https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/app.py"
click node_agent "https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_agent.py"
click node_generation "https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_agent.py"
click node_evaluation "https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_agent.py"
click node_rag_update "https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_agent.py"
click node_core "https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_core.py"
click node_performance "https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_core.py"
click node_vector_store "https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/rag_engine.py"
click node_rag "https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/rag_engine.py"
click node_config "https://github.com/captain-sabahat/dynamic-ai-quiz-generator/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_app toneBlue
class node_agent,node_generation,node_evaluation,node_rag_update toneAmber
class node_performance toneMint
class node_core,node_vector_store,node_rag,node_config toneRose
class node_student,node_gemini toneIndigo
```

## Components

### Quiz interface

- [Streamlit quiz app](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/app.py): `app.py`

### Quiz workflow

- [LangGraph workflow](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_agent.py): `quiz_agent.py`
- [Question generation](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_agent.py): `quiz_agent.py`
- [Answer evaluation](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_agent.py): `quiz_agent.py`
- [RAG feedback update](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_agent.py): `quiz_agent.py`

### Performance

- [Student performance](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_core.py): `quiz_core.py`

### AI and retrieval

- [Quiz and prompt services](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/quiz_core.py): `quiz_core.py`
- [FAISS vector store](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/rag_engine.py): `rag_engine.py`
- [RAG retrieval and indexing](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/rag_engine.py): `rag_engine.py`
- [Model and RAG settings](https://github.com/captain-sabahat/dynamic-ai-quiz-generator/blob/main/config.py): `config.py`

### Other components

- **Student**
- **Google Gemini**

## Connections

- Student → Streamlit quiz app: uses (evidence: `README.md`)
- Streamlit quiz app → LangGraph workflow: invokes workflow (evidence: `app.py`)
- Streamlit quiz app → Student performance: loads performance (evidence: `app.py`)
- Streamlit quiz app → RAG retrieval and indexing: initializes index
- LangGraph workflow → Question generation: dispatches (evidence: `quiz_agent.py`)
- Question generation → RAG retrieval and indexing: retrieves context (evidence: `quiz_agent.py`)
- Question generation → Quiz and prompt services: generates and parses (evidence: `quiz_agent.py`)
- LangGraph workflow → Answer evaluation: dispatches (evidence: `quiz_agent.py`)
- Answer evaluation → Quiz and prompt services: requests feedback (evidence: `quiz_agent.py`)
- Answer evaluation → Student performance: updates scores (evidence: `quiz_agent.py`)
- LangGraph workflow → RAG feedback update: dispatches (evidence: `quiz_agent.py`)
- RAG feedback update → RAG retrieval and indexing: adds feedback (evidence: `quiz_agent.py`)
- Question generation → Answer evaluation: routes to (evidence: `quiz_agent.py`)
- Answer evaluation → RAG feedback update: routes to (evidence: `quiz_agent.py`)
- Quiz and prompt services → Google Gemini: calls model (evidence: `quiz_core.py`)
- RAG retrieval and indexing → FAISS vector store: searches and updates (evidence: `rag_engine.py`)
- RAG retrieval and indexing → Google Gemini: embeds text (evidence: `rag_engine.py`)
- Quiz and prompt services → Model and RAG settings: reads model settings (evidence: `quiz_core.py`)
- RAG retrieval and indexing → Model and RAG settings: reads chunk settings (evidence: `rag_engine.py`)
