Skip to content
v2.275.0

Experimental

@aws-cdk/aws-bedrock-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

VectorType Enum ​

The data type for the vectors when using a model to convert text into vector embeddings.

The model must support the specified data type for vector embeddings. Floating-point (float32) is the default data type, and is supported by most models for vector embeddings. See Supported embeddings models for information on the available models and their vector data types.

Example ​

ts
declare const collection: opensearchserverless.ICollectionRef;
declare const role: iam.Role;
declare const multimodalBucket: s3.IBucket;

new bedrock.KnowledgeBase(this, 'KnowledgeBase', {
  knowledgeBaseName: 'product-documentation',
  description: 'Product manuals and release notes',
  type: bedrock.KnowledgeBaseType.vector({
    embeddingsModel: bedrock.BedrockFoundationModel.COHERE_EMBED_MULTILINGUAL_V3,
    // Store binary vectors: less precise, but cheaper to store and search
    vectorType: bedrock.VectorType.BINARY,
    vectorStore: bedrock.VectorStore.openSearchServerless({
      collection,
      vectorIndexName: 'bedrock-knowledge-base-default-index',
      vectorField: 'bedrock-knowledge-base-default-vector',
      textField: 'AMAZON_BEDROCK_TEXT_CHUNK',
      metadataField: 'AMAZON_BEDROCK_METADATA',
    }),
    // Where images, audio and video extracted from multimodal documents are stored
    supplementalDataStorageBucket: multimodalBucket,
  }),
  // Bring your own service role; the model and vector store permissions are added to it
  role,
  tags: {
    Team: 'Documentation',
  },
});

Members ​

MemberDescription
FLOATING_POINTFLOATING_POINT convert the data to floating-point (float32) vector embeddings (more precise, but more costly).
BINARYBINARY convert the data to binary vector embeddings (less precise, but less costly).

Referenced by ​