knowledge_bases
Creates, updates, deletes, gets or lists a knowledge_bases resource.
Overview
| Name | knowledge_bases |
| Type | Resource |
| Id | aws.bedrock_agent.knowledge_bases |
Fields
The following fields are returned by SELECT queries:
- get_knowledge_base
- list_knowledge_bases
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the knowledge base. (pattern: <code>([0-9a-zA-Z][_-]?){1,100}</code>) |
created_at | string (date-time) | The time the knowledge base was created. |
description | string | The description of the knowledge base. |
failure_reasons | array | A list of reasons that the API operation on the knowledge base failed. |
knowledge_base_arn | string | The Amazon Resource Name (ARN) of the knowledge base. (pattern: <code>arn:aws(|-cn|-us-gov):bedrock:[a-zA-Z0-9-]*:[0-9]{12}:knowledge-base/[0-9a-zA-Z]+</code>) |
knowledge_base_configuration | object | Contains details about the vector embeddings configuration of the knowledge base. |
knowledge_base_id | string | The unique identifier of the knowledge base. (pattern: <code>[0-9a-zA-Z]{10}</code>) |
role_arn | string | The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the knowledge base. (pattern: <code>arn:aws(-[^:]+)?:iam::([0-9]{12})?:role/.+</code>) |
status | string | The status of the knowledge base. The following statuses are possible: CREATING – The knowledge base is being created. ACTIVE – The knowledge base is ready to be queried. DELETING – The knowledge base is being deleted. UPDATING – The knowledge base is being updated. FAILED – The knowledge base API operation failed. (CREATING, ACTIVE, DELETING, UPDATING, FAILED, DELETE_UNSUCCESSFUL, UPDATE_UNSUCCESSFUL) |
storage_configuration | object | Contains the storage configuration of the knowledge base. |
updated_at | string (date-time) | The time the knowledge base was last updated. |
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the knowledge base. (pattern: <code>([0-9a-zA-Z][_-]?){1,100}</code>) |
description | string | The description of the knowledge base. |
knowledge_base_id | string | The unique identifier of the knowledge base. (pattern: <code>[0-9a-zA-Z]{10}</code>) |
status | string | The status of the knowledge base. (CREATING, ACTIVE, DELETING, UPDATING, FAILED, DELETE_UNSUCCESSFUL, UPDATE_UNSUCCESSFUL) |
updated_at | string (date-time) | The time the knowledge base was last updated. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_knowledge_base | select | knowledge_base_id, region | Gets information about a knowledge base. | |
list_knowledge_bases | select | region | Lists the knowledge bases in an account. The list also includesinformation about each knowledge base. | |
create_knowledge_base | insert | region, name, roleArn, knowledgeBaseConfiguration | 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. To create a managed knowledge base, provide a managedKnowledgeBaseConfiguration during creation. For more information, see Build a managed 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. For managed knowledge bases, set embeddingModelType to MANAGED to use the service-managed embedding model, or CUSTOM with an embeddingModelArn to use your own. To use your own KMS key for encryption, provide the ARN in serverSideEncryptionConfiguration. No vector store configuration is required for managed knowledge bases. For self-managed knowledge bases, provide the embedding model to use in the embeddingModelArn field in the knowledgeBaseConfiguration object. For self-managed knowledge bases, provide the configuration for your vector store in the storageConfiguration object. For an Amazon OpenSearch Service database, use the opensearchServerlessConfiguration object. For more information, see Create a vector store in Amazon OpenSearch Service. For an Amazon Aurora database, use the RdsConfiguration object. For more information, see Create a vector store in Amazon Aurora. For a Pinecone database, use the pineconeConfiguration object. For more information, see Create a vector store in Pinecone. For a Redis Enterprise Cloud database, use the redisEnterpriseCloudConfiguration object. For more information, see Create a vector store in Redis Enterprise Cloud. | |
update_knowledge_base | update | knowledge_base_id, region, name, roleArn, knowledgeBaseConfiguration | Updates the configuration of a knowledge base with the fields that you specify. Because all fields will be overwritten, you must include the same values for fields that you want to keep the same. You can change the following fields: name description roleArn You can't change the knowledgeBaseConfiguration or storageConfiguration fields, so you must specify the same configurations as when you created the knowledge base. You can send a GetKnowledgeBase request and copy the same configurations. | |
delete_knowledge_base | delete | knowledge_base_id, region | Deletes a knowledge base. Before deleting a knowledge base, you should disassociate the knowledge base from any agents that it is associated with by making a DisassociateAgentKnowledgeBase request. | |
start_ingestion_job | exec | knowledge_base_id, data_source_id, region | Begins a data ingestion job. Data sources are ingested into your knowledge base so that Large Language Models (LLMs) can use your data. | |
stop_ingestion_job | exec | knowledge_base_id, data_source_id, ingestion_job_id, region | Stops a currently running data ingestion job. You can send a StartIngestionJob request again to ingest the rest of your data when you are ready. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
data_source_id | string | The unique identifier of the data source for the data ingestion job you want to stop. |
ingestion_job_id | string | The unique identifier of the data ingestion job you want to stop. |
knowledge_base_id | string | The unique identifier of the knowledge base for the data ingestion job you want to stop. |
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_knowledge_base
- list_knowledge_bases
Gets information about a knowledge base.
SELECT
name,
created_at,
description,
failure_reasons,
knowledge_base_arn,
knowledge_base_configuration,
knowledge_base_id,
role_arn,
status,
storage_configuration,
updated_at
FROM aws.bedrock_agent.knowledge_bases
WHERE knowledge_base_id = '{{ knowledge_base_id }}' -- required
AND region = '{{ region }}' -- required
;
Lists the knowledge bases in an account. The list also includesinformation about each knowledge base.
SELECT
name,
description,
knowledge_base_id,
status,
updated_at
FROM aws.bedrock_agent.knowledge_bases
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_knowledge_base
- Manifest
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. To create a managed knowledge base, provide a managedKnowledgeBaseConfiguration during creation. For more information, see Build a managed 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. For managed knowledge bases, set embeddingModelType to MANAGED to use the service-managed embedding model, or CUSTOM with an embeddingModelArn to use your own. To use your own KMS key for encryption, provide the ARN in serverSideEncryptionConfiguration. No vector store configuration is required for managed knowledge bases. For self-managed knowledge bases, provide the embedding model to use in the embeddingModelArn field in the knowledgeBaseConfiguration object. For self-managed knowledge bases, provide the configuration for your vector store in the storageConfiguration object. For an Amazon OpenSearch Service database, use the opensearchServerlessConfiguration object. For more information, see Create a vector store in Amazon OpenSearch Service. For an Amazon Aurora database, use the RdsConfiguration object. For more information, see Create a vector store in Amazon Aurora. For a Pinecone database, use the pineconeConfiguration object. For more information, see Create a vector store in Pinecone. For a Redis Enterprise Cloud database, use the redisEnterpriseCloudConfiguration object. For more information, see Create a vector store in Redis Enterprise Cloud.
INSERT INTO aws.bedrock_agent.knowledge_bases (
clientToken,
name,
description,
roleArn,
knowledgeBaseConfiguration,
storageConfiguration,
tags,
region
)
SELECT
'{{ clientToken }}',
'{{ name }}' /* required */,
'{{ description }}',
'{{ roleArn }}' /* required */,
'{{ knowledgeBaseConfiguration }}' /* required */,
'{{ storageConfiguration }}',
'{{ tags }}',
'{{ region }}'
RETURNING
knowledge_base
;
# Description fields are for documentation purposes
- name: knowledge_bases
props:
- name: region
value: "{{ region }}"
description: Required parameter for the knowledge_bases resource.
- name: clientToken
value: "{{ clientToken }}"
- name: name
value: "{{ name }}"
- name: description
value: "{{ description }}"
- name: roleArn
value: "{{ roleArn }}"
- name: knowledgeBaseConfiguration
description: |
Contains details about the vector embeddings configuration of the knowledge base.
value:
type_: "{{ type_ }}"
vectorKnowledgeBaseConfiguration:
embeddingModelArn: "{{ embeddingModelArn }}"
embeddingModelConfiguration:
bedrockEmbeddingModelConfiguration:
dimensions: {{ dimensions }}
embeddingDataType: "{{ embeddingDataType }}"
audio:
- segmentationConfiguration:
fixedLengthDuration: {{ fixedLengthDuration }}
video:
- segmentationConfiguration:
fixedLengthDuration: {{ fixedLengthDuration }}
supplementalDataStorageConfiguration:
storageLocations:
- type_: "{{ type_ }}"
s3Location:
uri: "{{ uri }}"
managedKnowledgeBaseConfiguration:
embeddingModelType: "{{ embeddingModelType }}"
embeddingModelArn: "{{ embeddingModelArn }}"
embeddingModelConfiguration:
bedrockEmbeddingModelConfiguration:
dimensions: {{ dimensions }}
embeddingDataType: "{{ embeddingDataType }}"
audio:
- segmentationConfiguration:
fixedLengthDuration: {{ fixedLengthDuration }}
video:
- segmentationConfiguration:
fixedLengthDuration: {{ fixedLengthDuration }}
serverSideEncryptionConfiguration:
kmsKeyArn: "{{ kmsKeyArn }}"
kendraKnowledgeBaseConfiguration:
kendraIndexArn: "{{ kendraIndexArn }}"
sqlKnowledgeBaseConfiguration:
type_: "{{ type_ }}"
redshiftConfiguration:
storageConfigurations:
- type_: "{{ type_ }}"
awsDataCatalogConfiguration:
tableNames: "{{ tableNames }}"
redshiftConfiguration:
databaseName: "{{ databaseName }}"
queryEngineConfiguration:
type_: "{{ type_ }}"
serverlessConfiguration:
workgroupArn: "{{ workgroupArn }}"
authConfiguration: "{{ authConfiguration }}"
provisionedConfiguration:
clusterIdentifier: "{{ clusterIdentifier }}"
authConfiguration: "{{ authConfiguration }}"
queryGenerationConfiguration:
executionTimeoutSeconds: {{ executionTimeoutSeconds }}
generationContext:
tables: "{{ tables }}"
curatedQueries: "{{ curatedQueries }}"
- name: storageConfiguration
description: |
Contains the storage configuration of the knowledge base.
value:
type_: "{{ type_ }}"
opensearchServerlessConfiguration:
collectionArn: "{{ collectionArn }}"
vectorIndexName: "{{ vectorIndexName }}"
fieldMapping:
vectorField: "{{ vectorField }}"
textField: "{{ textField }}"
metadataField: "{{ metadataField }}"
opensearchManagedClusterConfiguration:
domainEndpoint: "{{ domainEndpoint }}"
domainArn: "{{ domainArn }}"
vectorIndexName: "{{ vectorIndexName }}"
fieldMapping:
vectorField: "{{ vectorField }}"
textField: "{{ textField }}"
metadataField: "{{ metadataField }}"
pineconeConfiguration:
connectionString: "{{ connectionString }}"
credentialsSecretArn: "{{ credentialsSecretArn }}"
namespace: "{{ namespace }}"
fieldMapping:
textField: "{{ textField }}"
metadataField: "{{ metadataField }}"
redisEnterpriseCloudConfiguration:
endpoint: "{{ endpoint }}"
vectorIndexName: "{{ vectorIndexName }}"
credentialsSecretArn: "{{ credentialsSecretArn }}"
fieldMapping:
vectorField: "{{ vectorField }}"
textField: "{{ textField }}"
metadataField: "{{ metadataField }}"
rdsConfiguration:
resourceArn: "{{ resourceArn }}"
credentialsSecretArn: "{{ credentialsSecretArn }}"
databaseName: "{{ databaseName }}"
tableName: "{{ tableName }}"
fieldMapping:
primaryKeyField: "{{ primaryKeyField }}"
vectorField: "{{ vectorField }}"
textField: "{{ textField }}"
metadataField: "{{ metadataField }}"
customMetadataField: "{{ customMetadataField }}"
mongoDbAtlasConfiguration:
endpoint: "{{ endpoint }}"
databaseName: "{{ databaseName }}"
collectionName: "{{ collectionName }}"
vectorIndexName: "{{ vectorIndexName }}"
credentialsSecretArn: "{{ credentialsSecretArn }}"
fieldMapping:
vectorField: "{{ vectorField }}"
textField: "{{ textField }}"
metadataField: "{{ metadataField }}"
endpointServiceName: "{{ endpointServiceName }}"
textIndexName: "{{ textIndexName }}"
neptuneAnalyticsConfiguration:
graphArn: "{{ graphArn }}"
fieldMapping:
textField: "{{ textField }}"
metadataField: "{{ metadataField }}"
s3VectorsConfiguration:
vectorBucketArn: "{{ vectorBucketArn }}"
indexArn: "{{ indexArn }}"
indexName: "{{ indexName }}"
- name: tags
value: "{{ tags }}"
UPDATE examples
- update_knowledge_base
Updates the configuration of a knowledge base with the fields that you specify. Because all fields will be overwritten, you must include the same values for fields that you want to keep the same. You can change the following fields: name description roleArn You can't change the knowledgeBaseConfiguration or storageConfiguration fields, so you must specify the same configurations as when you created the knowledge base. You can send a GetKnowledgeBase request and copy the same configurations.
UPDATE aws.bedrock_agent.knowledge_bases
SET
name = '{{ name }}',
description = '{{ description }}',
roleArn = '{{ roleArn }}',
knowledgeBaseConfiguration = '{{ knowledgeBaseConfiguration }}',
storageConfiguration = '{{ storageConfiguration }}'
WHERE
knowledge_base_id = '{{ knowledge_base_id }}' --required
AND region = '{{ region }}' --required
AND name = '{{ name }}' --required
AND roleArn = '{{ roleArn }}' --required
AND knowledgeBaseConfiguration = '{{ knowledgeBaseConfiguration }}' --required
RETURNING
knowledge_base;
DELETE examples
- delete_knowledge_base
Deletes a knowledge base. Before deleting a knowledge base, you should disassociate the knowledge base from any agents that it is associated with by making a DisassociateAgentKnowledgeBase request.
DELETE FROM aws.bedrock_agent.knowledge_bases
WHERE knowledge_base_id = '{{ knowledge_base_id }}' --required
AND region = '{{ region }}' --required
;
Lifecycle Methods
- start_ingestion_job
- stop_ingestion_job
Begins a data ingestion job. Data sources are ingested into your knowledge base so that Large Language Models (LLMs) can use your data.
EXEC aws.bedrock_agent.knowledge_bases.start_ingestion_job
@knowledge_base_id='{{ knowledge_base_id }}' --required,
@data_source_id='{{ data_source_id }}' --required,
@region='{{ region }}' --required
@@json=
'{
"clientToken": "{{ clientToken }}",
"description": "{{ description }}"
}'
;
Stops a currently running data ingestion job. You can send a StartIngestionJob request again to ingest the rest of your data when you are ready.
EXEC aws.bedrock_agent.knowledge_bases.stop_ingestion_job
@knowledge_base_id='{{ knowledge_base_id }}' --required,
@data_source_id='{{ data_source_id }}' --required,
@ingestion_job_id='{{ ingestion_job_id }}' --required,
@region='{{ region }}' --required
;