RAG with Knowledge Bases
Let a model answer questions from your own documents, with citations, without building the pipeline yourself.
Models only know what they were trained on. They don't know your company handbook or last quarter's numbers. Retrieval-Augmented Generation (RAG) fixes that: find the relevant parts of your documents, then hand them to the model along with the question.
RAG is an open-book exam. Instead of hoping the student memorized everything, you let them look up the right pages first, then answer, and cite the page.
Building RAG by hand means extracting text, chunking it, creating embeddings, storing them in a vector database, searching, and writing the augmented prompt. Bedrock Knowledge Bases does all of that for you.
Setup (one time)
- Data source: usually an S3 bucket of PDFs, Word docs, HTML, or text.
- Embedding model: turns text into vectors, e.g. Amazon Titan Text Embeddings.
- Vector store: where those vectors live. Amazon OpenSearch Serverless is a common choice, and others are supported.
Two phases
- Ingestion: run a sync job. Bedrock pulls documents from S3, splits them into chunks, embeds each chunk, and writes the vectors to your vector store.
- Retrieval: a user asks a question. Bedrock embeds it, finds the most similar chunks, passes them to a model, and returns an answer with citations pointing back to the source files.
- 1Documents in S3
PDFs, docs, text
- 2Chunk + embed
Titan Embeddings
- 3Vector store
e.g. OpenSearch Serverless
- 4Question → answer
With source citations
Try the idea
The demo below is a simulated RAG search box. It returns a canned answer so you can see the shape of a grounded, cited response without an AWS account.
Knowledge Base search Demo
Simulated: returns a sample answer, no AWS call is made
Key takeaways
- RAG retrieves relevant document chunks and gives them to the model as context.
- Knowledge Bases manages chunking, embeddings, vector storage, and retrieval for you.
- Answers come with citations back to your source documents.
Check your understanding
Pick an answer to see the explanation.
1. Your policy documents change every week. Which approach keeps answers current most easily?