Amazon Bedrock RAG Workshop

Table of Contents

Introduction

The Amazon Bedrock Retrieval-Augmented Generation (RAG) Workshop is designed to provide hands-on experience with foundation models (FMs) and retrieval-augmented generation using Amazon Bedrock. This workshop is intended for developers and solution builders.

Workshop Overview

This workshop explores two primary types of knowledge for LLMs:

  • Parametric knowledge: Everything the LLM learned during training
  • Source (external) knowledge: Information fed into the LLM via the input prompt

We focus on retrieval-augmented generation (RAG) to ingest domain-specific information through source knowledge and augment the prompt passed to the LLM.

Key Abstractions

  • LLM: Anthropic Claude V2 (Amazon Bedrock)
  • Embeddings Model: Amazon Titan Embeddings (Amazon Bedrock)
  • Document Loader: PDF Loader and TextLoader (LangChain)
  • Vector Store: FAISS, LlamaIndex, ChromaDB (LangChain)
  • Chunking: Data splits
  • Index: VectorIndex
  • Wrapper: Abstracts logic from the user
  • Retrieval and Search: Retrieval QA, Semantic Similarity Search
  • Orchestrator: LangChain, LlamaIndex

RAG Workflow

graph TD
    A[Administrator] -->|Load| B[Document and Metadata Loader]
    A -->|Split| C[Splitter/Chunker]
    A -->|Store| D[Vector Store/Embedding Indexes]
    E[User] -->|Retrieve| D
    E -->|Re-Rank| F[Re-Ranker]
    E -->|Prompt| G[LLM]
    G -->|Response| E
    B -->|URLs| B1[https://...]
    B -->|PDFs| B2[*.pdf]
    B -->|Database| B3[Database/Datastore]
    C -->|Recursive| C1[Recursive Splitter]
    C -->|Context-aware| C2[Context-aware Splitter]
    C -->|Data Splits| C3[Data Splits]
    F -->|Maximum Marginal Relevance| F1[Maximum Marginal Relevance]
    F -->|Relevance Levels| F2["[0] High relevance"]
    F -->|Relevance Levels| F3["[1] Med relevance"]
    F -->|Relevance Levels| F4["[2] Low relevance"]

Lab 1: Introduction [5 mins]

Prerequisites

  • AWS account
  • Familiarity with Python
  • Basic understanding of machine learning concepts

Setup

aws sts get-caller-identity | jq -r .Arn
pip3 install --user --no-build-isolation --force-reinstall \
    "boto3>=1.28.57" \
    "awscli>=1.29.57" \
    "botocore>=1.31.57"
pip3 install langchain==0.0.305 --user --force-reinstall

Lab 2: Semantic Similarity Search [30 mins]

Semantic search uses vector embedding representations of documents to perform searches in higher-dimensional vector spaces.

Implementation

# Python code for semantic similarity search will go here
print("Implementing semantic similarity search...")

Lab 3: Semantic Similarity Search with Metadata Filtering [30 mins]

This lab demonstrates how to use metadata to filter queries and improve result relevancy.

Implementation

# Python code for semantic search with metadata filtering will go here
print("Implementing semantic search with metadata filtering...")

Lab 4: Semantic Similarity Search with Document Summaries [30 mins]

Learn how to use document summaries to improve retrieval results and reduce latency.

Implementation

# Python code for semantic search with document summaries will go here
print("Implementing semantic search with document summaries...")

Lab 5: Semantic Similarity Search with Re-Ranking [30 mins]

Explore how re-ranking can improve result relevancy and introduce diversity in results.

Implementation

# Python code for semantic search with re-ranking will go here
print("Implementing semantic search with re-ranking...")

Conclusion

Summarize the key takeaways from the workshop and suggest next steps for further learning.

References

Author: %(or (getenv "NPMAUTHORINFO") (getenv "USER") "Unknown Author")

jwalsh@nexus

Last Updated: 2025-07-30 13:45:27

build: 2025-12-23 09:12 | sha: e32f33e