Skip to main content

knowledge_bases

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

Overview

Nameknowledge_bases
TypeResource
Idaws.qconnect.knowledge_bases

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the knowledge base. (pattern: <code>[a-zA-Z0-9\s_.,-]+.*</code>)
descriptionstringThe description. (pattern: <code>[a-zA-Z0-9\s_.,-]+.*</code>)
ingestion_failure_reasonsarrayList of failure reasons on ingestion per file.
ingestion_statusstringStatus of ingestion on data source. (SYNC_FAILED, SYNCING_IN_PROGRESS, SYNC_SUCCESS, CREATE_IN_PROGRESS)
knowledge_base_arnstringThe Amazon Resource Name (ARN) of the knowledge base. (pattern: <code>arn:[a-z-]?:wisdom:[a-z0-9-]?:[0-9]{12}:[a-z-]*?/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(?:/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}){0,2}</code>)
knowledge_base_idstringThe identifier of the knowledge base. (pattern: <code>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}</code>)
knowledge_base_typestringThe type of knowledge base. (EXTERNAL, CUSTOM, QUICK_RESPONSES, MESSAGE_TEMPLATES, MANAGED)
last_content_modification_timestring (date-time)An epoch timestamp indicating the most recent content modification inside the knowledge base. If no content exists in a knowledge base, this value is unset.
rendering_configurationobjectInformation about how to render the content.
server_side_encryption_configurationobjectThe configuration information for the customer managed key used for encryption.
source_configurationobjectConfiguration information about the external data source.
statusstringThe status of the knowledge base. (CREATE_IN_PROGRESS, CREATE_FAILED, ACTIVE, DELETE_IN_PROGRESS, DELETE_FAILED, DELETED)
tagsobjectThe tags used to organize, track, or control access for this resource.
vector_ingestion_configurationobjectContains details about how to ingest the documents in a data source.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_knowledge_baseselectknowledge_base_id, regionRetrieves information about the knowledge base.
list_knowledge_basesselectregionnextToken, maxResultsLists the knowledge bases.
create_knowledge_baseinsertregion, name, knowledgeBaseTypeCreates a knowledge base. When using this API, you cannot reuse Amazon AppIntegrations DataIntegrations with external knowledge bases such as Salesforce and ServiceNow. If you do, you'll get an InvalidRequestException error. For example, you're programmatically managing your external knowledge base, and you want to add or remove one of the fields that is being ingested from Salesforce. Do the following: Call DeleteKnowledgeBase. Call DeleteDataIntegration. Call CreateDataIntegration to recreate the DataIntegration or a create different one. Call CreateKnowledgeBase.
update_knowledge_base_template_uriupdateknowledge_base_id, region, templateUriUpdates the template URI of a knowledge base. This is only supported for knowledge bases of type EXTERNAL. Include a single variable in ${variable} format; this interpolated by Amazon Q in Connect using ingested content. For example, if you ingest a Salesforce article, it has an Id value, and you can set the template URI to https:​//myInstanceName.lightning.force.com/lightning/r/Knowledge__kav/${Id}/view.
remove_knowledge_base_template_uriupdateknowledge_base_id, regionRemoves a URI template from a knowledge base.
delete_knowledge_basedeleteknowledge_base_id, regionDeletes the knowledge base. When you use this API to delete an external knowledge base such as Salesforce or ServiceNow, you must also delete the Amazon AppIntegrations DataIntegration. This is because you can't reuse the DataIntegration after it's been associated with an external knowledge base. However, you can delete and recreate it. See DeleteDataIntegration and CreateDataIntegration in the Amazon AppIntegrations API Reference.
start_import_jobexecknowledge_base_id, region, importJobType, uploadIdStart an asynchronous job to import Amazon Q in Connect resources from an uploaded source file. Before calling this API, use StartContentUpload to upload an asset that contains the resource data. For importing Amazon Q in Connect quick responses, you need to upload a csv file including the quick responses. For information about how to format the csv file for importing quick responses, see Import quick responses.

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
knowledge_base_idstringThe identifier of the knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN. For importing Amazon Q in Connect quick responses, this should be a QUICK_RESPONSES type knowledge base.
regionstringAWS region (default: us-east-1)
maxResultsintegerThe maximum number of results to return per page.
nextTokenstringThe token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

