How julien-dufresne/dark_future_bot works
This is a Warhammer 40K lore RAG chatbot with a Streamlit interface and a command-line chat entry point. The main workflow loads XML lore, builds or opens a persistent vector index, then answers questions through query transformation, retrieval, reranking, conversation memory, and an LLM. A separate evaluation subsystem tests baseline, chunking, and reranker configurations with Ragas. The graph follows the sampled call sites; README-documented capabilities without sampled implementation links are identified only where their relationship is explicit.
Main entry points: engine.py Chat Orchestrator · evaluation_engine.py Evaluation Runner · evaluation_helper_functions.py Evaluation Helpers · model_loader.py Embedding Model
Components 22
Chat Interfaces
- Streamlit Chat
streamlit_app.py - CLI Entry
main.py - CLI Chat Loop
src/engine.py
Knowledge Indexing
- XML Loader
src/document_loader.py - Lore XML
data - Index Builder
src/engine.py - Sentence Splitter
src/engine.py - Persistent Vector Index
src/engine.py
RAG Runtime
- Chat Orchestrator
src/engine.py - HyDE Transform
src/engine.py - Vector Retriever
src/engine.py - Result Reranker
src/engine.py - Chat Memory
src/engine.py - Embedding Model
src/model_loader.py - Groq LLM
src/model_loader.py
RAG Evaluation
- Evaluation Runner
evaluation/evaluation_engine.py - Evaluation Helpers
evaluation/evaluation_helper_functions.py - Evaluation Questions
evaluation/evaluation_questions.py - Ragas Models
evaluation/evaluation_model_loader.py - Evaluation Settings
evaluation/evaluation_config.py - Evaluation Results
evaluation/evaluation_helper_functions.py
Other components
- Chat User
Connections 26
- Chat User → Streamlit Chat: asks question
streamlit_app.py - Streamlit Chat → Chat Orchestrator: submits prompt
streamlit_app.py - CLI Entry → CLI Chat Loop: starts loop
main.py - CLI Chat Loop → Chat Orchestrator: initializes
src/engine.py - Chat Orchestrator → Index Builder: gets index
src/engine.py - Index Builder → Lore XML: reads XML
src/engine.py - Index Builder → XML Loader: loads articles
src/engine.py - XML Loader → Index Builder: returns documents
src/engine.py - Index Builder → Sentence Splitter: splits documents
src/engine.py - Index Builder → Embedding Model: embeds documents
src/engine.py - Index Builder → Persistent Vector Index: persists index
src/engine.py - Index Builder → Persistent Vector Index: loads index
src/engine.py - Chat Orchestrator → HyDE Transform: configures transform
src/engine.py - Chat Orchestrator → Vector Retriever: configures retrieval
src/engine.py - Chat Orchestrator → Result Reranker: sets postprocessor
src/engine.py - Chat Orchestrator → Chat Memory: sets memory
src/engine.py - Chat Orchestrator → Groq LLM: uses model
src/engine.py - Chat Orchestrator → Embedding Model: passes model
streamlit_app.py - Evaluation Runner → Evaluation Helpers: runs evaluation helpers
evaluation/evaluation_engine.py - Evaluation Runner → Ragas Models: loads metric models
evaluation/evaluation_engine.py - Evaluation Runner → Evaluation Settings: reads strategies
evaluation/evaluation_engine.py - Evaluation Runner → Evaluation Questions: gets questions
evaluation/evaluation_engine.py - Evaluation Helpers → Evaluation Questions: reads dataset
evaluation/evaluation_helper_functions.py - Evaluation Helpers → Evaluation Results: writes CSV results
evaluation/evaluation_helper_functions.py - Evaluation Runner → Embedding Model: uses app embeddings
evaluation/evaluation_engine.py - Evaluation Runner → Groq LLM: uses app LLM
evaluation/evaluation_engine.py