# elproximoframework/2026-06-16-rag-industrial architecture

> Architecture diagram of the GitHub repository elproximoframework/2026-06-16-rag-industrial, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/elproximoframework/2026-06-16-rag-industrial
- Repository: https://github.com/elproximoframework/2026-06-16-rag-industrial

## Overview

This is an industrial RAG application for querying technical and maintenance documents, ingesting files, and synchronizing document directories. The main user flow is an API query routed through semantic caching and an agentic RAG pipeline to retrieval, context compression, and grounded generation. Separate API capabilities support direct ingestion, incremental sync, health checks, and evaluation. The source index and excerpts support the main orchestration links; unsampled implementation details are represented only where module references establish the subsystem.

Main entry points: [`app/ingestion/pipeline.py`](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/pipeline.py) (Ingestion pipeline), [`app/api/routes.py`](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/api/routes.py) (API routes), [`app/retrieval/agentic_pipeline.py`](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/agentic_pipeline.py) (Agentic RAG pipeline), [`app/retrieval/engine.py`](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/engine.py) (Hybrid retrieval engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and operations"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_api_routes["API routes<br/>[routes.py]"]
  node_api_dependencies["Pipeline setup<br/>[dependencies.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
  node_evaluation["RAGAS evaluation<br/>[routes.py]"]
end

subgraph group_ingestion["Document ingestion"]
  node_ingest_pipeline["Ingestion pipeline<br/>[pipeline.py]"]
  node_parsers["PDF and DOCX parsers"]
  node_chunker["Parent-child chunking<br/>[splitter.py]"]
  node_metadata["Metadata extraction<br/>[extractor.py]"]
end

subgraph group_retrieval["Retrieval and answers"]
  node_rag["Agentic RAG pipeline"]
  node_router["Query router<br/>[router.py]"]
  node_engine["Hybrid retrieval engine<br/>[engine.py]"]
  node_bm25["BM25 search<br/>[bm25.py]"]
  node_transform["Query transformation<br/>[transformation.py]"]
  node_reranker["Cross-encoder reranker<br/>[reranker.py]"]
  node_compressor["Context compressor<br/>[compressor.py]"]
  node_generator["Grounded generator<br/>[generator.py]"]
  node_cache[("Semantic cache<br/>[cache.py]")]
end

subgraph group_state["Stores and sync"]
  node_sync["Directory sync<br/>[orchestrator.py]"]
  node_ledger[("Sync ledger<br/>[ledger.py]")]
  node_doc_store[("Parent document store<br/>[doc_store.py]")]
  node_vector_store[("Vector store<br/>[vector_store.py]")]
end

node_user(("API client"))
node_gemini{{"Gemini API"}}

node_user -->|"sends requests"| node_api_app
node_api_app -->|"mounts routes"| node_api_routes
node_api_app -->|"initializes pipelines"| node_api_dependencies
node_api_routes -->|"uses schemas"| node_schemas
node_api_routes -->|"gets dependencies"| node_api_dependencies
node_api_dependencies -->|"initializes"| node_ingest_pipeline
node_api_dependencies -->|"initializes"| node_rag
node_api_dependencies -->|"initializes"| node_cache
node_api_routes -->|"queries"| node_rag
node_api_routes -->|"checks and updates"| node_cache
node_api_routes -->|"ingests files"| node_ingest_pipeline
node_api_routes -->|"synchronizes directories"| node_sync
node_api_routes -->|"runs evaluation"| node_evaluation
node_evaluation -->|"queries dataset"| node_rag
node_evaluation -->|"evaluates with"| node_gemini
node_ingest_pipeline -->|"parses documents"| node_parsers
node_ingest_pipeline -->|"splits text"| node_chunker
node_ingest_pipeline -->|"extracts metadata"| node_metadata
node_ingest_pipeline -->|"stores parents"| node_doc_store
node_ingest_pipeline -->|"indexes children"| node_vector_store
node_ingest_pipeline -->|"updates ledger"| node_ledger
node_sync -->|"processes changed files"| node_ingest_pipeline
node_sync -->|"detects and records changes"| node_ledger
node_sync -->|"deletes parents"| node_doc_store
node_sync -->|"deletes vectors"| node_vector_store
node_rag -->|"classifies query"| node_router
node_rag -->|"retrieves candidates"| node_engine
node_rag -->|"compresses context"| node_compressor
node_rag -->|"generates answer"| node_generator
node_engine -->|"searches lexically"| node_bm25
node_engine -->|"transforms queries"| node_transform
node_engine -->|"reranks results"| node_reranker
node_engine -->|"searches vectors"| node_vector_store
node_engine -->|"retrieves parent chunks"| node_ingest_pipeline
node_compressor -->|"uses reranker"| node_reranker
node_router -->|"classifies with"| node_gemini

click node_api_app "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/api/main.py"
click node_api_routes "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/api/routes.py"
click node_api_dependencies "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/api/dependencies.py"
click node_schemas "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/api/schemas.py"
click node_evaluation "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/api/routes.py"
click node_ingest_pipeline "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/pipeline.py"
click node_parsers "https://github.com/elproximoframework/2026-06-16-rag-industrial/tree/main/app/ingestion/parsers"
click node_chunker "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/chunking/splitter.py"
click node_metadata "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/metadata/extractor.py"
click node_sync "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/sync/orchestrator.py"
click node_ledger "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/sync/ledger.py"
click node_doc_store "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/storage/doc_store.py"
click node_vector_store "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/storage/vector_store.py"
click node_rag "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/agentic_pipeline.py"
click node_router "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/router.py"
click node_engine "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/engine.py"
click node_bm25 "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/bm25.py"
click node_transform "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/transformation.py"
click node_reranker "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/reranker.py"
click node_compressor "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/compressor.py"
click node_generator "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/generator.py"
click node_cache "https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/cache.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api_app,node_api_routes,node_api_dependencies,node_schemas,node_evaluation,node_user toneBlue
class node_ingest_pipeline,node_parsers,node_chunker,node_metadata toneAmber
class node_rag,node_router,node_engine,node_bm25,node_transform,node_reranker,node_compressor,node_generator,node_cache,node_gemini toneMint
class node_sync,node_ledger,node_doc_store,node_vector_store toneRose
```

## Components

### API and operations

- [FastAPI app](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/api/main.py): `app/api/main.py`
- [API routes](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/api/routes.py): `app/api/routes.py`
- [Pipeline setup](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/api/dependencies.py): `app/api/dependencies.py`
- [API schemas](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/api/schemas.py): `app/api/schemas.py`
- [RAGAS evaluation](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/api/routes.py): `app/api/routes.py`

### Document ingestion

- [Ingestion pipeline](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/pipeline.py): `app/ingestion/pipeline.py`
- [PDF and DOCX parsers](https://github.com/elproximoframework/2026-06-16-rag-industrial/tree/main/app/ingestion/parsers): `app/ingestion/parsers`
- [Parent-child chunking](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/chunking/splitter.py): `app/ingestion/chunking/splitter.py`
- [Metadata extraction](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/metadata/extractor.py): `app/ingestion/metadata/extractor.py`

### Retrieval and answers

- [Agentic RAG pipeline](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/agentic_pipeline.py): `app/retrieval/agentic_pipeline.py`
- [Query router](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/router.py): `app/retrieval/router.py`
- [Hybrid retrieval engine](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/engine.py): `app/retrieval/engine.py`
- [BM25 search](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/bm25.py): `app/retrieval/bm25.py`
- [Query transformation](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/transformation.py): `app/retrieval/transformation.py`
- [Cross-encoder reranker](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/reranker.py): `app/retrieval/reranker.py`
- [Context compressor](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/compressor.py): `app/retrieval/compressor.py`
- [Grounded generator](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/generator.py): `app/retrieval/generator.py`
- [Semantic cache](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/retrieval/cache.py): `app/retrieval/cache.py`

### Stores and sync

- [Directory sync](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/sync/orchestrator.py): `app/ingestion/sync/orchestrator.py`
- [Sync ledger](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/sync/ledger.py): `app/ingestion/sync/ledger.py`
- [Parent document store](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/storage/doc_store.py): `app/ingestion/storage/doc_store.py`
- [Vector store](https://github.com/elproximoframework/2026-06-16-rag-industrial/blob/main/app/ingestion/storage/vector_store.py): `app/ingestion/storage/vector_store.py`

### Other components

- **API client**
- **Gemini API**

## Connections

- API client → FastAPI app: sends requests (evidence: `app/api/main.py`)
- FastAPI app → API routes: mounts routes (evidence: `app/api/main.py`)
- FastAPI app → Pipeline setup: initializes pipelines (evidence: `app/api/main.py`)
- API routes → API schemas: uses schemas (evidence: `app/api/routes.py`)
- API routes → Pipeline setup: gets dependencies (evidence: `app/api/routes.py`)
- Pipeline setup → Ingestion pipeline: initializes (evidence: `app/api/dependencies.py`)
- Pipeline setup → Agentic RAG pipeline: initializes (evidence: `app/api/dependencies.py`)
- Pipeline setup → Semantic cache: initializes (evidence: `app/api/dependencies.py`)
- API routes → Agentic RAG pipeline: queries (evidence: `app/api/routes.py`)
- API routes → Semantic cache: checks and updates (evidence: `app/api/routes.py`)
- API routes → Ingestion pipeline: ingests files (evidence: `app/api/routes.py`)
- API routes → Directory sync: synchronizes directories (evidence: `app/api/routes.py`)
- API routes → RAGAS evaluation: runs evaluation (evidence: `app/api/routes.py`)
- RAGAS evaluation → Agentic RAG pipeline: queries dataset (evidence: `app/api/routes.py`)
- RAGAS evaluation → Gemini API: evaluates with (evidence: `app/api/routes.py`)
- Ingestion pipeline → PDF and DOCX parsers: parses documents (evidence: `app/ingestion/pipeline.py`)
- Ingestion pipeline → Parent-child chunking: splits text (evidence: `app/ingestion/pipeline.py`)
- Ingestion pipeline → Metadata extraction: extracts metadata (evidence: `app/ingestion/pipeline.py`)
- Ingestion pipeline → Parent document store: stores parents (evidence: `app/ingestion/pipeline.py`)
- Ingestion pipeline → Vector store: indexes children (evidence: `app/ingestion/pipeline.py`)
- Ingestion pipeline → Sync ledger: updates ledger (evidence: `app/ingestion/pipeline.py`)
- Directory sync → Ingestion pipeline: processes changed files (evidence: `app/ingestion/sync/orchestrator.py`)
- Directory sync → Sync ledger: detects and records changes (evidence: `app/ingestion/sync/orchestrator.py`)
- Directory sync → Parent document store: deletes parents (evidence: `app/ingestion/sync/orchestrator.py`)
- Directory sync → Vector store: deletes vectors (evidence: `app/ingestion/sync/orchestrator.py`)
- Agentic RAG pipeline → Query router: classifies query (evidence: `app/retrieval/agentic_pipeline.py`)
- Agentic RAG pipeline → Hybrid retrieval engine: retrieves candidates (evidence: `app/retrieval/agentic_pipeline.py`)
- Agentic RAG pipeline → Context compressor: compresses context (evidence: `app/retrieval/agentic_pipeline.py`)
- Agentic RAG pipeline → Grounded generator: generates answer (evidence: `app/retrieval/agentic_pipeline.py`)
- Hybrid retrieval engine → BM25 search: searches lexically (evidence: `app/retrieval/engine.py`)
- Hybrid retrieval engine → Query transformation: transforms queries (evidence: `app/retrieval/engine.py`)
- Hybrid retrieval engine → Cross-encoder reranker: reranks results (evidence: `app/retrieval/engine.py`)
- Hybrid retrieval engine → Vector store: searches vectors (evidence: `app/retrieval/engine.py`)
- Hybrid retrieval engine → Ingestion pipeline: retrieves parent chunks (evidence: `app/retrieval/engine.py`)
- Context compressor → Cross-encoder reranker: uses reranker (evidence: `app/retrieval/compressor.py`)
- Query router → Gemini API: classifies with (evidence: `app/retrieval/router.py`)
