How hidekikzm/modulo-nlp--juribot works
Juribot is a Portuguese legal-question assistant: a user submits a query through the primary HTML UI or API, the API routes chat requests, optionally retrieves legal PDF passages from Qdrant, and returns cited sources or a Gemini-generated answer. Separate ingestion extracts/OCRs and chunks PDFs before embedding and publishing document versions. The graph follows the sampled API/runtime path; lexical search and the legacy RAG pipeline are present but not shown as wired into the active API.
Main entry points: runtime.py Runtime and search · app_main.py FastAPI app · routers_chat.py Chat endpoint · pipeline.py RAG pipeline
Components 17
API and interaction
- HTML chat UI
backend/ui/index.html - FastAPI app
backend/app_main.py - Chat endpoint
backend/api/routers_chat.py - Classification endpoint
backend/api/routes_classify.py
Retrieval and generation
- RAG routing
backend/services/router.py - Embedding model
backend/rag/embeddings.py - Index contract
backend/rag/index_contract.py - Gemini generation
backend/rag/generator_gemini.py - Lexical search
backend/rag/lexical.py - RAG pipeline
backend/rag/pipeline.py
Document indexing
- Legal PDFs
data - PDF extraction and chunking
backend/ingest/prepare_index.py - Index publication
backend/rag/vector_qdrant.py
Runtime resources
- Runtime and search
backend/core/runtime.py - Settings
backend/core/config.py - Qdrant index
Other components
- User
Connections 21
- User → HTML chat UI: submits query
README.md - HTML chat UI → FastAPI app: calls API
README.md - FastAPI app → Chat endpoint: mounts route
backend/app_main.py - FastAPI app → Classification endpoint: mounts route
backend/app_main.py - FastAPI app → Runtime and search: loads resources
backend/app_main.py - FastAPI app → RAG routing: initializes
backend/app_main.py - Chat endpoint → RAG routing: decides mode
backend/api/routers_chat.py - Chat endpoint → Runtime and search: searches sources
backend/api/routers_chat.py - Runtime and search → Embedding model: loads model
backend/core/runtime.py - Runtime and search → Index contract: validates and searches
backend/core/runtime.py - Runtime and search → Qdrant index: queries index
backend/core/runtime.py - Chat endpoint → Gemini generation: generates answer
- Legal PDFs → PDF extraction and chunking: extracts text
README.md - PDF extraction and chunking → Embedding model: embeds chunks
backend/ingest/prepare_index.py - PDF extraction and chunking → Index publication: publishes versions
backend/ingest/prepare_index.py - Index publication → Qdrant index: writes points
backend/rag/vector_qdrant.py - Index publication → Index contract: validates index
backend/rag/vector_qdrant.py - RAG pipeline → Lexical search: imports only
- RAG pipeline → Gemini generation: generates response
backend/rag/pipeline.py - RAG pipeline → RAG routing: separate routing
- Settings → Runtime and search: configures resources
backend/core/runtime.py