AgentKnowledgeBase

class AgentKnowledgeBase : KotlinCustomResource

Resource for managing an AWS Agents for Amazon Bedrock Knowledge Base.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.bedrock.AgentKnowledgeBase("test", {
name: "example",
roleArn: example.arn,
knowledgeBaseConfiguration: {
vectorKnowledgeBaseConfiguration: {
embeddingModelArn: "arn:aws:bedrock:us-west-2::foundation-model/amazon.titan-embed-text-v1",
},
type: "VECTOR",
},
storageConfiguration: {
type: "OPENSEARCH_SERVERLESS",
opensearchServerlessConfiguration: {
collectionArn: "arn:aws:aoss:us-west-2:1234567890:collection/142bezjddq707i5stcrf",
vectorIndexName: "bedrock-knowledge-base-default-index",
fieldMapping: {
vectorField: "bedrock-knowledge-base-default-vector",
textField: "AMAZON_BEDROCK_TEXT_CHUNK",
metadataField: "AMAZON_BEDROCK_METADATA",
},
},
},
});
import pulumi
import pulumi_aws as aws
test = aws.bedrock.AgentKnowledgeBase("test",
name="example",
role_arn=example["arn"],
knowledge_base_configuration=aws.bedrock.AgentKnowledgeBaseKnowledgeBaseConfigurationArgs(
vector_knowledge_base_configuration=aws.bedrock.AgentKnowledgeBaseKnowledgeBaseConfigurationVectorKnowledgeBaseConfigurationArgs(
embedding_model_arn="arn:aws:bedrock:us-west-2::foundation-model/amazon.titan-embed-text-v1",
),
type="VECTOR",
),
storage_configuration=aws.bedrock.AgentKnowledgeBaseStorageConfigurationArgs(
type="OPENSEARCH_SERVERLESS",
opensearch_serverless_configuration=aws.bedrock.AgentKnowledgeBaseStorageConfigurationOpensearchServerlessConfigurationArgs(
collection_arn="arn:aws:aoss:us-west-2:1234567890:collection/142bezjddq707i5stcrf",
vector_index_name="bedrock-knowledge-base-default-index",
field_mapping=aws.bedrock.AgentKnowledgeBaseStorageConfigurationOpensearchServerlessConfigurationFieldMappingArgs(
vector_field="bedrock-knowledge-base-default-vector",
text_field="AMAZON_BEDROCK_TEXT_CHUNK",
metadata_field="AMAZON_BEDROCK_METADATA",
),
),
))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.Bedrock.AgentKnowledgeBase("test", new()
{
Name = "example",
RoleArn = example.Arn,
KnowledgeBaseConfiguration = new Aws.Bedrock.Inputs.AgentKnowledgeBaseKnowledgeBaseConfigurationArgs
{
VectorKnowledgeBaseConfiguration = new Aws.Bedrock.Inputs.AgentKnowledgeBaseKnowledgeBaseConfigurationVectorKnowledgeBaseConfigurationArgs
{
EmbeddingModelArn = "arn:aws:bedrock:us-west-2::foundation-model/amazon.titan-embed-text-v1",
},
Type = "VECTOR",
},
StorageConfiguration = new Aws.Bedrock.Inputs.AgentKnowledgeBaseStorageConfigurationArgs
{
Type = "OPENSEARCH_SERVERLESS",
OpensearchServerlessConfiguration = new Aws.Bedrock.Inputs.AgentKnowledgeBaseStorageConfigurationOpensearchServerlessConfigurationArgs
{
CollectionArn = "arn:aws:aoss:us-west-2:1234567890:collection/142bezjddq707i5stcrf",
VectorIndexName = "bedrock-knowledge-base-default-index",
FieldMapping = new Aws.Bedrock.Inputs.AgentKnowledgeBaseStorageConfigurationOpensearchServerlessConfigurationFieldMappingArgs
{
VectorField = "bedrock-knowledge-base-default-vector",
TextField = "AMAZON_BEDROCK_TEXT_CHUNK",
MetadataField = "AMAZON_BEDROCK_METADATA",
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/bedrock"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := bedrock.NewAgentKnowledgeBase(ctx, "test", &bedrock.AgentKnowledgeBaseArgs{
Name: pulumi.String("example"),
RoleArn: pulumi.Any(example.Arn),
KnowledgeBaseConfiguration: &bedrock.AgentKnowledgeBaseKnowledgeBaseConfigurationArgs{
VectorKnowledgeBaseConfiguration: &bedrock.AgentKnowledgeBaseKnowledgeBaseConfigurationVectorKnowledgeBaseConfigurationArgs{
EmbeddingModelArn: pulumi.String("arn:aws:bedrock:us-west-2::foundation-model/amazon.titan-embed-text-v1"),
},
Type: pulumi.String("VECTOR"),
},
StorageConfiguration: &bedrock.AgentKnowledgeBaseStorageConfigurationArgs{
Type: pulumi.String("OPENSEARCH_SERVERLESS"),
OpensearchServerlessConfiguration: &bedrock.AgentKnowledgeBaseStorageConfigurationOpensearchServerlessConfigurationArgs{
CollectionArn: pulumi.String("arn:aws:aoss:us-west-2:1234567890:collection/142bezjddq707i5stcrf"),
VectorIndexName: pulumi.String("bedrock-knowledge-base-default-index"),
FieldMapping: &bedrock.AgentKnowledgeBaseStorageConfigurationOpensearchServerlessConfigurationFieldMappingArgs{
VectorField: pulumi.String("bedrock-knowledge-base-default-vector"),
TextField: pulumi.String("AMAZON_BEDROCK_TEXT_CHUNK"),
MetadataField: pulumi.String("AMAZON_BEDROCK_METADATA"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.bedrock.AgentKnowledgeBase;
import com.pulumi.aws.bedrock.AgentKnowledgeBaseArgs;
import com.pulumi.aws.bedrock.inputs.AgentKnowledgeBaseKnowledgeBaseConfigurationArgs;
import com.pulumi.aws.bedrock.inputs.AgentKnowledgeBaseKnowledgeBaseConfigurationVectorKnowledgeBaseConfigurationArgs;
import com.pulumi.aws.bedrock.inputs.AgentKnowledgeBaseStorageConfigurationArgs;
import com.pulumi.aws.bedrock.inputs.AgentKnowledgeBaseStorageConfigurationOpensearchServerlessConfigurationArgs;
import com.pulumi.aws.bedrock.inputs.AgentKnowledgeBaseStorageConfigurationOpensearchServerlessConfigurationFieldMappingArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new AgentKnowledgeBase("test", AgentKnowledgeBaseArgs.builder()
.name("example")
.roleArn(example.arn())
.knowledgeBaseConfiguration(AgentKnowledgeBaseKnowledgeBaseConfigurationArgs.builder()
.vectorKnowledgeBaseConfiguration(AgentKnowledgeBaseKnowledgeBaseConfigurationVectorKnowledgeBaseConfigurationArgs.builder()
.embeddingModelArn("arn:aws:bedrock:us-west-2::foundation-model/amazon.titan-embed-text-v1")
.build())
.type("VECTOR")
.build())
.storageConfiguration(AgentKnowledgeBaseStorageConfigurationArgs.builder()
.type("OPENSEARCH_SERVERLESS")
.opensearchServerlessConfiguration(AgentKnowledgeBaseStorageConfigurationOpensearchServerlessConfigurationArgs.builder()
.collectionArn("arn:aws:aoss:us-west-2:1234567890:collection/142bezjddq707i5stcrf")
.vectorIndexName("bedrock-knowledge-base-default-index")
.fieldMapping(AgentKnowledgeBaseStorageConfigurationOpensearchServerlessConfigurationFieldMappingArgs.builder()
.vectorField("bedrock-knowledge-base-default-vector")
.textField("AMAZON_BEDROCK_TEXT_CHUNK")
.metadataField("AMAZON_BEDROCK_METADATA")
.build())
.build())
.build())
.build());
}
}
resources:
test:
type: aws:bedrock:AgentKnowledgeBase
properties:
name: example
roleArn: ${example.arn}
knowledgeBaseConfiguration:
vectorKnowledgeBaseConfiguration:
embeddingModelArn: arn:aws:bedrock:us-west-2::foundation-model/amazon.titan-embed-text-v1
type: VECTOR
storageConfiguration:
type: OPENSEARCH_SERVERLESS
opensearchServerlessConfiguration:
collectionArn: arn:aws:aoss:us-west-2:1234567890:collection/142bezjddq707i5stcrf
vectorIndexName: bedrock-knowledge-base-default-index
fieldMapping:
vectorField: bedrock-knowledge-base-default-vector
textField: AMAZON_BEDROCK_TEXT_CHUNK
metadataField: AMAZON_BEDROCK_METADATA

Import

Using pulumi import, import Agents for Amazon Bedrock Knowledge Base using the Q1IYMH6GQG. For example:

$ pulumi import aws:bedrock/agentKnowledgeBase:AgentKnowledgeBase example Q1IYMH6GQG

Properties

Link copied to clipboard
val arn: Output<String>

ARN of the Knowledge Base. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information.

Link copied to clipboard
val createdAt: Output<String>
Link copied to clipboard
val description: Output<String>?

A description of the knowledge base.

Link copied to clipboard
val failureReasons: Output<List<String>>
Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Contains details about the embeddings model used for the knowledge base.

Link copied to clipboard
val name: Output<String>

A name for the knowledge base.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val roleArn: Output<String>

The ARN of the IAM role with permissions to create the knowledge base.

Link copied to clipboard

Contains details about the configuration of the vector database used for the knowledge base.

Link copied to clipboard
val tags: Output<Map<String, String>>?

A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>
Link copied to clipboard
Link copied to clipboard
val updatedAt: Output<String>
Link copied to clipboard
val urn: Output<String>