Module 8 Wrap-up: Real-World RAG
·AWS Bedrock

Module 8 Wrap-up: Real-World RAG

Hands-on: Build a Python script that answers questions about your S3 documents and prints the citations.

Module 8 Wrap-up: The RAG Specialist

You have crossed the line from "Chatting with the Public Internet" to "Chatting with your Company." You understand how to use the retrieve_and_generate API to create grounded, fact-based answers and how to prove those answers using Citations.


Hands-on Exercise: The Evidence Collector

1. The Goal

Create a Python terminal app that:

  1. Asks the user for a question about your Knowledge Base.
  2. Calls the retrieve_and_generate API.
  3. Prints the answer.
  4. Prints a list of the PDF file names that were used to generate that answer.

2. The Implementation Plan

  • Use the bedrock-agent-runtime client.
  • Iterate through the citations list.
  • Extract the s3Location URI from each reference.

Module 8 Summary

  • retrieve_and_generate: The quickest way to build a production RAG bot.
  • Context Grounding: Forcing the AI to be honest by only using provided data.
  • Citations: The bridge between AI logic and human trust.
  • Metadata Filtering: Adding security layers to your search.

Coming Up Next...

In Module 9, we look at Validation and Safety. We will learn how to make our RAG system even more robust by rejecting unsupported answers and using Bedrock Guardrails to filter sensitive content.


Module 8 Checklist

  • I have used the bedrock-agent-runtime client.
  • I can describe the difference between retrieve and retrieve_and_generate.
  • I have successfully extracted a citation from an API response.
  • I understand how to use metadata filters.
  • I have identified my Knowledge Base ID in the AWS Console.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn