Maborak product engineering · LegalAI / PactoLegal
Ingesting legal documents and retrieving cited sources
The engineering challenge
Legal research depends on locating relevant material and retaining its source. The system must ingest heterogeneous documents, retrieve useful passages and connect generated answers to the underlying legal corpus.
Keep retrieval separate from generation
A dedicated retrieval layer makes source material available to the answer pipeline, but requires maintaining ingestion quality and index freshness. Citations aid verification; they do not replace professional review.
Platform architecture
Application, data and infrastructure.
Legal corpus ingestion, document processing, retrieval, model integration, research interfaces and supporting infrastructure.
- IngestionLegal sources and document OCR
- RetrievalEmbeddings and Qdrant search
- GenerationLanguage-model adapters
- ApplicationResearch, documents and accounts
Data flow
- Legal sources
- Ingestion / OCR
- Search indexes
- Retrieval
- Cited responses
Corpus and documents
Source adapters ingest legal norms and court decisions. Document ingestion and OCR services turn source material into content for indexing and research.
Retrieval and model orchestration
Retrieval services connect to Qdrant vector search. Separate embedding and language-model adapters keep retrieval, model selection and response generation behind explicit application interfaces.
Application infrastructure
The research application includes authenticated accounts, document workflows, subscriptions and notifications. The container stack separates the API and interface from PostgreSQL, connection pooling, Redis and Qdrant.
- FastAPI
- React / TypeScript
- PostgreSQL
- Qdrant
- Redis
- OCR / model adapters
The resulting system
An integrated research system for Bolivian legal material, combining corpus processing, source retrieval and a citation-oriented research interface.
Scope: Legal corpus ingestion, document processing, retrieval, model integration, research interfaces and supporting infrastructure.