# shv2312/university-chatbot-and-assistant architecture

> Architecture diagram of the GitHub repository shv2312/university-chatbot-and-assistant, 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/shv2312/university-chatbot-and-assistant
- Repository: https://github.com/shv2312/university-chatbot-and-assistant

## Overview

The product is a Streamlit university-policy assistant. Its main workflow accepts uploaded or bundled documents, extracts page-aware text, chunks it with citation metadata, persists embeddings, retrieves relevant passages for a question, and returns a grounded answer with source references. The graph also shows document administration, local ChromaDB persistence, and optional Gemini services. The source excerpts are partial, so some dashboard-management and app-to-answer wiring is documented rather than directly visible in the sampled calls.

Main entry points: [`app.py`](https://github.com/shv2312/university-chatbot-and-assistant/blob/main/app.py) (Streamlit dashboard), [`src/vector_store.py`](https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/vector_store.py) (Index and search), [`src/rag_pipeline.py`](https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/rag_pipeline.py) (Retrieval and guardrails), [`src/document_processor.py`](https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/document_processor.py) (Page extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Dashboard"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_document_admin["Document management<br/>[app.py]"]
end

subgraph group_ingest["Document ingestion"]
  node_extract["Page extraction"]
  node_chunk["Metadata chunking"]
end

subgraph group_knowledge["Knowledge base"]
  node_index_manager["Index and search<br/>[vector_store.py]"]
  node_vector_db[("Persistent vector collection")]
end

subgraph group_answering["Grounded answers"]
  node_rag["Retrieval and guardrails<br/>[rag_pipeline.py]"]
  node_answer_sources["Answer and citations<br/>[rag_pipeline.py]"]
end

subgraph group_services["External services"]
  node_embedding_api{{"Google embeddings"}}
  node_gemini{{"Google Gemini"}}
end

node_user(("Student or faculty"))
node_documents["Policy documents"]

node_user -->|"asks or uploads"| node_dashboard
node_documents -->|"uploads or selects"| node_dashboard
node_dashboard -->|"extracts text"| node_extract
node_extract -->|"produces pages"| node_chunk
node_dashboard -->|"chunks documents"| node_chunk
node_dashboard -->|"indexes chunks"| node_index_manager
node_index_manager -->|"persists and searches"| node_vector_db
node_dashboard -->|"manages documents"| node_document_admin
node_document_admin -.->|"lists, deletes, resets"| node_index_manager
node_dashboard -.->|"submits question"| node_rag
node_rag -->|"searches chunks"| node_index_manager
node_index_manager -.->|"embeds text"| node_embedding_api
node_rag -->|"requests grounded answer"| node_gemini
node_rag -->|"returns answer and sources"| node_answer_sources
node_dashboard -->|"displays citations"| node_answer_sources

click node_dashboard "https://github.com/shv2312/university-chatbot-and-assistant/blob/main/app.py"
click node_document_admin "https://github.com/shv2312/university-chatbot-and-assistant/blob/main/app.py"
click node_extract "https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/document_processor.py"
click node_chunk "https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/document_processor.py"
click node_index_manager "https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/vector_store.py"
click node_rag "https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/rag_pipeline.py"
click node_answer_sources "https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/rag_pipeline.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_dashboard,node_document_admin toneBlue
class node_extract,node_chunk toneAmber
class node_index_manager,node_vector_db toneMint
class node_rag,node_answer_sources toneRose
class node_embedding_api,node_gemini,node_user,node_documents toneIndigo
```

## Components

### Dashboard

- [Streamlit dashboard](https://github.com/shv2312/university-chatbot-and-assistant/blob/main/app.py): `app.py`
- [Document management](https://github.com/shv2312/university-chatbot-and-assistant/blob/main/app.py): `app.py`

### Document ingestion

- [Page extraction](https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/document_processor.py): `src/document_processor.py`
- [Metadata chunking](https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/document_processor.py): `src/document_processor.py`

### Knowledge base

- [Index and search](https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/vector_store.py): `src/vector_store.py`
- **Persistent vector collection**

### Grounded answers

- [Retrieval and guardrails](https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/rag_pipeline.py): `src/rag_pipeline.py`
- [Answer and citations](https://github.com/shv2312/university-chatbot-and-assistant/blob/main/src/rag_pipeline.py): `src/rag_pipeline.py`

### External services

- **Google embeddings**
- **Google Gemini**

### Other components

- **Student or faculty**
- **Policy documents**

## Connections

- Student or faculty → Streamlit dashboard: asks or uploads (evidence: `README.md`)
- Policy documents → Streamlit dashboard: uploads or selects (evidence: `README.md`)
- Streamlit dashboard → Page extraction: extracts text (evidence: `app.py`)
- Page extraction → Metadata chunking: produces pages (evidence: `src/document_processor.py`)
- Streamlit dashboard → Metadata chunking: chunks documents (evidence: `app.py`)
- Streamlit dashboard → Index and search: indexes chunks (evidence: `app.py`)
- Index and search → Persistent vector collection: persists and searches (evidence: `README.md`)
- Streamlit dashboard → Document management: manages documents (evidence: `README.md`)
- Document management → Index and search: lists, deletes, resets (evidence: `README.md`)
- Streamlit dashboard → Retrieval and guardrails: submits question (evidence: `app.py`)
- Retrieval and guardrails → Index and search: searches chunks (evidence: `src/rag_pipeline.py`)
- Index and search → Google embeddings: embeds text (evidence: `README.md`)
- Retrieval and guardrails → Google Gemini: requests grounded answer (evidence: `src/rag_pipeline.py`)
- Retrieval and guardrails → Answer and citations: returns answer and sources (evidence: `src/rag_pipeline.py`)
- Streamlit dashboard → Answer and citations: displays citations (evidence: `app.py`)
