# CfnKnowledgeBaseProps

Properties for defining a `CfnKnowledgeBase`.

Used as props by: [CfnKnowledgeBase](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrock.CfnKnowledgeBase.html)

- Source: Generated at build time
- Type last changed: v2.174.0 · 4 Jan 2025

## Example

TypeScript:

```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:

```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:

```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());
```

C# / .NET:

```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"
}));
```

Golang:

```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

- `description`: string — The description of the knowledge base associated with the inline agent.

- `knowledgeBaseConfiguration`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnKnowledgeBase.KnowledgeBaseConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrock.CfnKnowledgeBase.KnowledgeBaseConfigurationProperty.html) (required) — Contains details about the embeddings configuration of the knowledge base.

- `name`: string (required) — The name of the knowledge base.

- `roleArn`: string (required) — The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the knowledge base.

- `storageConfiguration`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnKnowledgeBase.StorageConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrock.CfnKnowledgeBase.StorageConfigurationProperty.html) — Contains details about the storage configuration of the knowledge base.

- `tags`: { [key: string]: string } — Metadata that you can assign to a resource as key-value pairs. For more information, see the following resources:.

  - [Tag naming limits and requirements](https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging.html#tag-conventions)
  - [Tagging best practices](https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging.html#tag-best-practices)
