AgentsforBedrock / Client / create_knowledge_base

create_knowledge_base#

AgentsforBedrock.Client.create_knowledge_base(**kwargs)#

Create a new knowledge base

See also: AWS API Documentation

Request Syntax

response = client.create_knowledge_base(
    clientToken='string',
    name='string',
    description='string',
    roleArn='string',
    knowledgeBaseConfiguration={
        'type': 'VECTOR',
        'vectorKnowledgeBaseConfiguration': {
            'embeddingModelArn': 'string'
        }
    },
    storageConfiguration={
        'type': 'OPENSEARCH_SERVERLESS'|'PINECONE'|'REDIS_ENTERPRISE_CLOUD',
        'opensearchServerlessConfiguration': {
            'collectionArn': 'string',
            'vectorIndexName': 'string',
            'fieldMapping': {
                'vectorField': 'string',
                'textField': 'string',
                'metadataField': 'string'
            }
        },
        'pineconeConfiguration': {
            'connectionString': 'string',
            'credentialsSecretArn': 'string',
            'namespace': 'string',
            'fieldMapping': {
                'textField': 'string',
                'metadataField': 'string'
            }
        },
        'redisEnterpriseCloudConfiguration': {
            'endpoint': 'string',
            'vectorIndexName': 'string',
            'credentialsSecretArn': 'string',
            'fieldMapping': {
                'vectorField': 'string',
                'textField': 'string',
                'metadataField': 'string'
            }
        }
    },
    tags={
        'string': 'string'
    }
)
Parameters:
  • clientToken (string) –

    Client specified token used for idempotency checks

    This field is autopopulated if not provided.

  • name (string) –

    [REQUIRED]

    Name for a resource.

  • description (string) – Description of the Resource.

  • roleArn (string) –

    [REQUIRED]

    ARN of a IAM role.

  • knowledgeBaseConfiguration (dict) –

    [REQUIRED]

    Configures a bedrock knowledge base.

    • type (string) – [REQUIRED]

      The type of a knowledge base.

    • vectorKnowledgeBaseConfiguration (dict) –

      Configurations for a vector knowledge base.

      • embeddingModelArn (string) – [REQUIRED]

        Arn of a Bedrock model.

  • storageConfiguration (dict) –

    [REQUIRED]

    Configures the physical storage of ingested data in a knowledge base.

    • type (string) – [REQUIRED]

      The storage type of a knowledge base.

    • opensearchServerlessConfiguration (dict) –

      Contains the configurations to use OpenSearch Serverless to store knowledge base data.

      • collectionArn (string) – [REQUIRED]

        Arn of an OpenSearch Serverless collection.

      • vectorIndexName (string) – [REQUIRED]

        Arn of an OpenSearch Serverless index.

      • fieldMapping (dict) – [REQUIRED]

        A mapping of Bedrock Knowledge Base fields to OpenSearch Serverless field names

        • vectorField (string) – [REQUIRED]

          Name of the field

        • textField (string) – [REQUIRED]

          Name of the field

        • metadataField (string) – [REQUIRED]

          Name of the field

    • pineconeConfiguration (dict) –

      Contains the configurations to use Pinecone to store knowledge base data.

      • connectionString (string) – [REQUIRED]

        Pinecone connection string

      • credentialsSecretArn (string) – [REQUIRED]

        Arn of a SecretsManager Secret.

      • namespace (string) –

        Pinecone namespace

      • fieldMapping (dict) – [REQUIRED]

        A mapping of Bedrock Knowledge Base fields to Pinecone field names

        • textField (string) – [REQUIRED]

          Name of the field

        • metadataField (string) – [REQUIRED]

          Name of the field

    • redisEnterpriseCloudConfiguration (dict) –

      Contains the configurations to use Redis Enterprise Cloud to store knowledge base data.

      • endpoint (string) – [REQUIRED]

        Redis enterprise cloud endpoint

      • vectorIndexName (string) – [REQUIRED]

        Name of a redis enterprise cloud index

      • credentialsSecretArn (string) – [REQUIRED]

        Arn of a SecretsManager Secret.

      • fieldMapping (dict) – [REQUIRED]

        A mapping of Bedrock Knowledge Base fields to Redis Cloud field names

        • vectorField (string) – [REQUIRED]

          Name of the field

        • textField (string) – [REQUIRED]

          Name of the field

        • metadataField (string) – [REQUIRED]

          Name of the field

  • tags (dict) –

    A map of tag keys and values

    • (string) –

      Key of a tag

      • (string) –

        Value of a tag

Return type:

dict

Returns:

Response Syntax

