Skip to content

Create Knowledge Base

bedrockagent_create_knowledge_base R Documentation

Creates a knowledge base

Description

Creates a knowledge base. A knowledge base contains your data sources so that Large Language Models (LLMs) can use your data. To create a knowledge base, you must first set up your data sources and configure a supported vector store. For more information, see Set up a knowledge base.

If you prefer to let Amazon Bedrock create and manage a vector store for you in Amazon OpenSearch Service, use the console. For more information, see Create a knowledge base.

  • Provide the name and an optional description.

  • Provide the Amazon Resource Name (ARN) with permissions to create a knowledge base in the roleArn field.

  • Provide the embedding model to use in the embeddingModelArn field in the knowledgeBaseConfiguration object.

  • Provide the configuration for your vector store in the storageConfiguration object.

Usage

bedrockagent_create_knowledge_base(clientToken, description,
  knowledgeBaseConfiguration, name, roleArn, storageConfiguration, tags)

Arguments

clientToken

A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency.

description

A description of the knowledge base.

knowledgeBaseConfiguration

[required] Contains details about the embeddings model used for the knowledge base.

name

[required] A name for the knowledge base.

roleArn

[required] The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the knowledge base.

storageConfiguration

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

tags

Specify the key-value pairs for the tags that you want to attach to your knowledge base in this object.

Value

A list with the following syntax:

list(
  knowledgeBase = list(
    createdAt = as.POSIXct(
      "2015-01-01"
    ),
    description = "string",
    failureReasons = list(
      "string"
    ),
    knowledgeBaseArn = "string",
    knowledgeBaseConfiguration = list(
      kendraKnowledgeBaseConfiguration = list(
        kendraIndexArn = "string"
      ),
      sqlKnowledgeBaseConfiguration = list(
        redshiftConfiguration = list(
          queryEngineConfiguration = list(
            provisionedConfiguration = list(
              authConfiguration = list(
                databaseUser = "string",
                type = "IAM"|"USERNAME_PASSWORD"|"USERNAME",
                usernamePasswordSecretArn = "string"
              ),
              clusterIdentifier = "string"
            ),
            serverlessConfiguration = list(
              authConfiguration = list(
                type = "IAM"|"USERNAME_PASSWORD",
                usernamePasswordSecretArn = "string"
              ),
              workgroupArn = "string"
            ),
            type = "SERVERLESS"|"PROVISIONED"
          ),
          queryGenerationConfiguration = list(
            executionTimeoutSeconds = 123,
            generationContext = list(
              curatedQueries = list(
                list(
                  naturalLanguage = "string",
                  sql = "string"
                )
              ),
              tables = list(
                list(
                  columns = list(
                    list(
                      description = "string",
                      inclusion = "INCLUDE"|"EXCLUDE",
                      name = "string"
                    )
                  ),
                  description = "string",
                  inclusion = "INCLUDE"|"EXCLUDE",
                  name = "string"
                )
              )
            )
          ),
          storageConfigurations = list(
            list(
              awsDataCatalogConfiguration = list(
                tableNames = list(
                  "string"
                )
              ),
              redshiftConfiguration = list(
                databaseName = "string"
              ),
              type = "REDSHIFT"|"AWS_DATA_CATALOG"
            )
          )
        ),
        type = "REDSHIFT"
      ),
      type = "VECTOR"|"KENDRA"|"SQL",
      vectorKnowledgeBaseConfiguration = list(
        embeddingModelArn = "string",
        embeddingModelConfiguration = list(
          bedrockEmbeddingModelConfiguration = list(
            dimensions = 123,
            embeddingDataType = "FLOAT32"|"BINARY"
          )
        ),
        supplementalDataStorageConfiguration = list(
          storageLocations = list(
            list(
              s3Location = list(
                uri = "string"
              ),
              type = "S3"
            )
          )
        )
      )
    ),
    knowledgeBaseId = "string",
    name = "string",
    roleArn = "string",
    status = "CREATING"|"ACTIVE"|"DELETING"|"UPDATING"|"FAILED"|"DELETE_UNSUCCESSFUL",
    storageConfiguration = list(
      mongoDbAtlasConfiguration = list(
        collectionName = "string",
        credentialsSecretArn = "string",
        databaseName = "string",
        endpoint = "string",
        endpointServiceName = "string",
        fieldMapping = list(
          metadataField = "string",
          textField = "string",
          vectorField = "string"
        ),
        vectorIndexName = "string"
      ),
      opensearchServerlessConfiguration = list(
        collectionArn = "string",
        fieldMapping = list(
          metadataField = "string",
          textField = "string",
          vectorField = "string"
        ),
        vectorIndexName = "string"
      ),
      pineconeConfiguration = list(
        connectionString = "string",
        credentialsSecretArn = "string",
        fieldMapping = list(
          metadataField = "string",
          textField = "string"
        ),
        namespace = "string"
      ),
      rdsConfiguration = list(
        credentialsSecretArn = "string",
        databaseName = "string",
        fieldMapping = list(
          metadataField = "string",
          primaryKeyField = "string",
          textField = "string",
          vectorField = "string"
        ),
        resourceArn = "string",
        tableName = "string"
      ),
      redisEnterpriseCloudConfiguration = list(
        credentialsSecretArn = "string",
        endpoint = "string",
        fieldMapping = list(
          metadataField = "string",
          textField = "string",
          vectorField = "string"
        ),
        vectorIndexName = "string"
      ),
      type = "OPENSEARCH_SERVERLESS"|"PINECONE"|"REDIS_ENTERPRISE_CLOUD"|"RDS"|"MONGO_DB_ATLAS"
    ),
    updatedAt = as.POSIXct(
      "2015-01-01"
    )
  )
)

