# pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance- architecture

> Architecture diagram of the GitHub repository pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-
- Repository: https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-

## Overview

This is a full-stack AI-response validation product. A user submits an AI answer and optional reference through the React interface; the FastAPI validation route runs claim-level evidence and hallucination checks plus multi-dimensional judges, then returns a report that can be viewed, stored, and exported. Separate branches support CSV batch evaluation, history, and analytics. The README documents the API and major capabilities; some backend service relationships are supported by the source index, but unsampled implementations and frontend request wiring are not asserted beyond documented architecture.

Main entry points: [`backend/services/validation_engine.py`](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/validation_engine.py) (Validation orchestrator), [`src/App.jsx`](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/App.jsx) (React application), [`backend/main.py`](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/main.py) (FastAPI application), [`backend/routers/validate.py`](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/routers/validate.py) (Validation routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_app["React application<br/>[App.jsx]"]
  node_validate_ui["Single validation<br/>[Validate.jsx]"]
  node_batch_ui["Batch evaluation UI"]
  node_results_ui["Evaluation results"]
  node_history_ui["Evaluation history<br/>[History.jsx]"]
  node_analytics_ui["Analytics dashboard<br/>[Analytics.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API and workflows"]
  node_backend["FastAPI application<br/>[main.py]"]
  node_validate_route["Validation routes<br/>[validate.py]"]
  node_batch_route["Batch routes<br/>[batch.py]"]
  node_history_route["History routes<br/>[history.py]"]
  node_analytics_route["Analytics routes<br/>[analytics.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
  node_batch_eval["CSV batch evaluator<br/>[batch_evaluator.py]"]
end

subgraph group_evaluation["Validation services"]
  node_engine["Validation orchestrator"]
  node_claims["Claim extraction<br/>[claim_extractor.py]"]
  node_rag["RAG evidence retrieval<br/>[rag_pipeline.py]"]
  node_similarity["TF-IDF evidence matching<br/>[nlp_validator.py]"]
  node_judges["Evaluation judges<br/>[accuracy_judge.py]"]
  node_hallucination["Hallucination detection"]
  node_verdict["Verdict aggregation<br/>[verdict_judge.py]"]
end

subgraph group_persistence["Reports and storage"]
  node_storage[("Evaluation database<br/>[db.py]")]
  node_pdf["PDF report export<br/>[pdf_generator.py]"]
  node_batch_pdf["Batch PDF export"]
end

node_user(("Browser user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_validate_ui
node_app -->|"routes to"| node_batch_ui
node_app -->|"routes to"| node_results_ui
node_app -->|"routes to"| node_history_ui
node_app -->|"routes to"| node_analytics_ui
node_validate_ui -.->|"submits via"| node_api_client
node_batch_ui -->|"submits via"| node_api_client
node_api_client -->|"sends HTTP"| node_backend
node_backend -->|"registers"| node_validate_route
node_backend -->|"registers"| node_batch_route
node_backend -->|"registers"| node_history_route
node_backend -->|"registers"| node_analytics_route
node_validate_route -->|"runs validation"| node_engine
node_validate_route -->|"persists result"| node_storage
node_validate_route -->|"generates report"| node_pdf
node_validate_route -->|"validates payload"| node_schemas
node_engine -->|"extracts claims"| node_claims
node_engine -->|"retrieves evidence"| node_rag
node_rag -->|"matches evidence"| node_similarity
node_engine -->|"evaluates dimensions"| node_judges
node_engine -->|"checks contradictions"| node_hallucination
node_engine -->|"aggregates verdict"| node_verdict
node_batch_route -->|"evaluates CSV"| node_batch_eval
node_batch_route -->|"exports batch"| node_batch_pdf
node_batch_eval -->|"validates rows"| node_engine
node_history_route -->|"reads history"| node_storage
node_analytics_route -.->|"aggregates metrics"| node_storage
node_engine -.->|"stores result"| node_storage

click node_app "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/App.jsx"
click node_validate_ui "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/pages/Validate.jsx"
click node_batch_ui "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/pages/BatchEvaluation.jsx"
click node_results_ui "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/pages/EvaluationDashboard.jsx"
click node_history_ui "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/pages/History.jsx"
click node_analytics_ui "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/pages/Analytics.jsx"
click node_api_client "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/services/api.js"
click node_backend "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/main.py"
click node_validate_route "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/routers/validate.py"
click node_batch_route "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/routers/batch.py"
click node_history_route "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/routers/history.py"
click node_analytics_route "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/routers/analytics.py"
click node_schemas "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/models/schemas.py"
click node_engine "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/validation_engine.py"
click node_claims "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/claim_extractor.py"
click node_rag "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/rag_pipeline.py"
click node_similarity "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/nlp_validator.py"
click node_judges "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/accuracy_judge.py"
click node_hallucination "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/hallucination_detector.py"
click node_verdict "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/verdict_judge.py"
click node_batch_eval "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/batch_evaluator.py"
click node_storage "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/database/db.py"
click node_pdf "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/pdf_generator.py"
click node_batch_pdf "https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/batch_pdf_generator.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_app,node_validate_ui,node_batch_ui,node_results_ui,node_history_ui,node_analytics_ui,node_api_client,node_user toneBlue
class node_backend,node_validate_route,node_batch_route,node_history_route,node_analytics_route,node_schemas,node_batch_eval toneAmber
class node_engine,node_claims,node_rag,node_similarity,node_judges,node_hallucination,node_verdict toneMint
class node_storage,node_pdf,node_batch_pdf toneRose
```

## Components

### User experience

- [React application](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/App.jsx): `src/App.jsx`
- [Single validation](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/pages/Validate.jsx): `src/pages/Validate.jsx`
- [Batch evaluation UI](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/pages/BatchEvaluation.jsx): `src/pages/BatchEvaluation.jsx`
- [Evaluation results](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/pages/EvaluationDashboard.jsx): `src/pages/EvaluationDashboard.jsx`
- [Evaluation history](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/pages/History.jsx): `src/pages/History.jsx`
- [Analytics dashboard](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/pages/Analytics.jsx): `src/pages/Analytics.jsx`
- [API client](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/src/services/api.js): `src/services/api.js`

### API and workflows

- [FastAPI application](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/main.py): `backend/main.py`
- [Validation routes](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/routers/validate.py): `backend/routers/validate.py`
- [Batch routes](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/routers/batch.py): `backend/routers/batch.py`
- [History routes](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/routers/history.py): `backend/routers/history.py`
- [Analytics routes](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/routers/analytics.py): `backend/routers/analytics.py`
- [API schemas](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/models/schemas.py): `backend/models/schemas.py`
- [CSV batch evaluator](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/batch_evaluator.py): `backend/services/batch_evaluator.py`

### Validation services

- [Validation orchestrator](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/validation_engine.py): `backend/services/validation_engine.py`
- [Claim extraction](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/claim_extractor.py): `backend/services/claim_extractor.py`
- [RAG evidence retrieval](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/rag_pipeline.py): `backend/services/rag_pipeline.py`
- [TF-IDF evidence matching](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/nlp_validator.py): `backend/services/nlp_validator.py`
- [Evaluation judges](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/accuracy_judge.py): `backend/services/accuracy_judge.py`
- [Hallucination detection](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/hallucination_detector.py): `backend/services/hallucination_detector.py`
- [Verdict aggregation](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/verdict_judge.py): `backend/services/verdict_judge.py`

### Reports and storage

- [Evaluation database](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/database/db.py): `backend/database/db.py`
- [PDF report export](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/pdf_generator.py): `backend/services/pdf_generator.py`
- [Batch PDF export](https://github.com/pranithapindi/development-of-ai-response-validation-system-with-hallucination-detection-assistance-/blob/main/backend/services/batch_pdf_generator.py): `backend/services/batch_pdf_generator.py`

### Other components

- **Browser user**

## Connections

- Browser user → React application: uses (evidence: `README.md`)
- React application → Single validation: routes to (evidence: `src/App.jsx`)
- React application → Batch evaluation UI: routes to (evidence: `src/App.jsx`)
- React application → Evaluation results: routes to (evidence: `src/App.jsx`)
- React application → Evaluation history: routes to (evidence: `src/App.jsx`)
- React application → Analytics dashboard: routes to (evidence: `src/App.jsx`)
- Single validation → API client: submits via
- Batch evaluation UI → API client: submits via (evidence: `src/pages/BatchEvaluation.jsx`)
- API client → FastAPI application: sends HTTP (evidence: `README.md`)
- FastAPI application → Validation routes: registers (evidence: `backend/main.py`)
- FastAPI application → Batch routes: registers (evidence: `backend/main.py`)
- FastAPI application → History routes: registers (evidence: `backend/main.py`)
- FastAPI application → Analytics routes: registers (evidence: `backend/main.py`)
- Validation routes → Validation orchestrator: runs validation (evidence: `backend/routers/validate.py`)
- Validation routes → Evaluation database: persists result (evidence: `backend/routers/validate.py`)
- Validation routes → PDF report export: generates report (evidence: `backend/routers/validate.py`)
- Validation routes → API schemas: validates payload (evidence: `backend/routers/validate.py`)
- Validation orchestrator → Claim extraction: extracts claims (evidence: `backend/services/validation_engine.py`)
- Validation orchestrator → RAG evidence retrieval: retrieves evidence (evidence: `backend/services/validation_engine.py`)
- RAG evidence retrieval → TF-IDF evidence matching: matches evidence (evidence: `backend/services/rag_pipeline.py`)
- Validation orchestrator → Evaluation judges: evaluates dimensions (evidence: `backend/services/validation_engine.py`)
- Validation orchestrator → Hallucination detection: checks contradictions (evidence: `backend/services/validation_engine.py`)
- Validation orchestrator → Verdict aggregation: aggregates verdict (evidence: `backend/services/validation_engine.py`)
- Batch routes → CSV batch evaluator: evaluates CSV (evidence: `backend/routers/batch.py`)
- Batch routes → Batch PDF export: exports batch (evidence: `backend/routers/batch.py`)
- CSV batch evaluator → Validation orchestrator: validates rows (evidence: `backend/services/batch_evaluator.py`)
- History routes → Evaluation database: reads history (evidence: `backend/routers/history.py`)
- Analytics routes → Evaluation database: aggregates metrics
- Validation orchestrator → Evaluation database: stores result
