Practical overview
When it fits
Use it when designing an AWS-oriented RAG pipeline in which document layout should influence chunk boundaries and the amount of context returned with a retrieved passage.
Who it is for
- Developers prototyping AWS-based document ingestion and RAG workflows.
- Teams that need retrieval chunks to retain headings, table context or list titles.
- Practitioners exploring how retrieved section or chapter context can be selected for model prompts.
Documented uses
- Extract text and structural elements such as headings, tables and lists from multi-page documents.
- Create chunks that retain relevant document context, including table headers and list headings.
- Index chunks with section and chapter metadata for retrieval.
- Retrieve relevant passages and choose how much surrounding document context to send to a model.
Requirements & limits
- The notebook depends on AWS services: Bedrock model access, SageMaker JumpStart models and an OpenSearch domain are named prerequisites.
- The README describes S3 as the document-upload stage and allows chunk hierarchy metadata to be saved in S3 or another database.
- OpenSearch retrieval is described as hybrid search combining semantic and text matching.
- The repository lists a MIT-0 license and Jupyter Notebook as its primary language.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Retrieve indexed passages and prepare context for RAG
Retrieve similar passages from an OpenSearch vector database and choose hierarchical context for a prompt.
Before you start
- Document chunks have been indexed in Amazon OpenSearch Service with section hierarchy metadata.
- A text-generation model is available through the named AWS model services.
Steps
Retrieve the top K similar passages from the vector database using hybrid search that combines semantic and text matching.
Use indexed hierarchy metadata to select the retrieved chunk or its section header or chapter as prompt context.
Generate a prompt template using the selected context for the language model.
Expected outcome
A prompt assembled from retrieved passages and a selected level of document context.
Guide limitations
- The README does not specify a value for K or provide query code or a prompt template.
- The exact amount of context to send depends on the use case.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 16 October 2026
- Original website title
- aws-samples/layout-aware-document-processing-and-retrieval-augmented-generation · Official homepage title · retained in its source language

