WOLBΛRG

Example — PDF Memory

Ingest a text-layer PDF into chunked memories.

npm install pdf-parse@1.1.4
import { Wolbarg, sqlite, openaiEmbedding } from "wolbarg";

const ctx = new Wolbarg({
  organization: "demo",
  storage: sqlite("./memory.db"),
  embedding: openaiEmbedding({
    apiKey: process.env.OPENAI_API_KEY!,
    model: "text-embedding-3-small",
  }),
});

await ctx.ingest({
  agent: "docs",
  source: { path: "./handbook.pdf" },
  chunking: { strategy: "paragraph", chunkSize: 900, overlap: 100 },
  metadata: { collection: "handbook" },
});

On this page