WOLBΛRG

Example — Hybrid Search

Enable BM25 keyword search and fuse it with semantic recall.

import { Wolbarg, sqlite, openaiEmbedding, bm25 } 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",
  }),
  keywordSearch: bm25(),
});

await ctx.remember({
  agent: "ops",
  content: { text: "Incident INC-2048: Redis failover completed." },
});

const hits = await ctx.recall({
  query: "INC-2048 failover",
  hybrid: { semanticWeight: 0.6, keywordWeight: 0.4 },
});

On this page