AWS Bedrock Knowledge Base Tutorial: RAG with OpenSearch & Titan Embeddings
Skills:
RAG Basics90%
Key Takeaways
AWS Bedrock Knowledge Base creation and configuration with OpenSearch and Titan Embeddings for Retrieval-Augmented Generation, connecting Amazon S3 to a vector database without complex ingestion scripts
Full Transcript
Let's go to creating the second thing which is knowledge basis. So on the search I would mention knowledge basis. We can see Amazon bedrock feature knowledge basis. We'll click on it. every time we just have to ensure that we are in the Mumbai region just to make sure everything works otherwise uh we might see errors in our application. All right. So we'll create a knowledge base. I will select the first option which is knowledge base with vector store which takes us up here. We can give it a nice name. Now the knowledge base itself needs permission to access different services and for that it wants to create a service role. We can mention the data source type which is Amazon S3 that that is where all our documents are. But there are different source types that knowledge bases also supports from which it can fetch these documents and work with them. All right. Click on next. Now because we selected Amazon S3, it is asking where the documents are there in Amazon S3. So we'll just give it a nice name. We'll mention our S3 bucket AB demo geni bucket and we have another option called passing strategy. So this is about how these documents when converted after processing into text should actually be split. And so we'd be using the default parser and then we'd also be using the default chunking strategy. So the parsing of the documents would be done by default Amazon Bedrock service. The chunking strategy is about once the documents are passed, how we'd like to break it into. So we'd be breaking these documents into 300 token in size and then every chunk would then be given to embeddings to be created into numerical format. All right. So what embedding model we would be using to convert this text into numerical format? We'd be using one of the Amazon's default Titan embeddings, Titan text embeddings v2 and then vector store which is finally where to store these embeddings. We'll be using one of the service Amazon open search serverless. So bedrock is going to create that as well for us and simply click on next. We can review everything over here and we'll click on create knowledge base. So this is going to take around 5 minutes to create multiple services and knowledge base is now creating the open search vector database and would then also be creating multiple services at the back. And this is going to simplify our rag processing really easy because knowledge basis takes care of both putting these documents into open search and also whenever we ask question it will do all the embedding all the searching and would simply give us the final results. So we'll wait 5 minutes or we'll wait until this is complete. All right, our knowledge base is finally ready. We can have a look at it. Now we'll go into data source. The S3 bucket that we connected have it actually synced which means there is data inside it but nothing is actually created in terms of vector embeddings. So as we discussed this knowledge base is going to create an open search vector DB. So let's have a look. We'll search open search. We're opening it in a new tab. On the left, we can click on collections and we see there's a bedrock knowledge base collection created. We click on it and indexes. We can see that the whole vector DB is empty. Which means we have to sync these documents and this is very easy in knowledge bases. So if you're in the knowledge base in data source we can select multiple data sources. In this one we just have S3. We click on it and we simply have to click on sync. And now these documents are being fetched. So the PDF that we had is being fetched converted into text using parser. The text is then split by the chunking strategy which is 300 tokens each. Then Titan embeddings are called into every chunk. They are conver converted into numerical formats and along with the numerical format and the text for which those numerical format is generated is then saved into AWS open search. So all of this process is happening at the back. This shows sync complete. Let's refresh the page. And as we can see that the sync history shows that the syncing was done at this time and it is complete. We can also go to the open search vector and we can see that there is index and multiple documents which are present. All right. So this means that all of the right portion over here which is for the rack pipeline is complete. The ingestion of documents is also done and then we have a filled vector DB. We can now start using it into our application. So let's copy the knowledge base ID. So the knowledge base ID is not the name uh but the ID that we can see in the dashboard. So if we click on our knowledge base, we have the knowledge base name and then the knowledge base ID. So I'll just copy the knowledge base ID over here. All right. So now I want to connect to this knowledge base and ask it questions so it can give me back some related relevant documents based on that question. So let's head on to our code and in ENV we'll add this missing piece of knowledge base ID which completes our ENV file end to end. All right.
Original Description
Description
In this part of our GenAI series, we dive deep into the heart of the RAG pipeline: AWS Bedrock Knowledge Bases.
You will learn how to automate the heavy lifting of Retrieval-Augmented Generation by connecting Amazon S3 to a vector database without writing complex ingestion scripts.
In this video, we cover:
Knowledge Base Creation: Setting up Bedrock in the Mumbai region (ap-south-1).
Data Ingestion: Connecting S3 buckets and configuring parsing strategies.
Chunking Logic: How to split documents into 300-token chunks for optimal retrieval.
Vector Database Setup: Automatically provisioning Amazon OpenSearch Serverless.
Titan Embeddings v2: Using Amazon's latest embedding models to convert text into numerical formats.
The Sync Process: A look behind the scenes at how Bedrock parses, chunks, and stores data.
App Integration: Locating and using your Knowledge Base ID in your .env file.
This setup simplifies the entire RAG process, handling everything from document storage to similarity searching behind the scenes.
🛠 Tech Stack:
Amazon Bedrock
Amazon OpenSearch Serverless
Amazon Titan Text Embeddings v2
Amazon S3
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Analytics Vidhya · Analytics Vidhya · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
The DataHour: Data Science in Retail
Analytics Vidhya
The DataHour: Anomaly detection using NLP and Predictive Modeling
Analytics Vidhya
The DataHour: Energy Data Science Project from Scratch
Analytics Vidhya
The DataHour: Explainable AI Need and Implementation
Analytics Vidhya
The DataHour: Google Cloud AI/ML
Analytics Vidhya
Prediction to Production in Machine Learning #machinelearning #prediction
Analytics Vidhya
Practical Applications of Data science in Ecommerce
Analytics Vidhya
How to tackle Overfitting?#machinelearning #overfitting
Analytics Vidhya
Building Data Pipelines on GCP #googlecloud #datapipelines #data
Analytics Vidhya
Hands-on with A/B Testing #abtesting #datascience
Analytics Vidhya
Efficient Implementations of Transformers #transformers #cnn #machinelearning
Analytics Vidhya
Modern Deep Learning Architecture #deeplearning #architecture #deeplearningtutorial
Analytics Vidhya
Key steps for Designing Artificial Neural Network (ANN) for Image classification #machinelearning
Analytics Vidhya
5 things you should know about Azure SQL #azure #sql #datahour #datascience
Analytics Vidhya
AI & ML in the Automotive Industry #machinelearning #ai
Analytics Vidhya
Building Machine Learning Models in BigQuery
Analytics Vidhya
NLP aspects in Telecommunication Industry
Analytics Vidhya
Practical Time Series Analysis
Analytics Vidhya
Fundamentals of Quantum Computing
Analytics Vidhya
A DAY IN THE LIFE of a Data Scientist (From waking up to working on algorithms)
Analytics Vidhya
Classification Machine Learning Model from Scratch
Analytics Vidhya
Knowledge Graph Solutions using Neo4j
Analytics Vidhya
Model Guesstimation (MLOps)
Analytics Vidhya
ETL Pipelines in Google Cloud Platform
Analytics Vidhya
Key steps for Designing Convolutional Neural Network(CNN) for Image Classification
Analytics Vidhya
Getting Started with AWS EC2 #amazon #aws
Analytics Vidhya
How to Use Azure NLP and Graph Databases for Intelligent Knowledge Mining
Analytics Vidhya
Certified AI & ML BlackBelt Plus Program #shorts
Analytics Vidhya
Visualizing Data using Python #machinelearning #visualization #python
Analytics Vidhya
DCNN for Machine RUL Prediction using Time-series Data #timeseries #machinelearning #datascience
Analytics Vidhya
M in ML stands for Math & Magic
Analytics Vidhya
An Unsupervised ML approach using Clustering
Analytics Vidhya
Customizing Large Language Models GPT3 for Real-life Use Cases #gpt3 #datascience
Analytics Vidhya
Model Parameters vs Hyperparameters - Techniques in ML Engineering #machinelearning
Analytics Vidhya
Practical MLOps #mlops #datascience
Analytics Vidhya
Data Engineering with Databricks #dataengineering #databricks
Analytics Vidhya
Multi-Objective Optimisation
Analytics Vidhya
When Airflow Meets Kubernetes
Analytics Vidhya
AI in Banking
Analytics Vidhya
Learn Convolutional Neural Network for Image Recognition
Analytics Vidhya
Extracting Value from Data
Analytics Vidhya
How to measure Marketing Channel Effectiveness
Analytics Vidhya
Transforming Lives | Data Science Immersive Bootcamp
Analytics Vidhya
Stock Market Analysis - AI driven approach
Analytics Vidhya
Become a Data Engineering Professional in 2022 | Future Trends + Skills Required
Analytics Vidhya
Ensemble Techniques in Machine Learning #machinelearning #ensemble #datascience
Analytics Vidhya
The Power of Visualization | Tableau Full Course | Analytics Vidhya
Analytics Vidhya
Demand for Data Engineers is on the Rise | Data Engineer | Analytics Vidhya
Analytics Vidhya
Data Visualization in Data Science | DataHour | Analytics Vidhya
Analytics Vidhya
Role of Optimization in Machine Learning & Deep Learning | DataHour | Analytics Vidhya
Analytics Vidhya
Solving any Machine Learning Problem | Approach and Steps Involved
Analytics Vidhya
Topic Modeling Explained with Implementation | Using LDA in Python | DataHour by Arpendu Ganguly
Analytics Vidhya
Data Engineering in E-Commerce | The Best Case Study
Analytics Vidhya
Introduction to Classification using Azure Machine Learning | DataHour | Analytics Vidhya
Analytics Vidhya
Introduction to Federated Learning | DataHour | Analytics Vidhya
Analytics Vidhya
Diffusion Models for Generative Arts | DataHour | Analytics Vidhya
Analytics Vidhya
Master Google Analytics in 1 Hour | DataHour | Analytics Vidhya
Analytics Vidhya
Learn Hypothesis Testing | DataHour | Analytics Vidhya
Analytics Vidhya
A Practical Approach to Kaggle Competition | DataHour | Analytics Vidhya
Analytics Vidhya
Making AI work for Business | DataHour | Analytics Vidhya
Analytics Vidhya
More on: RAG Basics
View skill →Related Reads
📰
📰
📰
📰
Building Trustworthy Production RAG Systems Through Continuous Evaluation
Towards Data Science
Most RAG Hallucinations Are Retrieval Failures: How the Retrieval Brick Decides What the Model Can Invent
Towards Data Science
Beyond Search: Building Knowledge Nexus — The Future of AI-Powered Enterprise Intelligence
Medium · Machine Learning
From Documents to Intelligent Answers: Building a RAG Agent from Scratch & Lessons Learned
Dev.to · Sri Deevi
🎓
Tutor Explanation
DeepCamp AI