- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateKnowledgeBaseCommand
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.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { QConnectClient, CreateKnowledgeBaseCommand } from "@aws-sdk/client-qconnect"; // ES Modules import
// const { QConnectClient, CreateKnowledgeBaseCommand } = require("@aws-sdk/client-qconnect"); // CommonJS import
const client = new QConnectClient(config);
const input = { // CreateKnowledgeBaseRequest
clientToken: "STRING_VALUE",
name: "STRING_VALUE", // required
knowledgeBaseType: "STRING_VALUE", // required
sourceConfiguration: { // SourceConfiguration Union: only one key present
appIntegrations: { // AppIntegrationsConfiguration
appIntegrationArn: "STRING_VALUE", // required
objectFields: [ // ObjectFieldsList
"STRING_VALUE",
],
},
managedSourceConfiguration: { // ManagedSourceConfiguration Union: only one key present
webCrawlerConfiguration: { // WebCrawlerConfiguration
urlConfiguration: { // UrlConfiguration
seedUrls: [ // SeedUrls
{ // SeedUrl
url: "STRING_VALUE",
},
],
},
crawlerLimits: { // WebCrawlerLimits
rateLimit: Number("int"),
},
inclusionFilters: [ // UrlFilterList
"STRING_VALUE",
],
exclusionFilters: [
"STRING_VALUE",
],
scope: "STRING_VALUE",
},
},
},
renderingConfiguration: { // RenderingConfiguration
templateUri: "STRING_VALUE",
},
vectorIngestionConfiguration: { // VectorIngestionConfiguration
chunkingConfiguration: { // ChunkingConfiguration
chunkingStrategy: "STRING_VALUE", // required
fixedSizeChunkingConfiguration: { // FixedSizeChunkingConfiguration
maxTokens: Number("int"), // required
overlapPercentage: Number("int"), // required
},
hierarchicalChunkingConfiguration: { // HierarchicalChunkingConfiguration
levelConfigurations: [ // HierarchicalChunkingLevelConfigurations // required
{ // HierarchicalChunkingLevelConfiguration
maxTokens: Number("int"), // required
},
],
overlapTokens: Number("int"), // required
},
semanticChunkingConfiguration: { // SemanticChunkingConfiguration
maxTokens: Number("int"), // required
bufferSize: Number("int"), // required
breakpointPercentileThreshold: Number("int"), // required
},
},
parsingConfiguration: { // ParsingConfiguration
parsingStrategy: "STRING_VALUE", // required
bedrockFoundationModelConfiguration: { // BedrockFoundationModelConfigurationForParsing
modelArn: "STRING_VALUE", // required
parsingPrompt: { // ParsingPrompt
parsingPromptText: "STRING_VALUE", // required
},
},
},
},
serverSideEncryptionConfiguration: { // ServerSideEncryptionConfiguration
kmsKeyId: "STRING_VALUE",
},
description: "STRING_VALUE",
tags: { // Tags
"<keys>": "STRING_VALUE",
},
};
const command = new CreateKnowledgeBaseCommand(input);
const response = await client.send(command);
// { // CreateKnowledgeBaseResponse
// knowledgeBase: { // KnowledgeBaseData
// knowledgeBaseId: "STRING_VALUE", // required
// knowledgeBaseArn: "STRING_VALUE", // required
// name: "STRING_VALUE", // required
// knowledgeBaseType: "STRING_VALUE", // required
// status: "STRING_VALUE", // required
// lastContentModificationTime: new Date("TIMESTAMP"),
// vectorIngestionConfiguration: { // VectorIngestionConfiguration
// chunkingConfiguration: { // ChunkingConfiguration
// chunkingStrategy: "STRING_VALUE", // required
// fixedSizeChunkingConfiguration: { // FixedSizeChunkingConfiguration
// maxTokens: Number("int"), // required
// overlapPercentage: Number("int"), // required
// },
// hierarchicalChunkingConfiguration: { // HierarchicalChunkingConfiguration
// levelConfigurations: [ // HierarchicalChunkingLevelConfigurations // required
// { // HierarchicalChunkingLevelConfiguration
// maxTokens: Number("int"), // required
// },
// ],
// overlapTokens: Number("int"), // required
// },
// semanticChunkingConfiguration: { // SemanticChunkingConfiguration
// maxTokens: Number("int"), // required
// bufferSize: Number("int"), // required
// breakpointPercentileThreshold: Number("int"), // required
// },
// },
// parsingConfiguration: { // ParsingConfiguration
// parsingStrategy: "STRING_VALUE", // required
// bedrockFoundationModelConfiguration: { // BedrockFoundationModelConfigurationForParsing
// modelArn: "STRING_VALUE", // required
// parsingPrompt: { // ParsingPrompt
// parsingPromptText: "STRING_VALUE", // required
// },
// },
// },
// },
// sourceConfiguration: { // SourceConfiguration Union: only one key present
// appIntegrations: { // AppIntegrationsConfiguration
// appIntegrationArn: "STRING_VALUE", // required
// objectFields: [ // ObjectFieldsList
// "STRING_VALUE",
// ],
// },
// managedSourceConfiguration: { // ManagedSourceConfiguration Union: only one key present
// webCrawlerConfiguration: { // WebCrawlerConfiguration
// urlConfiguration: { // UrlConfiguration
// seedUrls: [ // SeedUrls
// { // SeedUrl
// url: "STRING_VALUE",
// },
// ],
// },
// crawlerLimits: { // WebCrawlerLimits
// rateLimit: Number("int"),
// },
// inclusionFilters: [ // UrlFilterList
// "STRING_VALUE",
// ],
// exclusionFilters: [
// "STRING_VALUE",
// ],
// scope: "STRING_VALUE",
// },
// },
// },
// renderingConfiguration: { // RenderingConfiguration
// templateUri: "STRING_VALUE",
// },
// serverSideEncryptionConfiguration: { // ServerSideEncryptionConfiguration
// kmsKeyId: "STRING_VALUE",
// },
// description: "STRING_VALUE",
// tags: { // Tags
// "<keys>": "STRING_VALUE",
// },
// ingestionStatus: "STRING_VALUE",
// ingestionFailureReasons: [ // FailureReason
// "STRING_VALUE",
// ],
// },
// };
CreateKnowledgeBaseCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
knowledgeBaseType Required | KnowledgeBaseType | undefined | The type of knowledge base. Only CUSTOM knowledge bases allow you to upload your own content. EXTERNAL knowledge bases support integrations with third-party systems whose content is synchronized automatically. |
name Required | string | undefined | The name of the knowledge base. |
clientToken | string | undefined | A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs . |
description | string | undefined | The description. |
renderingConfiguration | RenderingConfiguration | undefined | Information about how to render the content. |
serverSideEncryptionConfiguration | ServerSideEncryptionConfiguration | undefined | The configuration information for the customer managed key used for encryption. This KMS key must have a policy that allows For more information about setting up a customer managed key for Amazon Q in Connect, see Enable Amazon Q in Connect for your instance . |
sourceConfiguration | SourceConfiguration | undefined | The source of the knowledge base content. Only set this argument for EXTERNAL or Managed knowledge bases. |
tags | Record<string, string> | undefined | The tags used to organize, track, or control access for this resource. |
vectorIngestionConfiguration | VectorIngestionConfiguration | undefined | Contains details about how to ingest the documents in a data source. |
CreateKnowledgeBaseCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
knowledgeBase | KnowledgeBaseData | undefined | The knowledge base. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | You do not have sufficient access to perform this action. |
ConflictException | client | The request could not be processed because of conflict in the current state of the resource. For example, if you're using a |
ServiceQuotaExceededException | client | You've exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use service quotas to request a service quota increase. |
ValidationException | client | The input fails to satisfy the constraints specified by a service. |
QConnectServiceException | Base exception class for all service exceptions from QConnect service. |