← AI Workflow Templates
RetrievalintermediateCI-safeupdated 2026-08-11
RAG Over Your Docs
A retrieval-augmented Q&A pipeline: chunk, embed, retrieve, and answer with citations over your own documents.
#rag#embeddings#retrieval#qa
Tools in the pipeline
- validatorchunkerSplit docs into ~500-token chunks with overlap.
- apiembedderStore vectors plus source metadata.
- retrieverretrieverTop-k by cosine similarity with a minimum threshold.
- llmanswer-modelAnswer only from retrieved context, with citations.
Stack: embeddings · vector DB · LLM
What it does
Answers questions grounded in a document set instead of the model's memory. Chunks source docs, embeds them, retrieves the top-k relevant chunks per query, and asks the model to answer only from retrieved context, with inline citations back to the source.
Pipeline
- Ingest — split docs into ~500-token chunks with ~50-token overlap.
- Embed — store vectors + source metadata in a vector DB.
- Retrieve — embed the query, pull top-k (start with k=5) by cosine similarity.
- Answer — prompt the model with the chunks and require citations.
- Fallback — if no chunk clears a similarity threshold, say 'not found in the docs' rather than guessing.
Prompt skeleton
Answer the question using ONLY the context below.
Cite each claim as [source: <file>#<chunk>].
If the context doesn't contain the answer, say so.
Context:
{retrieved_chunks}
Question: {user_question}Guardrails
Require citations and reject answers without them. Set a minimum similarity threshold so off-topic questions return 'not found' instead of a hallucination. Log the retrieved chunk IDs with every answer so you can audit wrong results.
Structural dry-run
No model call. Validates required fields only.Prefills the example payload for Policy question. Edit it, then run.