Skip to main content

Syntax

api.createKnowledgeChunk(params)

Description

Creates a Knowledge Chunks in a Knowledge Source. A Knowledge Chunk is a discrete piece of knowledge containing text and optional Chunk metadata that can be searched and retrieved during AI Agent interactions. Parameters:
  • params: CreateKnowledgeChunkParams — configuration object for the Knowledge Chunk. The object contains the following parameters:
ParameterTypeRequiredDescription
knowledgeSourceIdStringYesThe ID of the Knowledge Source.
textStringYesThe content of the Knowledge Chunk.
dataObjectNoMetadata for the chunk. An object where keys are strings and values can be strings, numbers, or booleans.
Returns: Promise<{}> — a promise that resolves to an empty object when the Knowledge Chunk is created.

Example

await api.createKnowledgeChunk({
    knowledgeSourceId: "ks_abc123def456",
    text: "To reset your password, click 'Forgot Password' on the login page and follow the instructions sent to your email.",
    data: {
        category: "account-management",
        priority: 5,
        lastUpdated: "2025-11-01",
        verified: true
    }
});