Skip to main content

knowledge_base_documents

Creates, updates, deletes, gets or lists a knowledge_base_documents resource.

Overview

Nameknowledge_base_documents
TypeResource
Idaws.bedrock_agent.knowledge_base_documents

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
document_detailsarrayA list of objects, each of which contains information about the documents that were retrieved.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_knowledge_base_documentsselectknowledge_base_id, data_source_id, regionRetrieves specific documents from a data source that is connected to a knowledge base. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.
list_knowledge_base_documentsselectknowledge_base_id, data_source_id, regionRetrieves all the documents contained in a data source that is connected to a knowledge base. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.
delete_knowledge_base_documentsdeleteknowledge_base_id, data_source_id, regionDeletes documents from a data source and syncs the changes to the knowledge base that is connected to it. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.
ingest_knowledge_base_documentsexecknowledge_base_id, data_source_id, region, documentsIngests documents directly into the knowledge base that is connected to the data source. The dataSourceType specified in the content for each document must match the type of the data source that you specify in the header. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.

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.

NameDatatypeDescription
data_source_idstringThe unique identifier of the data source connected to the knowledge base that you're adding documents to.
knowledge_base_idstringThe unique identifier of the knowledge base to ingest the documents into.
regionstringAWS region (default: us-east-1)

SELECT examples

Retrieves specific documents from a data source that is connected to a knowledge base. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.

SELECT
document_details
FROM aws.bedrock_agent.knowledge_base_documents
WHERE knowledge_base_id = '{{ knowledge_base_id }}' -- required
AND data_source_id = '{{ data_source_id }}' -- required
AND region = '{{ region }}' -- required
;

DELETE examples

Deletes documents from a data source and syncs the changes to the knowledge base that is connected to it. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.

DELETE FROM aws.bedrock_agent.knowledge_base_documents
WHERE knowledge_base_id = '{{ knowledge_base_id }}' --required
AND data_source_id = '{{ data_source_id }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Ingests documents directly into the knowledge base that is connected to the data source. The dataSourceType specified in the content for each document must match the type of the data source that you specify in the header. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.

EXEC aws.bedrock_agent.knowledge_base_documents.ingest_knowledge_base_documents
@knowledge_base_id='{{ knowledge_base_id }}' --required,
@data_source_id='{{ data_source_id }}' --required,
@region='{{ region }}' --required
@@json=
'{
"clientToken": "{{ clientToken }}",
"documents": "{{ documents }}"
}'
;