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" + +**New Features:** +- **Client:** Added `metadata` param to `update` method. + + **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> { + async update( + memoryId: string, + { text, metadata }: { text?: string; metadata?: Record }, + ): Promise> { + 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);