How to give Claude access to your documents, data, and knowledge
Without RAG: question → Claude generates from its parameters → answer (Claude invents something plausible if it doesn't know) With RAG: question → find relevant documents → inject only those into context → Claude generates → answer (Claude responds based on real documents)
Cosine similarity measures the angle between two vectors. A question about "vacation days" and a document chunk about "leave policy" will have very similar vectors even if they use different words — because the embedding model learned their semantic relationship.
Chunking is splitting documents into fragments before embedding them. If you chunk badly, the retrieval fails no matter how good the rest is.
"Show contracts signed in 2023" → SQL. Exact search by value. "Show contracts with penalty clauses for delays" → RAG. Semantic search. SQL can't do this. "How many active users do we have in Spain?" → SQL. Exact number from database. "What are users saying about checkout usability?" → RAG over support tickets or reviews. Rule: if you can express the search as an exact condition → SQL. If you're searching by meaning or conceptual similarity → RAG. In real systems, you use both.
RAG has two independent components that can fail separately. Bad retrieval + good generation = wrong answer with confidence. Good retrieval + bad reasoning = wrong answer from good information. If the retrieval fails (because the question uses different terminology than the document, or because chunking broke the relevant context), the generation also fails. RAG solves access to information — not reasoning errors.
This is the foundation of Domain 1 (Agentic Architecture & Orchestration). When you build an agent that answers questions about your company, the internal mechanism is RAG. The next level at claudepractice covers building this end-to-end.