# kamalesh0081/agentic-rag-research-paper-analyzer architecture

> Architecture diagram of the GitHub repository kamalesh0081/agentic-rag-research-paper-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kamalesh0081/agentic-rag-research-paper-analyzer
- Repository: https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer

## Overview

This is a research-paper information extraction application: a user submits a PDF, and the system returns structured fields for datasets, evaluation metrics, and methods. The documented workflow is PDF text extraction, chunking, embedding/storage, independent multi-query retrieval and reranking, then local LLM extraction. The sampled pipeline and API show those core calls; README documents Gradio and Ollama capabilities, but the Gradio-to-backend wiring is not shown, so that connection is marked unverified.

Main entry points: [`app/services/pipeline.py`](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/services/pipeline.py) (Pipeline orchestrator), [`app/api/routes.py`](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/api/routes.py) (Analyze API), [`app/services/retrieval.py`](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/services/retrieval.py) (Multi-query retrieval), [`app/core/vectordb.py`](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/core/vectordb.py) (ChromaDB storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_gradio["Gradio interface<br/>[gradio_ui.py]"]
  node_api["Analyze API<br/>[routes.py]"]
end

subgraph group_ingest["Document ingestion"]
  node_pipeline["Pipeline orchestrator<br/>[pipeline.py]"]
  node_pdf["PDF text extraction<br/>[pdf_loader.py]"]
  node_chunking["Text chunking<br/>[chunking.py]"]
end

subgraph group_rag["Retrieval and ranking"]
  node_embedding["Embedding models<br/>[embeddings.py]"]
  node_vectordb[("ChromaDB storage<br/>[vectordb.py]")]
  node_retrieval["Multi-query retrieval<br/>[retrieval.py]"]
  node_reranker["Query-wise reranking<br/>[reranker.py]"]
end

subgraph group_extract["Structured extraction"]
  node_extractor["JSON extraction<br/>[extractor.py]"]
  node_schema["Extraction response schema<br/>[schema.py]"]
end

node_user(("Paper submitter"))
node_ollama["Ollama LLM"]
node_logging["Debug logging<br/>[logger.py]"]

node_user -->|"uploads PDF"| node_gradio
node_gradio -.->|"submits analysis"| node_api
node_api -->|"runs pipeline"| node_pipeline
node_api -->|"validates response"| node_schema
node_pipeline -->|"loads PDF"| node_pdf
node_pipeline -->|"creates chunks"| node_chunking
node_pipeline -->|"stores chunks"| node_vectordb
node_vectordb -->|"encodes chunks"| node_embedding
node_pipeline -->|"retrieves context"| node_retrieval
node_retrieval -->|"queries chunks"| node_vectordb
node_retrieval -->|"encodes queries"| node_embedding
node_pipeline -->|"reranks context"| node_reranker
node_reranker -->|"scores query chunks"| node_embedding
node_pipeline -->|"extracts fields"| node_extractor
node_extractor -->|"invokes model"| node_ollama
node_pipeline -->|"clears log"| node_logging
node_api -->|"returns result"| node_pipeline

click node_gradio "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/frontend/gradio_ui.py"
click node_api "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/api/routes.py"
click node_pipeline "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/services/pipeline.py"
click node_pdf "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/utils/pdf_loader.py"
click node_chunking "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/utils/chunking.py"
click node_embedding "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/core/embeddings.py"
click node_vectordb "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/core/vectordb.py"
click node_retrieval "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/services/retrieval.py"
click node_reranker "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/services/reranker.py"
click node_extractor "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/services/extractor.py"
click node_schema "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/models/schema.py"
click node_logging "https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/utils/logger.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_gradio,node_api toneBlue
class node_pipeline,node_pdf,node_chunking toneAmber
class node_embedding,node_vectordb,node_retrieval,node_reranker toneMint
class node_extractor,node_schema toneRose
class node_user,node_ollama toneIndigo
class node_logging toneTeal
```

## Components

### User interface

- [Gradio interface](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/frontend/gradio_ui.py): `frontend/gradio_ui.py`
- [Analyze API](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/api/routes.py): `app/api/routes.py`

### Document ingestion

- [Pipeline orchestrator](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/services/pipeline.py): `app/services/pipeline.py`
- [PDF text extraction](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/utils/pdf_loader.py): `app/utils/pdf_loader.py`
- [Text chunking](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/utils/chunking.py): `app/utils/chunking.py`

### Retrieval and ranking

- [Embedding models](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/core/embeddings.py): `app/core/embeddings.py`
- [ChromaDB storage](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/core/vectordb.py): `app/core/vectordb.py`
- [Multi-query retrieval](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/services/retrieval.py): `app/services/retrieval.py`
- [Query-wise reranking](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/services/reranker.py): `app/services/reranker.py`

### Structured extraction

- [JSON extraction](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/services/extractor.py): `app/services/extractor.py`
- [Extraction response schema](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/models/schema.py): `app/models/schema.py`

### Other components

- **Paper submitter**
- **Ollama LLM**
- [Debug logging](https://github.com/kamalesh0081/agentic-rag-research-paper-analyzer/blob/v2-agentic-extraction/app/utils/logger.py): `app/utils/logger.py`

## Connections

- Paper submitter → Gradio interface: uploads PDF (evidence: `README.md`)
- Gradio interface → Analyze API: submits analysis
- Analyze API → Pipeline orchestrator: runs pipeline (evidence: `app/api/routes.py`)
- Analyze API → Extraction response schema: validates response (evidence: `app/api/routes.py`)
- Pipeline orchestrator → PDF text extraction: loads PDF (evidence: `app/services/pipeline.py`)
- Pipeline orchestrator → Text chunking: creates chunks (evidence: `app/services/pipeline.py`)
- Pipeline orchestrator → ChromaDB storage: stores chunks (evidence: `app/services/pipeline.py`)
- ChromaDB storage → Embedding models: encodes chunks (evidence: `app/core/vectordb.py`)
- Pipeline orchestrator → Multi-query retrieval: retrieves context (evidence: `app/services/pipeline.py`)
- Multi-query retrieval → ChromaDB storage: queries chunks (evidence: `app/services/retrieval.py`)
- Multi-query retrieval → Embedding models: encodes queries (evidence: `app/services/retrieval.py`)
- Pipeline orchestrator → Query-wise reranking: reranks context (evidence: `app/services/pipeline.py`)
- Query-wise reranking → Embedding models: scores query chunks (evidence: `app/services/reranker.py`)
- Pipeline orchestrator → JSON extraction: extracts fields (evidence: `app/services/pipeline.py`)
- JSON extraction → Ollama LLM: invokes model (evidence: `app/services/extractor.py`)
- Pipeline orchestrator → Debug logging: clears log (evidence: `app/services/pipeline.py`)
- Analyze API → Pipeline orchestrator: returns result (evidence: `app/api/routes.py`)
