How dheeraj00001/se-mini-project works
Dehallucination is a verification gateway with two user-facing flows: an OpenAI-compatible completion proxy that buffers generated text before verification and mitigation, and a /verify sidecar for submitted text. Both feed claim segmentation, tiered grounding, NLI scoring, and safety handling; document ingestion builds the local grounding index. The React frontend provides a live playground and architecture/benchmark views. Some backend links are supported by the README or SOURCE INDEX rather than complete excerpts; unsampled internals are not expanded.
Main entry points: router.py API routes · orchestrator.py Waterfall verifier · ingest.py Document ingestion · adapters.py Tiered retrieval
Components 25
Client Interface
- React interface
frontend/src/App.tsx - Verification playground
frontend/src/components/Playground.tsx - Frontend API client
frontend/src/services/api.ts
Gateway
- FastAPI app
src/gateway/app.py - API routes
src/gateway/router.py - Header overrides
src/gateway/middleware.py - Response buffer
src/gateway/buffer.py - SSE replay
src/gateway/sse.py
Verification
- Claim segmentation
src/verifier/segmenter.py - Waterfall verifier
src/verifier/orchestrator.py - NLI scoring
src/verifier/nli.py - Verification contracts
src/schemas/verification.py
Grounding
- Tiered retrieval
src/retrieval/adapters.py - Dual-index store
src/retrieval/store.py - Rank fusion
src/retrieval/fusion.py - Knowledge ingest route
src/gateway/router.py - Document ingestion
src/retrieval/ingest.py - Document parser
src/retrieval/parser.py - Text chunker
src/retrieval/chunker.py
Mitigation
- Mitigation pipeline
src/mitigation/pipeline.py - Targeted rewriter
src/mitigation/rewriter.py - Local generator
src/mitigation/generator.py - Safety fallback
src/mitigation/fallback.py
Other components
- Client
- Model provider
Connections 26
- Client → React interface: uses
README.md - React interface → Verification playground: renders
frontend/src/App.tsx - Verification playground → Frontend API client: calls
frontend/src/components/Playground.tsx - Frontend API client → API routes: HTTP requests
- Client → FastAPI app: requests
README.md - FastAPI app → API routes: registers routes
src/gateway/app.py - API routes → Header overrides: parses overrides
src/gateway/router.py - API routes → Response buffer: buffers output
src/gateway/router.py - API routes → SSE replay: builds stream
src/gateway/router.py - API routes → Model provider: proxies generation
README.md - API routes → Waterfall verifier: verifies claims
src/gateway/router.py - API routes → Document ingestion: ingests documents
src/gateway/router.py - Document ingestion → Document parser: extracts text
src/retrieval/ingest.py - Document ingestion → Text chunker: chunks text
src/retrieval/ingest.py - Document ingestion → Dual-index store: persists chunks
src/retrieval/ingest.py - Waterfall verifier → Claim segmentation: segments claims
src/verifier/orchestrator.py - Waterfall verifier → Tiered retrieval: retrieves evidence
src/verifier/orchestrator.py - Waterfall verifier → NLI scoring: scores evidence
src/verifier/orchestrator.py - Tiered retrieval → Dual-index store: searches indexes
src/retrieval/adapters.py - Tiered retrieval → Rank fusion: fuses rankings
src/retrieval/adapters.py - Waterfall verifier → Mitigation pipeline: mitigates results
src/verifier/orchestrator.py - Mitigation pipeline → Targeted rewriter: rewrites claims
src/mitigation/pipeline.py - Targeted rewriter → Local generator: generates correction
src/mitigation/rewriter.py - Mitigation pipeline → Safety fallback: falls back
src/mitigation/pipeline.py - Client → Knowledge ingest route: submits references
README.md - Waterfall verifier → Verification contracts: returns reports
src/verifier/orchestrator.py