Knowledge & Documents
Ground answers persistently or analyze one temporary PDF.
#Persistent Knowledge
import { readFile } from "node:fs/promises";
const source = await elektric.knowledge.add({ file: await readFile("handbook.md"), name:"handbook.md", mediaType:"text/markdown" });
let current = source;
while (current.status === "processing") {
await new Promise(resolve => setTimeout(resolve, 2000));
current = await elektric.knowledge.get({ sourceId: source.id });
}
const answer = await elektric.chat({ userId:"user_123", conversationId:"handbook_1", message:"Summarize the vacation policy." });
console.log(answer.message);#Source lifecycle
Sources move through processing, ready, failed, or deleting. Deletion removes provider items before metadata.
#Temporary documents
Upload one PDF and reference its file ID in chat. Temporary files expire after one hour; each project may have 100 live files.
#Choose between them
Use Knowledge for shared material and Document Understanding for a temporary attachment.
Authentication →Standard errors →Pricing & Billing →Limits →