Skip to main content

Syntax

api.upsertKnowledgeSource(params)

Description

Creates or updates a Knowledge Source in a Knowledge Store. Use upsertKnowledgeSource in Knowledge Connectors to allow knowledge synchronization. The API compares externalIdentifier, chunkCount, and contentHashOrTimestamp to detect changes to the external source. If there are any changes, the Knowledge Source and the relative Knowledge Chunks are updated in Cognigy.AI. Parameters:
  • params: UpsertKnowledgeSourceParams — configuration object. The object contains the following parameters:
Returns: Promise<{ knowledgeSourceId: string, ... } | null> — resolves to the Knowledge Source when changes to the external source are detected and Knowledge Chunks need to be updated, or null when there are no changes, however, in this case the description and Source Tags are still updated.

Example

The following Knowledge Connector uses upsertKnowledgeSource to create or update a source, then adds Knowledge Chunks when the source is returned:
Last modified on April 21, 2026