CfnKnowledgeBaseProps Struct
Properties for defining a CfnKnowledgeBase.
| Source | |
|---|---|
| Type last changed |
Example
ts
declare const collection: opensearchserverless.ICollectionRef;
declare const role: iam.Role;
new aws_bedrock_cfn.CfnKnowledgeBase(this, 'KnowledgeBase', {
name: 'product-documentation',
roleArn: role.roleArn,
knowledgeBaseConfiguration: {
type: 'VECTOR',
vectorKnowledgeBaseConfiguration: {
embeddingModelArn: bedrock.BedrockFoundationModel.TITAN_EMBED_TEXT_V2_1024.modelArn,
},
},
}).with(new bedrock.mixins.KnowledgeBaseOpenSearchServerlessStorage({
collection,
vectorIndexName: 'bedrock-knowledge-base-default-index',
vectorField: 'bedrock-knowledge-base-default-vector',
textField: 'AMAZON_BEDROCK_TEXT_CHUNK',
metadataField: 'AMAZON_BEDROCK_METADATA',
}));
python
# collection: opensearchserverless.ICollectionRef
# role: iam.Role
aws_bedrock_cfn.CfnKnowledgeBase(self, "KnowledgeBase",
name="product-documentation",
role_arn=role.role_arn,
knowledge_base_configuration=aws_bedrock_cfn.CfnKnowledgeBase.KnowledgeBaseConfigurationProperty(
type="VECTOR",
vector_knowledge_base_configuration=aws_bedrock_cfn.CfnKnowledgeBase.VectorKnowledgeBaseConfigurationProperty(
embedding_model_arn=bedrock.BedrockFoundationModel.TITAN_EMBED_TEXT_V2_1024.model_arn
)
)
).with(bedrock.mixins.KnowledgeBaseOpenSearchServerlessStorage(
collection=collection,
vector_index_name="bedrock-knowledge-base-default-index",
vector_field="bedrock-knowledge-base-default-vector",
text_field="AMAZON_BEDROCK_TEXT_CHUNK",
metadata_field="AMAZON_BEDROCK_METADATA"
))
java
ICollectionRef collection;
Role role;
CfnKnowledgeBase.Builder.create(this, "KnowledgeBase")
.name("product-documentation")
.roleArn(role.roleArn)
.knowledgeBaseConfiguration(KnowledgeBaseConfigurationProperty.builder()
.type("VECTOR")
.vectorKnowledgeBaseConfiguration(VectorKnowledgeBaseConfigurationProperty.builder()
.embeddingModelArn(bedrock.BedrockFoundationModel.TITAN_EMBED_TEXT_V2_1024.modelArn)
.build())
.build())
.build().with(KnowledgeBaseOpenSearchServerlessStorage.Builder.create()
.collection(collection)
.vectorIndexName("bedrock-knowledge-base-default-index")
.vectorField("bedrock-knowledge-base-default-vector")
.textField("AMAZON_BEDROCK_TEXT_CHUNK")
.metadataField("AMAZON_BEDROCK_METADATA")
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
ICollectionRef collection;
Role role;
new CfnKnowledgeBase(this, "KnowledgeBase", new CfnKnowledgeBaseProps {
Name = "product-documentation",
RoleArn = role.RoleArn,
KnowledgeBaseConfiguration = new KnowledgeBaseConfigurationProperty {
Type = "VECTOR",
VectorKnowledgeBaseConfiguration = new VectorKnowledgeBaseConfigurationProperty {
EmbeddingModelArn = BedrockFoundationModel.TITAN_EMBED_TEXT_V2_1024.ModelArn
}
}
}).With(new Mixins.KnowledgeBaseOpenSearchServerlessStorage(new KnowledgeBaseOpenSearchServerlessStorageProps {
Collection = collection,
VectorIndexName = "bedrock-knowledge-base-default-index",
VectorField = "bedrock-knowledge-base-default-vector",
TextField = "AMAZON_BEDROCK_TEXT_CHUNK",
MetadataField = "AMAZON_BEDROCK_METADATA"
}));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var collection ICollectionRef
var role Role
awscdk.Aws_bedrock.NewCfnKnowledgeBase(this, jsii.String("KnowledgeBase"), &CfnKnowledgeBaseProps{
Name: jsii.String("product-documentation"),
RoleArn: role.roleArn,
KnowledgeBaseConfiguration: &KnowledgeBaseConfigurationProperty{
Type: jsii.String("VECTOR"),
VectorKnowledgeBaseConfiguration: &VectorKnowledgeBaseConfigurationProperty{
EmbeddingModelArn: bedrock.BedrockFoundationModel_TITAN_EMBED_TEXT_V2_1024().ModelArn,
},
},
}).With(mixins.NewKnowledgeBaseOpenSearchServerlessStorage(&KnowledgeBaseOpenSearchServerlessStorageProps{
Collection: Collection,
VectorIndexName: jsii.String("bedrock-knowledge-base-default-index"),
VectorField: jsii.String("bedrock-knowledge-base-default-vector"),
TextField: jsii.String("AMAZON_BEDROCK_TEXT_CHUNK"),
MetadataField: jsii.String("AMAZON_BEDROCK_METADATA"),
}))
Properties
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #The description of the knowledge base associated with the inline agent.
knowledgeBaseConfigurationIResolvable | CfnKnowledgeBase.knowledge_base_configurationtyping.Union[IResolvable, KnowledgeBaseConfigurationProperty]knowledgeBaseConfigurationIResolvableKnowledgeBaseConfigurationIResolvableKnowledgeBaseConfigurationinterface{} required #Contains details about the embeddings configuration of the knowledge base.
The name of the knowledge base.
The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the knowledge base.
storageConfigurationoptionalIResolvable | CfnKnowledgeBase.storage_configurationoptionaltyping.Union[IResolvable, StorageConfigurationProperty]storageConfigurationoptionalIResolvableStorageConfigurationoptionalIResolvableStorageConfigurationoptionalinterface{} #Contains details about the storage configuration of the knowledge base.
tagsoptional{ [key: string]: string }tagsoptionaltyping.Mapping[str, str]tagsoptionalMap<String, String>TagsoptionalIDictionary<string, string>Tagsoptional*map[string]*string #Metadata that you can assign to a resource as key-value pairs. For more information, see the following resources:.