GenAI Docs Helper
Question answering over technical documentation that checks its own answers.
A LangGraph RAG workflow that grades retrieved documents, rephrases the question when nothing relevant comes back, and checks each answer for hallucination before returning it — with caching and parallel retrieval to keep it fast.
- retrieval strategies: fast, standard, comprehensive
- 3
- self-checks: document grading and hallucination detection
- 2
- cache layers: Redis and in-memory
- 2
Why it exists
Technical documentation — for forecasting systems, model performance, time-series methods — is exactly where a plain retrieve-then-generate pipeline fails quietly. It retrieves something loosely related, and the model writes a confident answer anyway.
This project explores the corrective-RAG pattern: let the workflow notice when retrieval was poor or the answer drifted from the sources, and do something about it before the user sees the result.
How it works
- 01 Input Question
- 02 Code Retrieve documents fast / standard / comprehensive
- 03 Check Grade relevance batch grading
- 04 Model / AI Rephrase & retry only if nothing relevant
- 05 Model / AI Generate answer
- 06 Check Hallucination check retry if it fails
- Retrieval has three paths — fast, standard and comprehensive — so simple questions do not pay the cost of an exhaustive search.
- Documents are graded before use. A grader assesses relevance in batches; if nothing relevant is found, the question is paraphrased and retrieval runs again.
- Answers are checked against their sources. A hallucination grader verifies the generated answer is supported by the retrieved documents; if it is not, the workflow loops back rather than returning it.
- Speed where it matters: a dual-layer cache (Redis and in-memory), parallel retrieval, batch grading and early stopping.
Results and honest limits
- Delivery: a modular LangGraph workflow with separate, documented nodes for retrieval, grading, generation and paraphrasing, runnable in LangGraph Studio for step-by-step inspection.
- Model flexibility: works with hosted OpenAI models or local models through Ollama.
- Operations: structured logging and performance metrics for each step.
Engineering decisions
- Loops instead of one-shot generation: poor retrieval and unsupported answers are handled as explicit graph transitions, not as prompt instructions.
- Separate, single-purpose chains for generation, retrieval grading and hallucination grading, so each can be tested and swapped independently.
- Cost-aware paths: multiple retrieval depths, caching and early stopping keep simple questions cheap.
Who it’s for
For teams building internal knowledge assistants, it is a compact, readable example of corrective RAG. For engineers learning LangGraph, it shows how self-checks become nodes and edges rather than hopes.