{
    'knowledgeBase': {
        'knowledgeBaseId': 'string',
        'name': 'string',
        'knowledgeBaseArn': 'string',
        'description': 'string',
        'roleArn': 'string',
        'knowledgeBaseConfiguration': {
            'type': 'VECTOR',
            'vectorKnowledgeBaseConfiguration': {
                'embeddingModelArn': 'string'
            }
        },
        'storageConfiguration': {
            'type': 'OPENSEARCH_SERVERLESS'|'PINECONE'|'REDIS_ENTERPRISE_CLOUD',
            'opensearchServerlessConfiguration': {
                'collectionArn': 'string',
                'vectorIndexName': 'string',
                'fieldMapping': {
                    'vectorField': 'string',
                    'textField': 'string',
                    'metadataField': 'string'
                }
            },
            'pineconeConfiguration': {
                'connectionString': 'string',
                'credentialsSecretArn': 'string',
                'namespace': 'string',
                'fieldMapping': {
                    'textField': 'string',
                    'metadataField': 'string'
                }
            },
            'redisEnterpriseCloudConfiguration': {
                'endpoint': 'string',
                'vectorIndexName': 'string',
                'credentialsSecretArn': 'string',
                'fieldMapping': {
                    'vectorField': 'string',
                    'textField': 'string',
                    'metadataField': 'string'
                }
            }
        },
        'status': 'CREATING'|'ACTIVE'|'DELETING'|'UPDATING'|'FAILED',
        'createdAt': datetime(2015, 1, 1),
        'updatedAt': datetime(2015, 1, 1),
        'failureReasons': [
            'string',
        ]
    }
}

Response Structure

  • (dict) –

    • knowledgeBase (dict) –

      Contains the information of a knowledge base.

      • knowledgeBaseId (string) –

        Identifier for a resource.

      • name (string) –

        Name for a resource.

      • knowledgeBaseArn (string) –

        ARN of a KnowledgeBase

      • description (string) –

        Description of the Resource.

      • roleArn (string) –

        ARN of a IAM role.

      • knowledgeBaseConfiguration (dict) –

        Configures a bedrock knowledge base.

        • type (string) –

          The type of a knowledge base.

        • vectorKnowledgeBaseConfiguration (dict) –

          Configurations for a vector knowledge base.

          • embeddingModelArn (string) –

            Arn of a Bedrock model.

      • storageConfiguration (dict) –

        Configures the physical storage of ingested data in a knowledge base.

        • type (string) –

          The storage type of a knowledge base.

        • opensearchServerlessConfiguration (dict) –

          Contains the configurations to use OpenSearch Serverless to store knowledge base data.

          • collectionArn (string) –

            Arn of an OpenSearch Serverless collection.

          • vectorIndexName (string) –

            Arn of an OpenSearch Serverless index.

          • fieldMapping (dict) –

            A mapping of Bedrock Knowledge Base fields to OpenSearch Serverless field names

            • vectorField (string) –

              Name of the field

            • textField (string) –

              Name of the field

            • metadataField (string) –

              Name of the field

        • pineconeConfiguration (dict) –

          Contains the configurations to use Pinecone to store knowledge base data.

          • connectionString (string) –

            Pinecone connection string

          • credentialsSecretArn (string) –

            Arn of a SecretsManager Secret.

          • namespace (string) –

            Pinecone namespace

          • fieldMapping (dict) –

            A mapping of Bedrock Knowledge Base fields to Pinecone field names

            • textField (string) –

              Name of the field

            • metadataField (string) –

              Name of the field

        • redisEnterpriseCloudConfiguration (dict) –

          Contains the configurations to use Redis Enterprise Cloud to store knowledge base data.

          • endpoint (string) –

            Redis enterprise cloud endpoint

          • vectorIndexName (string) –

            Name of a redis enterprise cloud index

          • credentialsSecretArn (string) –

            Arn of a SecretsManager Secret.

          • fieldMapping (dict) –

            A mapping of Bedrock Knowledge Base fields to Redis Cloud field names

            • vectorField (string) –

              Name of the field

            • textField (string) –

              Name of the field

            • metadataField (string) –

              Name of the field

      • status (string) –

        The status of a knowledge base.

      • createdAt (datetime) –

        Time Stamp.

      • updatedAt (datetime) –

        Time Stamp.

      • failureReasons (list) –

        Failure Reasons for Error.

        • (string) –

          Failure Reason for Error.

Exceptions

  • AgentsforBedrock.Client.exceptions.ThrottlingException

  • AgentsforBedrock.Client.exceptions.AccessDeniedException

  • AgentsforBedrock.Client.exceptions.ValidationException

  • AgentsforBedrock.Client.exceptions.InternalServerException

  • AgentsforBedrock.Client.exceptions.ConflictException

  • AgentsforBedrock.Client.exceptions.ServiceQuotaExceededException