# santhi-tech/tata-automotive-rag architecture

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

- Interactive diagram: https://gitdiagram.com/santhi-tech/tata-automotive-rag
- Repository: https://github.com/santhi-tech/tata-automotive-rag

## Overview

Tata Automotive RAG ingests product knowledge from four catalogue categories, normalizes it, enriches missing text/image embeddings, and persists searchable records. Users query through the Streamlit UI or authenticated REST API; retrieval scopes results by category, combines vector and keyword search, and returns grounded multilingual answers with sources and image results. The map includes shared loader infrastructure and the local Ollama service. Some subsystem links reflect README architecture because their implementation was not fully sampled.

Main entry points: [`src/ingestion/pipeline.py`](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/pipeline.py) (Ingestion Pipeline), [`src/retrieval/retriever.py`](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/retrieval/retriever.py) (Category-Scoped Retrieval), [`src/ingestion/loader/loader.py`](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/loader.py) (Loader Registry), [`src/api/v1/routes.py`](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/api/v1/routes.py) (REST API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Ingestion"]
  node_pipeline["Ingestion Pipeline<br/>[pipeline.py]"]
  node_registry["Loader Registry<br/>[loader.py]"]
  node_cars["Cars Loader<br/>[cars_loader.py]"]
  node_generic["Generic Vehicle Loader<br/>[generic_loader.py]"]
  node_motorcycles["Motorcycles Loader"]
  node_scooters["Scooters Loader<br/>[scooters_loader.py]"]
  node_parts["Spare Parts Loader"]
  node_base["Browser &amp; Image Fetch<br/>[base_loader.py]"]
  node_normalizer["Document Normalizer"]
  node_attributes["Attribute Normalization<br/>[attributes.py]"]
end

subgraph group_knowledge["Knowledge Store"]
  node_imagefiles["Persistent Image Files<br/>[image_store.py]"]
  node_store["Metadata Store<br/>[metadata_store.py]"]
  node_postgres[("PostgreSQL + pgvector")]
end

subgraph group_serving["Query &amp; Serving"]
  node_ui["Streamlit UI<br/>[ui_streamlit.py]"]
  node_api["REST API<br/>[routes.py]"]
  node_auth["JWT Authentication<br/>[auth.py]"]
  node_deps["API Dependencies<br/>[deps.py]"]
  node_retriever["Category-Scoped Retrieval<br/>[retriever.py]"]
end

subgraph group_platform["Model Service"]
  node_embedder["Embedding &amp; Vision Client<br/>[embedder.py]"]
  node_ollama["Ollama"]
end

node_operator(("Catalogue Operator"))
node_web["Product Websites"]
node_user(("User"))

node_operator -->|"starts ingestion"| node_pipeline
node_pipeline -->|"selects loaders"| node_registry
node_registry -->|"dispatches category"| node_cars
node_registry -->|"dispatches category"| node_motorcycles
node_registry -->|"dispatches category"| node_scooters
node_registry -->|"dispatches category"| node_parts
node_cars -->|"uses browser helpers"| node_base
node_generic -->|"extends loader"| node_base
node_motorcycles -->|"uses generic loader"| node_generic
node_scooters -->|"uses generic loader"| node_generic
node_parts -->|"uses browser helpers"| node_base
node_web -.->|"provides pages"| node_cars
node_web -.->|"provides pages"| node_generic
node_web -.->|"provides pages"| node_parts
node_pipeline -->|"normalizes documents"| node_normalizer
node_normalizer -->|"canonicalizes attributes"| node_attributes
node_normalizer -->|"resolves image paths"| node_imagefiles
node_pipeline -->|"embeds missing content"| node_embedder
node_pipeline -->|"upserts documents"| node_store
node_store -->|"writes chunks &amp; images"| node_postgres
node_pipeline -->|"persists ingestion state"| node_postgres
node_embedder -->|"requests embeddings &amp; captions"| node_ollama
node_user -->|"asks questions"| node_ui
node_user -->|"calls endpoints"| node_api
node_api -->|"authenticates requests"| node_auth
node_api -->|"uses dependencies"| node_deps
node_ui -->|"submits queries"| node_retriever
node_api -.->|"serves search"| node_retriever
node_retriever -->|"embeds query"| node_embedder
node_retriever -->|"searches scoped vectors &amp; keywords"| node_postgres
node_retriever -->|"generates grounded answers"| node_ollama
node_retriever -.->|"returns answers &amp; images"| node_ui

click node_pipeline "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/pipeline.py"
click node_registry "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/loader.py"
click node_cars "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/cars_loader.py"
click node_generic "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/generic_loader.py"
click node_motorcycles "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/motorcycles_loader.py"
click node_scooters "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/scooters_loader.py"
click node_parts "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/spare_parts_loader.py"
click node_base "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/base_loader.py"
click node_normalizer "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/normalization/document_normalizer.py"
click node_attributes "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/normalization/attributes.py"
click node_imagefiles "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/images/image_store.py"
click node_embedder "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/embedding/embedder.py"
click node_store "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/metadata/metadata_store.py"
click node_ui "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/app/ui_streamlit.py"
click node_api "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/api/v1/routes.py"
click node_auth "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/api/v1/auth.py"
click node_deps "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/api/deps.py"
click node_retriever "https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/retrieval/retriever.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_pipeline,node_registry,node_cars,node_generic,node_motorcycles,node_scooters,node_parts,node_base,node_normalizer,node_attributes,node_user toneBlue
class node_imagefiles,node_store,node_postgres toneAmber
class node_ui,node_api,node_auth,node_deps,node_retriever toneMint
class node_embedder,node_ollama toneRose
class node_operator,node_web toneIndigo
```

## Components

### Ingestion

- [Ingestion Pipeline](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/pipeline.py): `src/ingestion/pipeline.py`
- [Loader Registry](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/loader.py): `src/ingestion/loader/loader.py`
- [Cars Loader](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/cars_loader.py): `src/ingestion/loader/cars_loader.py`
- [Generic Vehicle Loader](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/generic_loader.py): `src/ingestion/loader/generic_loader.py`
- [Motorcycles Loader](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/motorcycles_loader.py): `src/ingestion/loader/motorcycles_loader.py`
- [Scooters Loader](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/scooters_loader.py): `src/ingestion/loader/scooters_loader.py`
- [Spare Parts Loader](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/spare_parts_loader.py): `src/ingestion/loader/spare_parts_loader.py`
- [Browser & Image Fetch](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/loader/base_loader.py): `src/ingestion/loader/base_loader.py`
- [Document Normalizer](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/normalization/document_normalizer.py): `src/ingestion/normalization/document_normalizer.py`
- [Attribute Normalization](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/normalization/attributes.py): `src/ingestion/normalization/attributes.py`

### Knowledge Store

- [Persistent Image Files](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/images/image_store.py): `src/ingestion/images/image_store.py`
- [Metadata Store](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/metadata/metadata_store.py): `src/ingestion/metadata/metadata_store.py`
- **PostgreSQL + pgvector**

### Query & Serving

- [Streamlit UI](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/app/ui_streamlit.py): `src/app/ui_streamlit.py`
- [REST API](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/api/v1/routes.py): `src/api/v1/routes.py`
- [JWT Authentication](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/api/v1/auth.py): `src/api/v1/auth.py`
- [API Dependencies](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/api/deps.py): `src/api/deps.py`
- [Category-Scoped Retrieval](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/retrieval/retriever.py): `src/retrieval/retriever.py`

### Model Service

- [Embedding & Vision Client](https://github.com/santhi-tech/tata-automotive-rag/blob/main/src/ingestion/embedding/embedder.py): `src/ingestion/embedding/embedder.py`
- **Ollama**

### Other components

- **Catalogue Operator**
- **Product Websites**
- **User**

## Connections

- Catalogue Operator → Ingestion Pipeline: starts ingestion (evidence: `src/ingestion/pipeline.py`)
- Ingestion Pipeline → Loader Registry: selects loaders (evidence: `src/ingestion/pipeline.py`)
- Loader Registry → Cars Loader: dispatches category (evidence: `src/ingestion/loader/loader.py`)
- Loader Registry → Motorcycles Loader: dispatches category (evidence: `src/ingestion/loader/loader.py`)
- Loader Registry → Scooters Loader: dispatches category (evidence: `src/ingestion/loader/loader.py`)
- Loader Registry → Spare Parts Loader: dispatches category (evidence: `src/ingestion/loader/loader.py`)
- Cars Loader → Browser & Image Fetch: uses browser helpers (evidence: `src/ingestion/loader/cars_loader.py`)
- Generic Vehicle Loader → Browser & Image Fetch: extends loader (evidence: `src/ingestion/loader/generic_loader.py`)
- Motorcycles Loader → Generic Vehicle Loader: uses generic loader (evidence: `src/ingestion/loader/motorcycles_loader.py`)
- Scooters Loader → Generic Vehicle Loader: uses generic loader (evidence: `src/ingestion/loader/scooters_loader.py`)
- Spare Parts Loader → Browser & Image Fetch: uses browser helpers (evidence: `src/ingestion/loader/spare_parts_loader.py`)
- Product Websites → Cars Loader: provides pages (evidence: `README.md`)
- Product Websites → Generic Vehicle Loader: provides pages (evidence: `README.md`)
- Product Websites → Spare Parts Loader: provides pages (evidence: `README.md`)
- Ingestion Pipeline → Document Normalizer: normalizes documents (evidence: `src/ingestion/pipeline.py`)
- Document Normalizer → Attribute Normalization: canonicalizes attributes (evidence: `src/ingestion/normalization/document_normalizer.py`)
- Document Normalizer → Persistent Image Files: resolves image paths (evidence: `src/ingestion/normalization/document_normalizer.py`)
- Ingestion Pipeline → Embedding & Vision Client: embeds missing content (evidence: `src/ingestion/pipeline.py`)
- Ingestion Pipeline → Metadata Store: upserts documents (evidence: `src/ingestion/pipeline.py`)
- Metadata Store → PostgreSQL + pgvector: writes chunks & images (evidence: `README.md`)
- Ingestion Pipeline → PostgreSQL + pgvector: persists ingestion state
- Embedding & Vision Client → Ollama: requests embeddings & captions (evidence: `src/ingestion/embedding/embedder.py`)
- User → Streamlit UI: asks questions (evidence: `README.md`)
- User → REST API: calls endpoints (evidence: `README.md`)
- REST API → JWT Authentication: authenticates requests (evidence: `README.md`)
- REST API → API Dependencies: uses dependencies (evidence: `src/api/v1/routes.py`)
- Streamlit UI → Category-Scoped Retrieval: submits queries (evidence: `src/app/ui_streamlit.py`)
- REST API → Category-Scoped Retrieval: serves search
- Category-Scoped Retrieval → Embedding & Vision Client: embeds query (evidence: `README.md`)
- Category-Scoped Retrieval → PostgreSQL + pgvector: searches scoped vectors & keywords (evidence: `README.md`)
- Category-Scoped Retrieval → Ollama: generates grounded answers (evidence: `README.md`)
- Category-Scoped Retrieval → Streamlit UI: returns answers & images (evidence: `README.md`)