SELECT examples

Retrieves information about the knowledge base.

SELECT
name,
description,
ingestion_failure_reasons,
ingestion_status,
knowledge_base_arn,
knowledge_base_id,
knowledge_base_type,
last_content_modification_time,
rendering_configuration,
server_side_encryption_configuration,
source_configuration,
status,
tags,
vector_ingestion_configuration
FROM aws.qconnect.knowledge_bases
WHERE knowledge_base_id = '{{ knowledge_base_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a knowledge base. When using this API, you cannot reuse Amazon AppIntegrations DataIntegrations with external knowledge bases such as Salesforce and ServiceNow. If you do, you'll get an InvalidRequestException error. For example, you're programmatically managing your external knowledge base, and you want to add or remove one of the fields that is being ingested from Salesforce. Do the following: Call DeleteKnowledgeBase. Call DeleteDataIntegration. Call CreateDataIntegration to recreate the DataIntegration or a create different one. Call CreateKnowledgeBase.

INSERT INTO aws.qconnect.knowledge_bases (
clientToken,
name,
knowledgeBaseType,
sourceConfiguration,
renderingConfiguration,
vectorIngestionConfiguration,
serverSideEncryptionConfiguration,
description,
tags,
region
)
SELECT
'{{ clientToken }}',
'{{ name }}' /* required */,
'{{ knowledgeBaseType }}' /* required */,
'{{ sourceConfiguration }}',
'{{ renderingConfiguration }}',
'{{ vectorIngestionConfiguration }}',
'{{ serverSideEncryptionConfiguration }}',
'{{ description }}',
'{{ tags }}',
'{{ region }}'
RETURNING
knowledge_base
;

UPDATE examples

Updates the template URI of a knowledge base. This is only supported for knowledge bases of type EXTERNAL. Include a single variable in ${variable} format; this interpolated by Amazon Q in Connect using ingested content. For example, if you ingest a Salesforce article, it has an Id value, and you can set the template URI to https://myInstanceName.lightning.force.com/lightning/r/Knowledge__kav/*$&#123;Id&#125;*/view.

UPDATE aws.qconnect.knowledge_bases
SET
templateUri = '{{ templateUri }}'
WHERE
knowledge_base_id = '{{ knowledge_base_id }}' --required
AND region = '{{ region }}' --required
AND templateUri = '{{ templateUri }}' --required
RETURNING
knowledge_base;

DELETE examples

Deletes the knowledge base. When you use this API to delete an external knowledge base such as Salesforce or ServiceNow, you must also delete the Amazon AppIntegrations DataIntegration. This is because you can't reuse the DataIntegration after it's been associated with an external knowledge base. However, you can delete and recreate it. See DeleteDataIntegration and CreateDataIntegration in the Amazon AppIntegrations API Reference.

DELETE FROM aws.qconnect.knowledge_bases
WHERE knowledge_base_id = '{{ knowledge_base_id }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Start an asynchronous job to import Amazon Q in Connect resources from an uploaded source file. Before calling this API, use StartContentUpload to upload an asset that contains the resource data. For importing Amazon Q in Connect quick responses, you need to upload a csv file including the quick responses. For information about how to format the csv file for importing quick responses, see Import quick responses.

EXEC aws.qconnect.knowledge_bases.start_import_job
@knowledge_base_id='{{ knowledge_base_id }}' --required,
@region='{{ region }}' --required
@@json=
'{
"importJobType": "{{ importJobType }}",
"uploadId": "{{ uploadId }}",
"clientToken": "{{ clientToken }}",
"metadata": "{{ metadata }}",
"externalSourceConfiguration": "{{ externalSourceConfiguration }}"
}'
;