Example — Basic Memory
Minimal remember and recall with SQLite and OpenAI embeddings.
What is it?
The smallest working Wolbarg program.
Example usage
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.remember({
agent: "assistant",
content: { text: "The deploy window is Fridays at 16:00 UTC." },
});
const hits = await ctx.recall({ query: "when can we deploy?", topK: 3 });
console.log(hits[0]?.content.text);
await ctx.close();