Choorai
Lv.3 · Retrieval

RAG Basics

RAG retrieves external documents and gives them to the model as evidence instead of retraining the model. The key questions are whether the answer used retrieved evidence and whether it returned sources.

RAG is not magic

Bad chunking or weak retrieval produces weak answers. RAG quality often depends more on data prep and retrieval evals than the model.

Minimum Flow

rag-flow.txt
1. Collect documents
2. Split documents into chunks
3. Convert chunks into embeddings
4. Store them in a vector store
5. Retrieve chunks similar to the question
6. Send the question plus evidence to the LLM
7. Return the answer with citations

API Shape Example

api-contract.txt
POST /ai/ask
{
  "question": "What is the refund policy?",
  "filters": { "product": "starter" }
}

200 OK
{
  "answer": "Refunds are available within 7 days of payment.",
  "sources": [
    { "title": "refund-policy.md", "chunkId": "refund-003" }
  ]
}

Tuning Keywords

chunk size

Small chunks lose context. Large chunks make retrieval less precise.

metadata filter

Limit search by product, permission, date, or document type.

hybrid search

Combine keyword search and vector search.

reranking

Reorder first-pass results to improve evidence quality.

Next Actions

Last updated: June 22, 2026 · Version: v0.0.1

Send Feedback

Opens a new issue page with your message.

Open GitHub Issue