Back to directory

Retrieval Augmented Generation using Amazon Bedrock

Sample code and a CloudFormation template for building a question-answering application with Amazon Bedrock, using a knowledge base backed by Amazon OpenSearch Serverless for retrieval-augmented generation.

Retrieval Augmented Generation using Amazon Bedrock

This repository shows how to build a retrieval-augmented-generation question-answering application on Amazon Bedrock. A data pipeline, implemented through Amazon Bedrock Agents for Knowledge Base, ingests documents such as HTML, PDF and text files from an Amazon S3 bucket, chunks them, converts the chunks into embeddings with the Amazon Titan Embeddings model, and stores them in an Amazon OpenSearch Serverless vector collection. An application then takes a user's question, looks up relevant context in the knowledge base, and passes the question and context to a large language model to generate an answer.

Setup uses an included AWS CloudFormation template that provisions the vector collection, an S3 bucket, IAM roles and a SageMaker notebook with the repository already cloned. The project notes that Amazon Bedrock now also offers Managed Knowledge Bases, which remove the need to set up a separate vector store.

It is released under the MIT-0 license.

More in RAG

See all 540
  • ai·rete·rag

    ai-rete-rag.com

    A platform that pairs a Rete rule engine with retrieval-augmented generation, so deterministic rules decide an outcome and grounded retrieval explains the decision in plain language.

  • Xtriever

    github.com

    A hybrid retrieval engine for retrieval-augmented generation, written in Rust to run on-device on a phone or a laptop, combining lexical BM25 search, dense embedding search, reciprocal-rank fusion and cross-encoder re-ranking with no server.

  • FileFlux

    github.com

    A .NET library that turns PDF, DOCX, HWP and other documents into optimized chunks for RAG systems, through a five-stage pipeline built on high-performance Rust FFI readers.