Retrieval-augmented generation (RAG) lets an AI assistant answer from your own documents instead of guessing. Here is how it works, what goes wrong, and how to build one that people trust.