ingest()
Parse documents into chunked semantic memories.
Signature
ingest(options: IngestOptions): Promise<IngestResult>
// source: { path } | { buffer, filename? } | { text }
// chunking?: { strategy, chunkSize, overlap }
// metadata?: Record<string, unknown>Pipeline: parse → OCR/vision (if configured) → chunk → embed (batch) → store (batch transaction).
Dependencies
PDF and DOCX require peers: npm install pdf-parse@1.1.4 · npm install mammoth · npm install tesseract.js for OCR.
Example
await ctx.ingest({
agent: "docs",
source: { path: "./guide.md" },
chunking: { strategy: "markdown", chunkSize: 800, overlap: 100 },
});