WOLBΛRG

Example — Compression

Summarize memories with an LLM via compress().

import { Wolbarg, sqlite, openaiEmbedding, openaiLlm } 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",
  }),
  llm: openaiLlm({
    apiKey: process.env.OPENAI_API_KEY!,
    model: "gpt-4.1-mini",
  }),
});

await ctx.compress({ agent: "research" });

On this page