Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

feat: Add metadata param to TS-SDK in client.update (#3415)

Saket Aryanf0e8c3f76097
diff --git a/docs/changelog.mdx b/docs/changelog.mdx
index 996a68786..0a03a8a52 100644
--- a/docs/changelog.mdx
+++ b/docs/changelog.mdx
@@ -611,6 +611,11 @@ mode: "wide"
<Tab title="TypeScript">
+<Update label="2025-09-04" description="v2.1.38">
+**New Features:**
+- **Client:** Added `metadata` param to `update` method.
+</Update>
+
<Update label="2025-08-04" description="v2.1.37">
**New Features:**
- **OSS:** Added `RedisCloud` search module check
diff --git a/mem0-ts/package.json b/mem0-ts/package.json
index 161577c69..94c1ecdf1 100644
--- a/mem0-ts/package.json
+++ b/mem0-ts/package.json
@@ -1,6 +1,6 @@
{
"name": "mem0ai",
- "version": "2.1.37",
+ "version": "2.1.38",
"description": "The Memory Layer For Your AI Apps",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
diff --git a/mem0-ts/src/client/mem0.ts b/mem0-ts/src/client/mem0.ts
index 60d3238b2..a17355aa5 100644
--- a/mem0-ts/src/client/mem0.ts
+++ b/mem0-ts/src/client/mem0.ts
@@ -251,11 +251,19 @@ export default class MemoryClient {
return response;
}
- async update(memoryId: string, message: string): Promise<Array<Memory>> {
+ async update(
+ memoryId: string,
+ { text, metadata }: { text?: string; metadata?: Record<string, any> },
+ ): Promise<Array<Memory>> {
+ if (text === undefined && metadata === undefined) {
+ throw new Error("Either text or metadata must be provided for update.");
+ }
+
if (this.telemetryId === "") await this.ping();
this._validateOrgProject();
const payload = {
- text: message,
+ text: text,
+ metadata: metadata,
};
const payloadKeys = Object.keys(payload);