# yeswanthupputuri/rag-chunking-strategy-evaluation architecture

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

- Interactive diagram: https://gitdiagram.com/yeswanthupputuri/rag-chunking-strategy-evaluation
- Repository: https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation

## Overview

This repository is an experimental RAG evaluation system: users provide a document and Q&A set, build three chunking-strategy indexes, then compare generated answers against references. The main runtime is the Streamlit app; Python entry points also support single-question and dataset evaluation. The graph preserves retrieval, generation, answer and retrieval metrics, and aggregation. The README documents separate Chroma collections, but the corresponding vector-store implementation is absent from the supplied tree; its node is therefore unpathed. Some app wiring is shown only in partial excerpts, so documented relationships use README evidence.

Main entry points: [`app.py`](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/app.py) (Streamlit interface), [`src/rag/rag_pipeline.py`](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/rag/rag_pipeline.py) (RAG pipeline), [`src/evaluate_single_question.py`](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluate_single_question.py) (Single-question runner), [`src/evaluate_dataset.py`](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluate_dataset.py) (Dataset runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Document preparation"]
  node_doc_loader["Document loader<br/>[document_loader.py]"]
  node_fixed["Fixed chunking<br/>[fixed_chunking.py]"]
  node_recursive["Recursive chunking"]
  node_semantic["Semantic chunking"]
end

subgraph group_rag["RAG answering"]
  node_embeddings["Embedding model<br/>[embedding_model.py]"]
  node_collections[("Chroma collections")]
  node_retriever["Retriever<br/>[retriever.py]"]
  node_reranker["Document reranker<br/>[reranker.py]"]
  node_pipeline["RAG pipeline<br/>[rag_pipeline.py]"]
  node_llm["Local language model<br/>[huggingface_llm.py]"]
end

subgraph group_eval["Evaluation"]
  node_qa_loader["Q&amp;A loader<br/>[qa_loader.py]"]
  node_answer_metrics["Answer metrics<br/>[answer_metrics.py]"]
  node_retrieval_metrics["Retrieval metrics"]
  node_evaluator["Evaluation coordinator<br/>[evaluator.py]"]
  node_aggregation["Result aggregation"]
end

subgraph group_interfaces["User workflows"]
  node_app["Streamlit interface<br/>[app.py]"]
  node_single_eval["Single-question runner"]
  node_dataset_eval["Dataset runner"]
end

node_user(("User"))
node_document["Document input"]
node_qa_data["Q&amp;A dataset"]

node_user -->|"uses"| node_app
node_document -->|"uploads"| node_app
node_qa_data -->|"uploads"| node_app
node_app -->|"loads document"| node_doc_loader
node_app -->|"loads Q&amp;A"| node_qa_loader
node_app -->|"creates chunks"| node_fixed
node_app -->|"creates chunks"| node_recursive
node_app -->|"creates chunks"| node_semantic
node_app -->|"indexes chunks"| node_collections
node_semantic -->|"uses embeddings"| node_embeddings
node_app -->|"creates model"| node_embeddings
node_collections -->|"searches collection"| node_retriever
node_retriever -->|"reranks candidates"| node_reranker
node_pipeline -->|"retrieves results"| node_retriever
node_pipeline -->|"generates answer"| node_llm
node_app -->|"requests answers"| node_pipeline
node_dataset_eval -->|"loads dataset"| node_qa_loader
node_dataset_eval -->|"requests answers"| node_pipeline
node_single_eval -->|"loads dataset"| node_qa_loader
node_single_eval -->|"requests answers"| node_pipeline
node_app -->|"scores answers"| node_answer_metrics
node_single_eval -->|"scores answers"| node_answer_metrics
node_dataset_eval -->|"evaluates results"| node_evaluator
node_evaluator -->|"scores answers"| node_answer_metrics
node_evaluator -->|"scores retrieval"| node_retrieval_metrics
node_app -->|"summarizes strategies"| node_aggregation

click node_app "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/app.py"
click node_doc_loader "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/loaders/document_loader.py"
click node_qa_loader "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/loaders/qa_loader.py"
click node_fixed "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/chunking/fixed_chunking.py"
click node_recursive "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/chunking/recursive_chunking.py"
click node_semantic "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/chunking/semantic_chunking.py"
click node_embeddings "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/embeddings/embedding_model.py"
click node_retriever "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/retrieval/retriever.py"
click node_reranker "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/reranking/reranker.py"
click node_pipeline "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/rag/rag_pipeline.py"
click node_llm "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/llm/huggingface_llm.py"
click node_single_eval "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluate_single_question.py"
click node_dataset_eval "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluate_dataset.py"
click node_answer_metrics "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluation/answer_metrics.py"
click node_retrieval_metrics "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluation/retrieval_metrics.py"
click node_evaluator "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluation/evaluator.py"
click node_aggregation "https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluation/aggregate_results.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_doc_loader,node_fixed,node_recursive,node_semantic,node_user toneBlue
class node_embeddings,node_collections,node_retriever,node_reranker,node_pipeline,node_llm toneAmber
class node_qa_loader,node_answer_metrics,node_retrieval_metrics,node_evaluator,node_aggregation toneMint
class node_app,node_single_eval,node_dataset_eval toneRose
class node_document,node_qa_data toneIndigo
```

## Components

### Document preparation

- [Document loader](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/loaders/document_loader.py): `src/loaders/document_loader.py`
- [Fixed chunking](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/chunking/fixed_chunking.py): `src/chunking/fixed_chunking.py`
- [Recursive chunking](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/chunking/recursive_chunking.py): `src/chunking/recursive_chunking.py`
- [Semantic chunking](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/chunking/semantic_chunking.py): `src/chunking/semantic_chunking.py`

### RAG answering

- [Embedding model](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/embeddings/embedding_model.py): `src/embeddings/embedding_model.py`
- **Chroma collections**
- [Retriever](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/retrieval/retriever.py): `src/retrieval/retriever.py`
- [Document reranker](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/reranking/reranker.py): `src/reranking/reranker.py`
- [RAG pipeline](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/rag/rag_pipeline.py): `src/rag/rag_pipeline.py`
- [Local language model](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/llm/huggingface_llm.py): `src/llm/huggingface_llm.py`

### Evaluation

- [Q&A loader](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/loaders/qa_loader.py): `src/loaders/qa_loader.py`
- [Answer metrics](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluation/answer_metrics.py): `src/evaluation/answer_metrics.py`
- [Retrieval metrics](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluation/retrieval_metrics.py): `src/evaluation/retrieval_metrics.py`
- [Evaluation coordinator](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluation/evaluator.py): `src/evaluation/evaluator.py`
- [Result aggregation](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluation/aggregate_results.py): `src/evaluation/aggregate_results.py`

### User workflows

- [Streamlit interface](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/app.py): `app.py`
- [Single-question runner](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluate_single_question.py): `src/evaluate_single_question.py`
- [Dataset runner](https://github.com/yeswanthupputuri/rag-chunking-strategy-evaluation/blob/main/src/evaluate_dataset.py): `src/evaluate_dataset.py`

### Other components

- **User**
- **Document input**
- **Q&A dataset**

## Connections

- User → Streamlit interface: uses (evidence: `README.md`)
- Document input → Streamlit interface: uploads (evidence: `README.md`)
- Q&A dataset → Streamlit interface: uploads (evidence: `README.md`)
- Streamlit interface → Document loader: loads document (evidence: `app.py`)
- Streamlit interface → Q&A loader: loads Q&A (evidence: `app.py`)
- Streamlit interface → Fixed chunking: creates chunks (evidence: `app.py`)
- Streamlit interface → Recursive chunking: creates chunks (evidence: `app.py`)
- Streamlit interface → Semantic chunking: creates chunks (evidence: `app.py`)
- Streamlit interface → Chroma collections: indexes chunks (evidence: `README.md`)
- Semantic chunking → Embedding model: uses embeddings (evidence: `src/chunking/semantic_chunking.py`)
- Streamlit interface → Embedding model: creates model (evidence: `app.py`)
- Chroma collections → Retriever: searches collection (evidence: `README.md`)
- Retriever → Document reranker: reranks candidates (evidence: `src/retrieval/retriever.py`)
- RAG pipeline → Retriever: retrieves results (evidence: `src/rag/rag_pipeline.py`)
- RAG pipeline → Local language model: generates answer (evidence: `src/rag/rag_pipeline.py`)
- Streamlit interface → RAG pipeline: requests answers (evidence: `app.py`)
- Dataset runner → Q&A loader: loads dataset (evidence: `src/evaluate_dataset.py`)
- Dataset runner → RAG pipeline: requests answers (evidence: `src/evaluate_dataset.py`)
- Single-question runner → Q&A loader: loads dataset (evidence: `src/evaluate_single_question.py`)
- Single-question runner → RAG pipeline: requests answers (evidence: `src/evaluate_single_question.py`)
- Streamlit interface → Answer metrics: scores answers (evidence: `app.py`)
- Single-question runner → Answer metrics: scores answers (evidence: `src/evaluate_single_question.py`)
- Dataset runner → Evaluation coordinator: evaluates results (evidence: `src/evaluate_dataset.py`)
- Evaluation coordinator → Answer metrics: scores answers (evidence: `src/evaluation/evaluator.py`)
- Evaluation coordinator → Retrieval metrics: scores retrieval (evidence: `src/evaluation/evaluator.py`)
- Streamlit interface → Result aggregation: summarizes strategies (evidence: `app.py`)
