This construct provides a high-level abstraction for creating Amazon Bedrock Knowledge Bases with vector storage and data sources.
import { BedrockKnowledgeBaseL3Construct } from '@aws-mdaa/bedrock-knowledge-base-l3-construct';
const knowledgeBase = new BedrockKnowledgeBaseL3Construct(this, 'MyKB', {
kbName: 'my-knowledge-base',
kbConfig: {
role: kbExecutionRole,
vectorStore: 'my-vector-store',
embeddingModel: 'amazon.titan-embed-text-v2:0',
s3DataSources: {
documents: {
bucketName: 'my-docs-bucket',
prefix: 'documents/',
enableMultiSync: true
}
}
},
vectorStoreConfig: {
vpcId: 'vpc-12345',
subnetIds: ['subnet-1', 'subnet-2']
},
kmsKey: myKmsKey,
roleHelper: roleHelper,
naming: naming
});
role: Execution role for the knowledge base (required)vectorStore: Reference to vector store configuration (required)embeddingModel: Embedding model ID or ARN (required)s3DataSources: Map of S3 data source configurationsvectorFieldSize: Optional vector field size overridesupplementalBucketName: Optional supplemental storage bucketvpcId: VPC where the vector store will be deployed (required)subnetIds: Subnet IDs for the vector store (required)port: Optional database port (default: 5432)engineVersion: Optional Aurora PostgreSQL versionminCapacity: Optional minimum Aurora Capacity UnitsmaxCapacity: Optional maximum Aurora Capacity UnitsbucketName: S3 bucket name (required)prefix: Optional S3 prefix filterenableSync: Enable automatic sync on S3 changes limiting only one file at a timeenableMultiSync: Enable automatic sync on S3 bucket changes processing multiple file changes at the same timevectorIngestionConfiguration: Advanced parsing and chunking optionsBEDROCK_DATA_AUTOMATION: Automated multimodal parsingBEDROCK_FOUNDATION_MODEL: Custom foundation model parsingFIXED_SIZE: Fixed token-based chunkingHIERARCHICAL: Parent-child chunkingSEMANTIC: Meaning-based chunkingNONE: No chunkingThe construct automatically creates IAM policies with permissions for:
@aws-mdaa/cloudwatch-constructs@aws-mdaa/dataops-lambda-l3-construct@aws-mdaa/ec2-constructs@aws-mdaa/iam-constructs@aws-mdaa/iam-role-helper@aws-mdaa/kms-constructs@aws-mdaa/l3-construct@aws-mdaa/rds-constructs@aws-mdaa/constructaws-cdk-libconstructs