AI/ML, AWS, Cloud Computing

3 Mins Read

RAG with Amazon Bedrock – Part 2

Voiced by Amazon Polly


RAG stands for Retrieval-Augmented Generative. It refers to a class of natural language processing models that combines generative capabilities with information retrieval mechanisms. RAG models aim to enhance the generation of natural language text by allowing the model to retrieve and incorporate relevant information from a pre-existing knowledge base.

In the previous part, we learnt about the Basics of RAG. The architecture of a typical RAG model includes a generative language model, such as a transformer-based model, and a retrieval component. The retrieval component enables the model to search and retrieve information from a specified knowledge source, often a large database or a collection of documents. The generative model then uses this retrieved information to produce more contextually relevant and informed responses.

Components of Amazon Bedrock

  • Text playground: Hands-on text generation application in the AWS Management Console.
  • Image playground: Hands-on image generation application in the console.
  • Chat playground: Hands-on conversation generation application in the console.
  • Examples library: Example use cases provided for loading.
  • Amazon Bedrock API: Explore using AWS CLI or access the API to interact with base models.
  • Embeddings: Utilize the API to generate embeddings from Titan text and image models.
  • Agents for Amazon Bedrock: Develop agents for orchestration and task execution for customers.
  • Knowledge base for Amazon Bedrock: Draw from data sources to help agents find information for customers.
  • Provisioned Throughput: Purchase throughput for discounted rates to run inference on models.
  • Fine-tuning and Continued Pre-training: Customize Amazon Bedrock base models for improved performance and customer experience.
  • Model invocation logging: Collect logs, input data, and output data for all invocations in your AWS account using Amazon Bedrock.
  • Model versioning: Benefit from continuous updates and improvements in foundation models to enhance application capabilities, accuracy, and safety.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Fully Managed RAG on Amazon Bedrock

The Knowledge Bases for Amazon Bedrock streamline the entire RAG workflow on your behalf. You indicate the data location and choose an embedding model for converting the data into vector embeddings. Amazon Bedrock then generates a vector store to house the vector data in your account. Opting for this choice, exclusively available in the console, results in Amazon Bedrock establishing a vector index in Amazon OpenSearch Serverless within your account, eliminating the necessity for manual management tasks.


Vector embeddings are numerical representations of text data found in your documents. These embeddings are designed to encapsulate the semantic or contextual meaning of the data they represent. In the context of Amazon Bedrock, the platform handles the entire lifecycle of your embeddings, including their creation, storage, management, and updates within the vector store. Amazon Bedrock ensures that your data consistently remains synchronized with the corresponding vector store.

With the new RetrieveAndGenerate API, you can directly retrieve relevant information from your knowledge bases and have Amazon Bedrock generate a response from the results by specifying an FM in your API call.


In the background, Amazon Bedrock transforms queries into embeddings, interacts with the knowledge base, and enhances the FM prompt by incorporating search results as contextual information. Subsequently, it delivers the FM-generated response to address my inquiry. In the case of multi-turn conversations, Knowledge Bases effectively handle the short-term memory of the conversation, ensuring more contextualized results.

Python Code

The output of the RetrieveAndGenerate API includes the generated response, the source attribution, and the retrieved text chunks.

Response to the above code:


In conclusion, Amazon Bedrock’s Knowledge Base is a game-changer for developers seeking to harness the power of information. Whether integrating RAG for dynamic response generation or empowering agents with advanced reasoning capabilities, the possibilities are vast.

Developers can create intelligent applications that stand out in today’s competitive technological landscape by understanding and implementing the various ways to leverage the Knowledge Base. Unlock the true potential of your data with Amazon Bedrock’s Knowledge Base and revolutionize your application development journey.

Drop a query if you have any questions regarding Amazon Bedrock and we will get back to you quickly.

Empowering organizations to become ‘data driven’ enterprises with our Cloud experts.

  • Reduced infrastructure costs
  • Timely data-driven decisions
Get Started

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, Microsoft Gold Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, and many more.

To get started, go through our Consultancy page and Managed Services PackageCloudThat’s offerings.


1. How does Amazon Bedrock manage vector embeddings in the context of text data?

ANS: – To explore the process involved in creating, storing, and synchronizing vector embeddings within the vector store by Amazon Bedrock.

2. Can you elaborate on the role of Knowledge Bases in the RAG workflow and short-term memory management for multi-turn conversations?

ANS: – To understand how Knowledge Bases for Amazon Bedrock streamline the end-to-end RAG workflow and manage the short-term memory of multi-turn conversations to provide contextual results.

WRITTEN BY Arslan Eqbal



    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!