Knowledge Bases for Amazon Bedrock
Knowledge Bases for Amazon Bedrock is a fully managed support for end-to-end RAG workflow provided by Amazon Web Services (AWS). It provides an entire ingestion workflow of converting your documents into embeddings (vector) and storing the embeddings in a specialized vector database. Knowledge Bases for Amazon Bedrock supports popular databases for vector storage, including vector engine for Amazon OpenSearch Serverless, Pinecone, Redis Enterprise Cloud, Amazon Aurora (coming soon), and MongoDB (coming soon).
Setup
- npm
- Yarn
- pnpm
npm i @langchain/aws
yarn add @langchain/aws
pnpm add @langchain/aws
Usage
import { AmazonKnowledgeBaseRetriever } from "@langchain/aws";
const retriever = new AmazonKnowledgeBaseRetriever({
topK: 10,
knowledgeBaseId: "YOUR_KNOWLEDGE_BASE_ID",
region: "us-east-2",
clientOptions: {
credentials: {
accessKeyId: "YOUR_ACCESS_KEY_ID",
secretAccessKey: "YOUR_SECRET_ACCESS_KEY",
},
},
});
const docs = await retriever.invoke("How are clouds formed?");
console.log(docs);
API Reference:
- AmazonKnowledgeBaseRetriever from
@langchain/aws