Documentation Index
Fetch the complete documentation index at: https://docs.cognigy.com/llms.txt
Use this file to discover all available pages before exploring further.
Syntax
api.upsertKnowledgeSource(params)
Description
Creates or updates a Knowledge Source in a Knowledge Store. UseupsertKnowledgeSource 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | String | Yes | The name of the Knowledge Source. |
description | String | No | A description of the Knowledge Source. |
tags | Array | No | Source Tags associated with the Knowledge Source, used to filter searches. |
chunkCount | Number | Yes | The number of Knowledge Chunks in the Knowledge Source. |
contentHashOrTimestamp | String | Yes | Used to detect content changes, for example, with a SHA-256 hash. If it changes, the Knowledge Source and the relative Knowledge Chunks are updated. |
externalIdentifier | String | No | Stable identifier for the Knowledge Source. The default value is the Knowledge Source name. |
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 usesupsertKnowledgeSource to create or update a source, then adds Knowledge Chunks when the source is returned: