Class for interacting with Amazon Bedrock Knowledge Bases, a RAG workflow oriented service provided by AWS. Extends the BaseRetriever class.
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.getRelevantDocuments("How are clouds formed?"); Copy
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.getRelevantDocuments("How are clouds formed?");
Cleans the result text by replacing sequences of whitespace with a single space and removing ellipses.
The result text to clean.
The cleaned result text.
Generated using TypeDoc
Class for interacting with Amazon Bedrock Knowledge Bases, a RAG workflow oriented service provided by AWS. Extends the BaseRetriever class.
Example