Amazon Bedrock RAG Workshop
Table of Contents
- 1. Introduction
- 2. Lab 1: Introduction [5 mins]
- 3. Lab 2: Semantic Similarity Search [30 mins]
- 4. Lab 3: Semantic Similarity Search with Metadata Filtering [30 mins]
- 5. Lab 4: Semantic Similarity Search with Document Summaries [30 mins]
- 6. Lab 5: Semantic Similarity Search with Re-Ranking [30 mins]
- 7. Conclusion
- 8. References
1. 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.
1.1. 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.
1.2. 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
1.3. RAG Workflow
2. Lab 1: Introduction [5 mins]
2.1. Prerequisites
- AWS account
- Familiarity with Python
- Basic understanding of machine learning concepts
2.2. 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
3. Lab 2: Semantic Similarity Search [30 mins]
Semantic search uses vector embedding representations of documents to perform searches in higher-dimensional vector spaces.
3.1. Implementation
# Python code for semantic similarity search will go here print("Implementing semantic similarity search...")
4. Lab 3: Semantic Similarity Search with Metadata Filtering [30 mins]
This lab demonstrates how to use metadata to filter queries and improve result relevancy.
4.1. Implementation
# Python code for semantic search with metadata filtering will go here print("Implementing semantic search with metadata filtering...")
5. Lab 4: Semantic Similarity Search with Document Summaries [30 mins]
Learn how to use document summaries to improve retrieval results and reduce latency.
5.1. Implementation
# Python code for semantic search with document summaries will go here print("Implementing semantic search with document summaries...")
6. Lab 5: Semantic Similarity Search with Re-Ranking [30 mins]
Explore how re-ranking can improve result relevancy and introduce diversity in results.
6.1. Implementation
# Python code for semantic search with re-ranking will go here print("Implementing semantic search with re-ranking...")
7. Conclusion
Summarize the key takeaways from the workshop and suggest next steps for further learning.