OpenViSTAI · Agents · Blockchain · Crypto
Menu
RAG & Knowledge Systems

Rag Using Langchain Amazon Bedrock And Opensearch

A public Python sample repository that demonstrates retrieval-augmented generation by creating text embeddings with Amazon Bedrock Titan, storing them in Amazon OpenSearch's vector engine, and using LangChain to retrieve similar text for a language-model prompt.

Independent OpenViST project profile, based on linked sources.

Rag Using Langchain Amazon Bedrock And Opensearch — OpenViST project profile in RAG & Knowledge Systems.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it as a code starting point when you need to understand or adapt a Python pipeline linking Bedrock embeddings, OpenSearch vector search, and LangChain retrieval.

Who it is for

  • Developers learning or prototyping a RAG workflow with Amazon Bedrock and OpenSearch.
  • Teams exploring semantic retrieval of text to provide relevant context to language-model prompts.

Documented uses

  • Load text from the sample dataset, generate embeddings, and store them in an OpenSearch index.
  • Retrieve similar text when submitting a question to a model through Amazon Bedrock.
  • Choose a documented Bedrock model ID and, for queries, select an index, region, or tenant ID.
Before you choose

Requirements & limits

The repository is public and licensed under MIT-0. The documented workflow requires Python, Terraform, AWS service setup, and enabled Bedrock model access.

  • The sample combines a Python application pipeline with Terraform-managed OpenSearch infrastructure.
  • Its example dataset is the gooaq_pairs file from Hugging Face.
  • The README's cluster configuration uses a public endpoint and is explicitly described as testing-only.
  • The README documents Python 3.11.4 as the version used for testing.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Set up and query the sample RAG workflow

Create the sample OpenSearch cluster, load embeddings from the example dataset, and submit a question through Amazon Bedrock.

Before you start

  • Python 3.11.4 is identified as the version used for testing.
  • A clean Python environment and the repository's requirements file.
  • Terraform to create the OpenSearch cluster.
  • Enable the desired foundation models in Amazon Bedrock.

Steps

  1. Create and activate a virtual environment, then install dependencies with the command below.

    Documented command
    pip install -r requirements.txt
  2. From the terraform directory, run terraform init and terraform apply -auto-approve to create the cluster.

  3. Run the command below to load the example data and embeddings.

    Documented command
    python load-data-to-opensearch.py --recreate 1 --early-stop 1
  4. Run the command below to query the model using retrieved text.

    Documented command
    python ask-bedrock-with-rag.py --ask "your question here"

Expected outcome

A sample workflow that stores text embeddings in OpenSearch and uses retrieved matches when asking a model through Bedrock.

Guide limitations

  • The README describes the public-endpoint cluster configuration as testing-only.
  • The early-stop option loads only 100 embedded documents.
  • The workflow depends on configuring AWS services and enabling model access.
COMPARE OPTIONS

Compare options for Retrieval-augmented applications

These projects document a common task and share a project role. This is a source-based comparison, not an execution benchmark or a guarantee of interchangeability.

ProjectDocumented purposePlatformAccess and requirements
Rag Using Langchain Amazon Bedrock And OpensearchLoad text from the sample dataset, generate embeddings, and store them in an OpenSearch index.CloudThe repository is public and licensed under MIT-0. The documented workflow requires Python, Terraform, AWS service setup, and enabled Bedrock model access.
LangsearchCrawl website or local data for a knowledge base.CLI, Self-hosted, Server
Hybrid Search RagCombine document retrieval and language-model generation in a configurable workflow.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
17 October 2026
Original website title
aws-samples/rag-using-langchain-amazon-bedrock-and-opensearch · Official homepage title · retained in its source language