Learn — store knowledge

Learn by storing, updating, and deleting knowledge objects addressed by collection and id.

TypeScript
await knowledge.store({
  collection: "transactions",
  type: "transaction",
  id: "TXN-001",
  content: {
    customer_id: "CUS-1022",
    amount: 5000,
    currency: "NGN",
    status: "failed",
    reason: "insufficient_funds",
  },
});

Maps to POST /memory/v1/store.

Bulk store#

TypeScript
await knowledge.storeMany({
  collection: "transactions",
  items: [
    { id: "TXN-002", content: { amount: 100 } },
    { id: "TXN-003", content: { amount: 200 } },
  ],
});

Maps to POST /memory/v1/store-many.

Get#

TypeScript
await knowledge.get({
  collection: "transactions",
  id: "TXN-001",
});

Maps to POST /memory/v1/get.

Update#

Content keys are shallow-merged into the existing object.

TypeScript
await knowledge.update({
  collection: "transactions",
  id: "TXN-001",
  content: {
    status: "resolved",
  },
});

Maps to POST /memory/v1/update.

Delete#

TypeScript
await knowledge.delete({
  collection: "transactions",
  id: "TXN-001",
});

Maps to POST /memory/v1/delete (mode: "soft" default, or "permanent").