Streaming Serverless Retrieval Augmented Generation

A serverless streaming retrieval augmented generation application using Amazon Bedrock

This repo showcases how to implement a streaming serverless Retrieval Augmented Generation (RAG) architecture.
Customers asked for a way to quickly test RAG capabilities on a small number of documents without managing infrastructure for contextual knowledge and non-parametric memory. In this pattern, I run a RAG workflow in a single Lambda function, so that customers only pay for the infrastructure they use, when they use it.
The responses are streamed using Lambda URL function streaming for a quicker time to first byte and a better user experience. This pattern makes use of Bedrock to calculate embeddings with Amazon Titan Embedding and any Amazon Bedrock chat model as prediction LLM.
I also provide a local pipeline to ingest your PDFs and upload them to S3. There is also an example of how to consume streamed responses using a very basic React application.
Important: This repo is hosted in a community member's private account. AWS makes no warranty of condition or suitability of the content. Please report any issues.

< Back to all repos

GitHub icon View this repo on GitHub


Clone this repo

git clone https://github.com/shafkevi/lambda-bedrock-s3-streaming-rag


Created by:

Kevin Shaffer-Morrison

Kevin Shaffer-Morrison

Kevin Shaffer-Morrison is a Senior Solutions Architect at Amazon Web Services. He's helped hundreds of startups get off the ground quickly and up into the cloud. Kevin focuses on helping the earliest stage of founders with code samples and Twitch live streams.

Follow on LinkedIn