# rishabhguptax/campusquery-rag architecture

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

- Interactive diagram: https://gitdiagram.com/rishabhguptax/campusquery-rag
- Repository: https://github.com/rishabhguptax/campusquery-rag

## Overview

CampusQuery-RAG answers student questions about college information using retrieved document context and returns source/page references. The main workflow is Streamlit chat → RAG orchestration → semantic retrieval from ChromaDB → grounded Groq generation → answer and citations. A separate PDF-ingestion path extracts page text, chunks it, embeds it, and populates the vector store. README also documents a website-scraping ingestion path in ingest_data.py. The sampled code supports the PDF path and query flow; the documented API-key setup and OCR/evaluation/deployment plans are not separate implemented runtime components.

Main entry points: [`rag_pipeline.py`](https://github.com/rishabhguptax/campusquery-rag/blob/main/rag_pipeline.py) (RAG orchestration), [`app.py`](https://github.com/rishabhguptax/campusquery-rag/blob/main/app.py) (Streamlit chat), [`pdf_ingest.py`](https://github.com/rishabhguptax/campusquery-rag/blob/main/pdf_ingest.py) (Text chunking), [`llm.py`](https://github.com/rishabhguptax/campusquery-rag/blob/main/llm.py) (Grounded answer generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Student interface"]
  node_chat["Streamlit chat<br/>[app.py]"]
  node_answer["Answer with sources<br/>[app.py]"]
end

subgraph group_query["Question answering"]
  node_pipeline["RAG orchestration<br/>[rag_pipeline.py]"]
  node_retriever["Semantic retrieval<br/>[retriever.py]"]
  node_context["Context and citations<br/>[rag_pipeline.py]"]
  node_generator["Grounded answer generation<br/>[llm.py]"]
end

subgraph group_knowledge["Knowledge ingestion"]
  node_pdfs["College PDFs"]
  node_pdf_extract["PDF page extraction<br/>[pdf_ingest.py]"]
  node_chunking["Text chunking<br/>[pdf_ingest.py]"]
  node_web_crawl["College website crawl<br/>[ingest_data.py]"]
  node_web_clean["HTML text cleaning<br/>[ingest_data.py]"]
  node_web_chunk["Web page chunking<br/>[ingest_data.py]"]
end

subgraph group_services["Models and storage"]
  node_embedding["Embedding model<br/>[pdf_ingest.py]"]
  node_vector_store[("Chroma vector store<br/>[pdf_ingest.py]")]
  node_groq["Groq service"]
end

node_student(("Student"))

node_student -->|"asks"| node_chat
node_chat -->|"submits question"| node_pipeline
node_pipeline -->|"searches"| node_retriever
node_retriever -->|"queries"| node_vector_store
node_pipeline -->|"builds"| node_context
node_pipeline -->|"requests answer"| node_generator
node_generator -->|"calls"| node_groq
node_context -->|"supplies context"| node_generator
node_pipeline -->|"returns answer and sources"| node_chat
node_chat -->|"renders"| node_answer
node_pdfs -->|"provides pages"| node_pdf_extract
node_pdf_extract -->|"splits extracted text"| node_chunking
node_chunking -->|"embeds chunks"| node_embedding
node_chunking -->|"stores chunks"| node_vector_store
node_web_crawl -->|"cleans HTML"| node_web_clean
node_web_clean -->|"provides text"| node_web_chunk
node_web_chunk -->|"stores chunks"| node_vector_store

click node_chat "https://github.com/rishabhguptax/campusquery-rag/blob/main/app.py"
click node_pipeline "https://github.com/rishabhguptax/campusquery-rag/blob/main/rag_pipeline.py"
click node_retriever "https://github.com/rishabhguptax/campusquery-rag/blob/main/retriever.py"
click node_context "https://github.com/rishabhguptax/campusquery-rag/blob/main/rag_pipeline.py"
click node_generator "https://github.com/rishabhguptax/campusquery-rag/blob/main/llm.py"
click node_answer "https://github.com/rishabhguptax/campusquery-rag/blob/main/app.py"
click node_pdf_extract "https://github.com/rishabhguptax/campusquery-rag/blob/main/pdf_ingest.py"
click node_chunking "https://github.com/rishabhguptax/campusquery-rag/blob/main/pdf_ingest.py"
click node_embedding "https://github.com/rishabhguptax/campusquery-rag/blob/main/pdf_ingest.py"
click node_vector_store "https://github.com/rishabhguptax/campusquery-rag/blob/main/pdf_ingest.py"
click node_web_crawl "https://github.com/rishabhguptax/campusquery-rag/blob/main/ingest_data.py"
click node_web_clean "https://github.com/rishabhguptax/campusquery-rag/blob/main/ingest_data.py"
click node_web_chunk "https://github.com/rishabhguptax/campusquery-rag/blob/main/ingest_data.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,node_answer toneBlue
class node_pipeline,node_retriever,node_context,node_generator toneAmber
class node_pdfs,node_pdf_extract,node_chunking,node_web_crawl,node_web_clean,node_web_chunk toneMint
class node_embedding,node_vector_store,node_groq toneRose
class node_student toneIndigo
```

## Components

### Student interface

- [Streamlit chat](https://github.com/rishabhguptax/campusquery-rag/blob/main/app.py): `app.py`
- [Answer with sources](https://github.com/rishabhguptax/campusquery-rag/blob/main/app.py): `app.py`

### Question answering

- [RAG orchestration](https://github.com/rishabhguptax/campusquery-rag/blob/main/rag_pipeline.py): `rag_pipeline.py`
- [Semantic retrieval](https://github.com/rishabhguptax/campusquery-rag/blob/main/retriever.py): `retriever.py`
- [Context and citations](https://github.com/rishabhguptax/campusquery-rag/blob/main/rag_pipeline.py): `rag_pipeline.py`
- [Grounded answer generation](https://github.com/rishabhguptax/campusquery-rag/blob/main/llm.py): `llm.py`

### Knowledge ingestion

- **College PDFs**
- [PDF page extraction](https://github.com/rishabhguptax/campusquery-rag/blob/main/pdf_ingest.py): `pdf_ingest.py`
- [Text chunking](https://github.com/rishabhguptax/campusquery-rag/blob/main/pdf_ingest.py): `pdf_ingest.py`
- [College website crawl](https://github.com/rishabhguptax/campusquery-rag/blob/main/ingest_data.py): `ingest_data.py`
- [HTML text cleaning](https://github.com/rishabhguptax/campusquery-rag/blob/main/ingest_data.py): `ingest_data.py`
- [Web page chunking](https://github.com/rishabhguptax/campusquery-rag/blob/main/ingest_data.py): `ingest_data.py`

### Models and storage

- [Embedding model](https://github.com/rishabhguptax/campusquery-rag/blob/main/pdf_ingest.py): `pdf_ingest.py`
- [Chroma vector store](https://github.com/rishabhguptax/campusquery-rag/blob/main/pdf_ingest.py): `pdf_ingest.py`
- **Groq service**

### Other components

- **Student**

## Connections

- Student → Streamlit chat: asks (evidence: `README.md`)
- Streamlit chat → RAG orchestration: submits question (evidence: `app.py`)
- RAG orchestration → Semantic retrieval: searches (evidence: `rag_pipeline.py`)
- Semantic retrieval → Chroma vector store: queries (evidence: `retriever.py`)
- RAG orchestration → Context and citations: builds (evidence: `rag_pipeline.py`)
- RAG orchestration → Grounded answer generation: requests answer (evidence: `rag_pipeline.py`)
- Grounded answer generation → Groq service: calls (evidence: `llm.py`)
- Context and citations → Grounded answer generation: supplies context (evidence: `rag_pipeline.py`)
- RAG orchestration → Streamlit chat: returns answer and sources (evidence: `app.py`)
- Streamlit chat → Answer with sources: renders (evidence: `app.py`)
- College PDFs → PDF page extraction: provides pages (evidence: `README.md`)
- PDF page extraction → Text chunking: splits extracted text (evidence: `pdf_ingest.py`)
- Text chunking → Embedding model: embeds chunks (evidence: `pdf_ingest.py`)
- Text chunking → Chroma vector store: stores chunks (evidence: `pdf_ingest.py`)
- College website crawl → HTML text cleaning: cleans HTML (evidence: `ingest_data.py`)
- HTML text cleaning → Web page chunking: provides text (evidence: `ingest_data.py`)
- Web page chunking → Chroma vector store: stores chunks (evidence: `ingest_data.py`)
