How salvatoreftartaglione/diem-assistant-rag works
DIEM Assistant is an Italian-language university help chatbot grounded in official DIEM sources. Its principal workflow runs from a student question through Chainlit, shared conversation handling, the LangGraph guardrail/rewrite/retrieval/generation flow, and a cited response. Offline, crawled pages and PDFs are deduplicated, parent-child indexed, and made available to semantic and BM25 retrieval. The README also documents RAGAS evaluation. Some subsystem links are based on README architecture rather than sampled implementation; unsampled links are omitted where their ownership is unclear.
Main entry points: graph.py LangGraph workflow · indexer.py Parent-child indexer · resources.py Loaded models and stores · nodes.py Guardrails and generation
Components 21
Knowledge ingestion
- Crawler and extractor
diem_rag/ingestion/extractor.py - Knowledge base
- Deduplication
diem_rag/ingestion/kb_filter.py
Indexing and stores
- Parent-child indexer
diem_rag/indexing/indexer.py - Vector store
- Parent chunk store
- Dual BM25 indices
diem_rag/indexing/bm25_indexer.py
Agent workflow
- Turn handling
diem_rag/agent/conversation.py - LangGraph workflow
diem_rag/agent/graph.py - Agent state
diem_rag/agent/state.py - Guardrails and generation
diem_rag/agent/nodes.py - Prompt templates
diem_rag/agent/prompts.py - Runtime configuration
diem_rag/config.py
Retrieval and answers
- Loaded models and stores
diem_rag/agent/resources.py - Hybrid retrieval and reranking
diem_rag/agent/retrieval.py - Context budgeting
diem_rag/agent/context.py
Interfaces and evaluation
- Chainlit UI
DIEM_assistant.py - Terminal chat
diem_rag/agent/cli.py - RAGAS evaluation
diem_rag/evaluation/ragas_eval.py
Other components
- Student
- University portals and PDFs
Connections 24
- Student → Chainlit UI: asks
README.md - Chainlit UI → Turn handling: submits turn
DIEM_assistant.py - Turn handling → LangGraph workflow: invokes
diem_rag/agent/conversation.py - LangGraph workflow → Guardrails and generation: dispatches
diem_rag/agent/graph.py - LangGraph workflow → Hybrid retrieval and reranking: dispatches retrieval
diem_rag/agent/graph.py - LangGraph workflow → Agent state: uses state
diem_rag/agent/graph.py - Guardrails and generation → Prompt templates: uses prompts
diem_rag/agent/nodes.py - Guardrails and generation → Context budgeting: builds context
diem_rag/agent/nodes.py - University portals and PDFs → Crawler and extractor: crawls
README.md - Crawler and extractor → Knowledge base: extracts
README.md - Knowledge base → Deduplication: deduplicates
README.md - Deduplication → Parent-child indexer: indexes
README.md - Parent-child indexer → Vector store: embeds children
README.md - Parent-child indexer → Parent chunk store: stores parents
README.md - Parent-child indexer → Dual BM25 indices: builds lexical indices
README.md - Hybrid retrieval and reranking → Loaded models and stores: uses loaded stores
diem_rag/agent/retrieval.py - Loaded models and stores → Vector store: opens
diem_rag/agent/resources.py - Loaded models and stores → Parent chunk store: loads
diem_rag/agent/resources.py - Loaded models and stores → Dual BM25 indices: loads
diem_rag/agent/resources.py - Hybrid retrieval and reranking → Context budgeting: ranks documents
README.md - Context budgeting → Guardrails and generation: provides context
diem_rag/agent/nodes.py - LangGraph workflow → Runtime configuration: reads feature flags
diem_rag/agent/graph.py - Terminal chat → Turn handling: runs turns
diem_rag/agent/cli.py - RAGAS evaluation → Parent chunk store: resolves retrieved chunks
diem_rag/evaluation/ragas_eval.py