How vandinh2912/hybrid_rag_agu works
This is an AGU academic-regulations question-answering product. Users ask through the CLI or desktop GUI; the pipeline normalizes and expands the query, retrieves evidence with hybrid search, and generates a cited answer. Separate product branches ingest documents, collect learning feedback, and compare/evaluate chunking and answer quality. Edges reflect the excerpts, SOURCE INDEX references, or README; some internal call details and unsampled subsystems are documented only at a high level.
Main entry points: pipeline.py RAG orchestrator · ingest.py Ingestion workflow · app.py Desktop GUI · generator.py Answer generation
Components 21
User interfaces
- Interactive CLI
main.py - Desktop GUI
ui/app.py - Chunking demo
demo_streamlit.py
Knowledge preparation
- Regulations corpus
data/corpus - Document loader
src/loader.py - Document chunker
src/chunking.py - Ingestion workflow
ingest.py - Hybrid index
src/vector_db.py
Answer pipeline
- RAG orchestrator
src/pipeline.py - Query normalization
src/query_normalizer.py - Local Qwen
src/local_slm.py - Legal query expansion
src/retrieval.py - Text folding
src/text_utils.py - Answer generation
src/generator.py
Learning and evaluation
- Learning feedback
ui/app.py - CLI learning mode
learn.py - Pipeline evaluation
src/evaluation.py - Chunking benchmark
benchmark_chunking.py
Other components
- Student
- Gemini API
- Ollama service
Connections 26
- Student → Interactive CLI: asks via
README.md - Student → Desktop GUI: asks via
README.md - Interactive CLI → RAG orchestrator: submits query
main.py - Desktop GUI → RAG orchestrator: submits query
ui/app.py - RAG orchestrator → Query normalization: normalizes with
src/pipeline.py - Query normalization → Local Qwen: uses
src/query_normalizer.py - Local Qwen → Ollama service: calls
src/local_slm.py - RAG orchestrator → Legal query expansion: expands query
src/pipeline.py - RAG orchestrator → Hybrid index: retrieves from
src/pipeline.py - Hybrid index → Text folding: folds tokens
src/vector_db.py - RAG orchestrator → Text folding: folds query
src/pipeline.py - RAG orchestrator → Answer generation: generates answer
README.md - Answer generation → Gemini API: generates with
src/generator.py - Answer generation → Ollama service: falls back to
README.md - Regulations corpus → Document loader: provides documents
- Ingestion workflow → Document loader: loads corpus
ingest.py - Ingestion workflow → Document chunker: chunks documents
ingest.py - Ingestion workflow → Hybrid index: builds index
ingest.py - Desktop GUI → Ingestion workflow: starts reload
ui/app.py - Desktop GUI → Learning feedback: records labels
ui/app.py - CLI learning mode → RAG orchestrator: tests queries
learn.py - CLI learning mode → Ingestion workflow: refreshes corpus
learn.py - Pipeline evaluation → RAG orchestrator: evaluates runs
src/evaluation.py - Chunking benchmark → RAG orchestrator: benchmarks strategies
benchmark_chunking.py - Chunking demo → Document chunker: compares strategies
demo_streamlit.py - Chunking demo → RAG orchestrator: runs comparisons
demo_streamlit.py