# callmevanshh/campusask architecture

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

- Interactive diagram: https://gitdiagram.com/callmevanshh/campusask
- Repository: https://github.com/callmevanshh/campusask

## Overview

CampusAsk is an unofficial IIIT Delhi academic-rules Q&A assistant. A student asks through the web interface; the API passes the question and conversation history to the answer pipeline, which resolves follow-ups and branch context, retrieves regulation passages, and produces a cited answer or a refusal. For personal grade-planning questions, the pipeline can request a verified calculation before generating the response. Retrieval and generation details are shown where source excerpts support them; other corpus and interface wiring is limited to what the README and excerpts establish.

Main entry points: [`app/pipeline.py`](https://github.com/callmevanshh/campusask/blob/main/app/pipeline.py) (Answer pipeline), [`app/main.py`](https://github.com/callmevanshh/campusask/blob/main/app/main.py) (Ask API), [`app/static/index.html`](https://github.com/callmevanshh/campusask/blob/main/app/static/index.html) (Web interface), [`app/llm.py`](https://github.com/callmevanshh/campusask/blob/main/app/llm.py) (LLM client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_web["Web interface<br/>[index.html]"]
  node_api["Ask API<br/>[main.py]"]
end

subgraph group_orchestration["Answer orchestration"]
  node_pipeline["Answer pipeline<br/>[pipeline.py]"]
  node_resolver["Question resolver<br/>[pipeline.py]"]
  node_gate["Relevance gate<br/>[pipeline.py]"]
  node_formatter["Citation formatter<br/>[pipeline.py]"]
end

subgraph group_knowledge["Regulation retrieval"]
  node_search["Hybrid retrieval<br/>[retrieval.py]"]
  node_chunks[("Indexed passages<br/>[chunks_kept.jsonl]")]
  node_regulations["Regulation corpus"]
end

subgraph group_answering["Answer intelligence"]
  node_planner["Grade planner<br/>[planner.py]"]
  node_llm["LLM client<br/>[llm.py]"]
end

node_student(("Student"))
node_gemini["Gemini service"]

node_student -->|"asks"| node_web
node_web -->|"submits"| node_api
node_api -->|"calls answer"| node_pipeline
node_pipeline -->|"resolves"| node_resolver
node_pipeline -->|"retrieves passages"| node_search
node_search -->|"loads and ranks"| node_chunks
node_pipeline -->|"checks relevance"| node_gate
node_pipeline -->|"verifies plans"| node_planner
node_planner -->|"extracts inputs"| node_llm
node_pipeline -->|"generates answer"| node_llm
node_llm -->|"sends prompt"| node_gemini
node_pipeline -->|"formats citations"| node_formatter
node_api -->|"returns response"| node_web

click node_web "https://github.com/callmevanshh/campusask/blob/main/app/static/index.html"
click node_api "https://github.com/callmevanshh/campusask/blob/main/app/main.py"
click node_pipeline "https://github.com/callmevanshh/campusask/blob/main/app/pipeline.py"
click node_resolver "https://github.com/callmevanshh/campusask/blob/main/app/pipeline.py"
click node_gate "https://github.com/callmevanshh/campusask/blob/main/app/pipeline.py"
click node_formatter "https://github.com/callmevanshh/campusask/blob/main/app/pipeline.py"
click node_search "https://github.com/callmevanshh/campusask/blob/main/app/retrieval.py"
click node_chunks "https://github.com/callmevanshh/campusask/blob/main/data/processed/chunks_kept.jsonl"
click node_regulations "https://github.com/callmevanshh/campusask/tree/main/data/tables"
click node_planner "https://github.com/callmevanshh/campusask/blob/main/app/planner.py"
click node_llm "https://github.com/callmevanshh/campusask/blob/main/app/llm.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_web,node_api toneBlue
class node_pipeline,node_resolver,node_gate,node_formatter toneAmber
class node_search,node_chunks,node_regulations toneMint
class node_planner,node_llm toneRose
class node_student,node_gemini toneIndigo
```

## Components

### User interface

- [Web interface](https://github.com/callmevanshh/campusask/blob/main/app/static/index.html): `app/static/index.html`
- [Ask API](https://github.com/callmevanshh/campusask/blob/main/app/main.py): `app/main.py`

### Answer orchestration

- [Answer pipeline](https://github.com/callmevanshh/campusask/blob/main/app/pipeline.py): `app/pipeline.py`
- [Question resolver](https://github.com/callmevanshh/campusask/blob/main/app/pipeline.py): `app/pipeline.py`
- [Relevance gate](https://github.com/callmevanshh/campusask/blob/main/app/pipeline.py): `app/pipeline.py`
- [Citation formatter](https://github.com/callmevanshh/campusask/blob/main/app/pipeline.py): `app/pipeline.py`

### Regulation retrieval

- [Hybrid retrieval](https://github.com/callmevanshh/campusask/blob/main/app/retrieval.py): `app/retrieval.py`
- [Indexed passages](https://github.com/callmevanshh/campusask/blob/main/data/processed/chunks_kept.jsonl): `data/processed/chunks_kept.jsonl`
- [Regulation corpus](https://github.com/callmevanshh/campusask/tree/main/data/tables): `data/tables`

### Answer intelligence

- [Grade planner](https://github.com/callmevanshh/campusask/blob/main/app/planner.py): `app/planner.py`
- [LLM client](https://github.com/callmevanshh/campusask/blob/main/app/llm.py): `app/llm.py`

### Other components

- **Student**
- **Gemini service**

## Connections

- Student → Web interface: asks
- Web interface → Ask API: submits (evidence: `app/main.py`)
- Ask API → Answer pipeline: calls answer (evidence: `app/main.py`)
- Answer pipeline → Question resolver: resolves (evidence: `app/pipeline.py`)
- Answer pipeline → Hybrid retrieval: retrieves passages (evidence: `app/pipeline.py`)
- Hybrid retrieval → Indexed passages: loads and ranks (evidence: `app/retrieval.py`)
- Answer pipeline → Relevance gate: checks relevance (evidence: `app/pipeline.py`)
- Answer pipeline → Grade planner: verifies plans (evidence: `app/pipeline.py`)
- Grade planner → LLM client: extracts inputs (evidence: `app/planner.py`)
- Answer pipeline → LLM client: generates answer (evidence: `app/pipeline.py`)
- LLM client → Gemini service: sends prompt (evidence: `app/llm.py`)
- Answer pipeline → Citation formatter: formats citations (evidence: `app/pipeline.py`)
- Ask API → Web interface: returns response (evidence: `app/main.py`)
