How siddhi0808/groundtruth_ai works
GroundTruth AI is a document-grounded hallucination detector. A user submits a question and an LLM answer through the browser; the API retrieves evidence, asks a judge for a verdict, returns the result, and records detection history. Documents enter through upload or batch ingestion, then are extracted, chunked, embedded, and indexed. The product also exposes health, statistics, history, and dashboard views. The README documents both vector search and degraded SQLite keyword search; unsampled API details are represented only where documented.
Main entry points: main.py API handlers · ingest.py Batch ingestion · script.js UI client · database.py Chunk and history store
Components 16
User experience
- Detector UI
frontend/index.html - Dashboard view
frontend/dashboard.html - History view
frontend/history.html - UI client
frontend/script.js
Detection API
- API handlers
backend/main.py - Runtime config
backend/config.py
Knowledge indexing and retrieval
- Batch ingestion
backend/rag/ingest.py - Document extraction
backend/rag/document_loader.py - Token chunking
backend/rag/chunker.py - Embedding model
backend/rag/embeddings.py - Evidence retrieval
backend/rag/retriever.py
Verdict and persistence
- Verdict judge
backend/llm/judge.py - Chunk and history store
backend/database.py
Other components
- User
- Browser
- Ollama
Connections 27
- User → Browser: uses
README.md - Browser → Detector UI: opens
README.md - Detector UI → UI client: runs
frontend/script.js - UI client → API handlers: submits detection
frontend/script.js - API handlers → UI client: returns verdict
README.md - API handlers → Evidence retrieval: retrieves evidence
backend/main.py - API handlers → Verdict judge: judges answer
backend/main.py - API handlers → Chunk and history store: records detections
backend/main.py - API handlers → Document extraction: extracts uploads
README.md - API handlers → Batch ingestion: indexes uploads
backend/main.py - Batch ingestion → Document extraction: loads documents
backend/rag/ingest.py - Batch ingestion → Token chunking: chunks text
backend/rag/ingest.py - Batch ingestion → Embedding model: embeds chunks
backend/rag/ingest.py - Batch ingestion → Chunk and history store: inserts chunks
backend/rag/ingest.py - Token chunking → Embedding model: measures tokens
backend/rag/chunker.py - Evidence retrieval → Embedding model: embeds query
backend/rag/retriever.py - Evidence retrieval → Chunk and history store: searches chunks
backend/rag/retriever.py - Chunk and history store → Runtime config: reads settings
backend/database.py - API handlers → Runtime config: reads settings
backend/main.py - Verdict judge → Runtime config: reads settings
backend/llm/judge.py - Verdict judge → Ollama: requests judgment
backend/llm/judge.py - API handlers → Dashboard view: serves page
backend/main.py - API handlers → History view: serves page
backend/main.py - Browser → Dashboard view: opens
README.md - Browser → History view: opens
README.md - UI client → API handlers: requests upload
frontend/script.js - UI client → API handlers: requests history and stats
README.md