Skip to content
Mermaid templates

Production RAG (advanced)

Hybrid retrieval, reranker, response caching, eval feedback and guardrails.

Template previewMermaid
Rendering…

What this template contains

Diagram type
Flowchart
Source
17 lines

Make it your own.

flowchart LR
Q[User query] --> G1[Guardrail:\nharm / PII / topic]
G1 --> RW[Query rewrite]
RW --> Hybrid[Hybrid retrieval]
KW[(BM25 / lexical)] --> Hybrid
Vec[(Vector store)] --> Hybrid
Hybrid --> RR[Reranker]
RR --> Ctx[Top-K context]
Cache[(Response cache)] -.->|hit| Reply
RW -.->|cache key| Cache
Ctx --> P[Prompt template]
Q --> P
P --> LLM[LLM]
LLM --> G2[Guardrail:\nfaithfulness + citations]
G2 --> Reply[Answer + citations]
Reply --> Tel[Telemetry]
Tel --> Eval[Eval harness]