Architecture
On this page
It then attempts two additional, best-effort import blocks wrapped in try/except ImportError: pass:
try:
from zerda.rag.core.evaluation import RAGEvaluator, EvalSample, EvalResult, EvalReport, MetricScore
except ImportError:
pass
try:
from zerda.rag.core.document_versioning import DocumentVersionManager, DocVersion, ContentDiff
except ImportError:
pass
[!NOTE] Why this matters If
evaluation.pyordocument_versioning(or one of their imports) fails to import for any reason,coreas a whole will still import successfully — butRAGEvaluator/DocumentVersionManagerand friends will silently be unavailable from the top-levelcorenamespace. Note thatRAGConfigis imported frombase_rag_system, which itself imports it fromrag_config— both import paths resolve to the same class.
Module dependency graph
This graph reflects only the intra-package from .module import ... statements found in the source.
evaluation and document_versioning are notably standalone — neither imports anything else from core at module load time. document_versioning.py only reaches into rag_system via a deferred, function-local import inside DocumentVersionManager.add_or_update():
from zerda.rag.core.rag_system import LoadedDocument
This import uses the installed package path (zerda.rag.core), not a relative import — meaning DocumentVersionManager.add_or_update() will only work correctly when core is installed as part of the zerda.rag package tree, not when used as a bare top-level core.
Class relationships
RAGConfig and RerankerConfig are not linked by inheritance or composition in the source — RAGSystem.__init__ manually copies rerank_* fields from RAGConfig into a fresh RerankerConfig instance when constructing the Reranker (see RAGSystem internals).
End-to-end request flow (generate / ask)
If retrieve() finds no chunks, generate() short-circuits and returns a "No relevant information found." message without calling the LLM (see RAGSystem.generate).
Ingestion flow (add_documents)
Extension points
Based on the abstract methods and duck-typed interfaces in the source, core exposes these extension points:
What is not in this codebase
To avoid inventing functionality, note explicitly what the analyzed source does not contain:
- No REST or WebSocket API layer.
- No CLI commands.
- No database ORM models.
- No plugin/entry-point discovery system.
- No built-in vector database, embedding model, or LLM client implementation — these are caller-supplied dependencies.
- No background worker/scheduler.