How aigurutinix/r2ai-stage-1 works
This repository is a collection of independent Vietnamese legal-information-retrieval and legal-QA contest submissions, not one shared runtime. The principal workflow is a user question entering a team’s application, being matched against legal-document indexes, and producing a grounded answer with citations. The graph highlights the sampled NextGen and Hung&Phong runtime paths, plus other documented/core subsystems. Some components are represented by their exact tree paths but were not sampled; their internal connections are therefore omitted. The README describes intended capabilities, not a shared implementation.
Main entry points: src/main.py Pipeline runner · service.py RAG service · hybrid_retriever.py Hybrid retrieval · backend/main.py Chat API
Components 27
NextGen legal assistant
- Chat UI
nextgen/src/src/web/src/App.jsx - SSE client
nextgen/src/src/web/src/lib/sse.js - Demo API
nextgen/src/src/app/main.py - RAG service
nextgen/src/src/app/service.py - Pipeline runner
nextgen/src/main.py - Hybrid retrieval
nextgen/src/src/hybrid_retriever.py - BM25 index
nextgen/src/src/index_bm25.py - Cross-encoder ranker
nextgen/src/src/reranker.py - Answer generation
nextgen/src/src/answer_generator.py - API answer generation
nextgen/src/src/api_answer_generator.py - Self-verification
nextgen/src/src/self_verifier.py - Reference post-processing
nextgen/src/src/post_processor.py - Pipeline settings
nextgen/src/src/config/settings.py
Hung&Phong RAG
- Chat API
hung&phong/src/backend/main.py - RAG pipeline
hung&phong/src/backend/rag.py - Query filters
hung&phong/src/backend/query_analyzer.py - Backend settings
hung&phong/src/backend/config.py
mscAI services
- Backend settings
mscai/src/backend/src/config.py - Legal API routes
mscai/src/backend/src/routers/legal.py - Vector index builder
mscai/src/backend/src/services/vector_store/index_builder.py - MCP settings
mscai/src/mcp/src/legal_mcp/config.py
Other team submissions
- LLM reretrieval
nguyenvannghiem/src/code/retrieval_llm_rerank.py - Agent settings
thanhkhauson/src/Agents/config.py - Local model settings
tranthanhtu/src/backend/local_models_config.py - Legal corpus canonicalizer
agentic_builders/src/03_source_code/data_pipeline/canonicalize_legal_corpus.py - Legal search
beeit/src/search_v2.py
Other components
- Questioner
Connections 16
- Questioner → Chat UI: asks
README.md - Chat UI → SSE client: streams questions
nextgen/src/src/web/src/App.jsx - Demo API → RAG service: delegates to
nextgen/src/src/app/main.py - RAG service → Hybrid retrieval: retrieves with
nextgen/src/src/app/service.py - RAG service → Cross-encoder ranker: reranks with
nextgen/src/src/app/service.py - RAG service → API answer generation: generates via
nextgen/src/src/app/service.py - RAG service → Pipeline settings: reads settings
nextgen/src/src/app/service.py - Pipeline runner → Hybrid retrieval: retrieves with
nextgen/src/main.py - Pipeline runner → Cross-encoder ranker: reranks with
nextgen/src/main.py - Pipeline runner → Answer generation: generates via
nextgen/src/main.py - Pipeline runner → Self-verification: verifies with
nextgen/src/main.py - Pipeline runner → Reference post-processing: post-processes
nextgen/src/main.py - Hybrid retrieval → BM25 index: uses sparse index
nextgen/src/src/hybrid_retriever.py - Chat API → RAG pipeline: calls
hung&phong/src/backend/main.py - Chat API → Backend settings: loads settings
hung&phong/src/backend/main.py - RAG pipeline → Query filters: analyzes query
hung&phong/src/backend/rag.py