Diagram
Comments
- The model does not know your documents. RAG adds the context retrieved from OpenSearch before generating the answer.
- Embeddings must be generated with the same model during ingestion and querying. If you change models, you must reindex.
- Review Bedrock's data handling policies and encryption options before loading sensitive information.
- For repeated questions, a cache in DynamoDB reduces cost and latency.
Information flow
- Amazon API Gateway
The user sends the question to API Gateway.
- AWS Lambda
API Gateway invokes the Lambda function that orchestrates the RAG flow.
- Amazon OpenSearch Serverless
Lambda searches the vector index for the most similar document chunks.
- Amazon Bedrock
Lambda sends the question and the retrieved context to the Bedrock model.
- Amazon Bedrock + API Gateway
Bedrock returns the answer, and the result reaches the user through API Gateway.