Request syntax

svc$create_knowledge_base(
  clientToken = "string",
  description = "string",
  knowledgeBaseConfiguration = list(
    kendraKnowledgeBaseConfiguration = list(
      kendraIndexArn = "string"
    ),
    sqlKnowledgeBaseConfiguration = list(
      redshiftConfiguration = list(
        queryEngineConfiguration = list(
          provisionedConfiguration = list(
            authConfiguration = list(
              databaseUser = "string",
              type = "IAM"|"USERNAME_PASSWORD"|"USERNAME",
              usernamePasswordSecretArn = "string"
            ),
            clusterIdentifier = "string"
          ),
          serverlessConfiguration = list(
            authConfiguration = list(
              type = "IAM"|"USERNAME_PASSWORD",
              usernamePasswordSecretArn = "string"
            ),
            workgroupArn = "string"
          ),
          type = "SERVERLESS"|"PROVISIONED"
        ),
        queryGenerationConfiguration = list(
          executionTimeoutSeconds = 123,
          generationContext = list(
            curatedQueries = list(
              list(
                naturalLanguage = "string",
                sql = "string"
              )
            ),
            tables = list(
              list(
                columns = list(
                  list(
                    description = "string",
                    inclusion = "INCLUDE"|"EXCLUDE",
                    name = "string"
                  )
                ),
                description = "string",
                inclusion = "INCLUDE"|"EXCLUDE",
                name = "string"
              )
            )
          )
        ),
        storageConfigurations = list(
          list(
            awsDataCatalogConfiguration = list(
              tableNames = list(
                "string"
              )
            ),
            redshiftConfiguration = list(
              databaseName = "string"
            ),
            type = "REDSHIFT"|"AWS_DATA_CATALOG"
          )
        )
      ),
      type = "REDSHIFT"
    ),
    type = "VECTOR"|"KENDRA"|"SQL",
    vectorKnowledgeBaseConfiguration = list(
      embeddingModelArn = "string",
      embeddingModelConfiguration = list(
        bedrockEmbeddingModelConfiguration = list(
          dimensions = 123,
          embeddingDataType = "FLOAT32"|"BINARY"
        )
      ),
      supplementalDataStorageConfiguration = list(
        storageLocations = list(
          list(
            s3Location = list(
              uri = "string"
            ),
            type = "S3"
          )
        )
      )
    )
  ),
  name = "string",
  roleArn = "string",
  storageConfiguration = list(
    mongoDbAtlasConfiguration = list(
      collectionName = "string",
      credentialsSecretArn = "string",
      databaseName = "string",
      endpoint = "string",
      endpointServiceName = "string",
      fieldMapping = list(
        metadataField = "string",
        textField = "string",
        vectorField = "string"
      ),
      vectorIndexName = "string"
    ),
    opensearchServerlessConfiguration = list(
      collectionArn = "string",
      fieldMapping = list(
        metadataField = "string",
        textField = "string",
        vectorField = "string"
      ),
      vectorIndexName = "string"
    ),
    pineconeConfiguration = list(
      connectionString = "string",
      credentialsSecretArn = "string",
      fieldMapping = list(
        metadataField = "string",
        textField = "string"
      ),
      namespace = "string"
    ),
    rdsConfiguration = list(
      credentialsSecretArn = "string",
      databaseName = "string",
      fieldMapping = list(
        metadataField = "string",
        primaryKeyField = "string",
        textField = "string",
        vectorField = "string"
      ),
      resourceArn = "string",
      tableName = "string"
    ),
    redisEnterpriseCloudConfiguration = list(
      credentialsSecretArn = "string",
      endpoint = "string",
      fieldMapping = list(
        metadataField = "string",
        textField = "string",
        vectorField = "string"
      ),
      vectorIndexName = "string"
    ),
    type = "OPENSEARCH_SERVERLESS"|"PINECONE"|"REDIS_ENTERPRISE_CLOUD"|"RDS"|"MONGO_DB_ATLAS"
  ),
  tags = list(
    "string"
  )
)