From 90a7b1afa013466a107b90b03bad235c8c221908 Mon Sep 17 00:00:00 2001 From: Saket Aryan Date: Sat, 10 Jan 2026 21:19:55 +0530 Subject: [PATCH] feat(ts-sdk): add support for keyword arguments in add and search methods (#3895) --- docs/changelog.mdx | 7 +++++++ docs/core-concepts/memory-operations/add.mdx | 3 +-- mem0-ts/package.json | 2 +- mem0-ts/src/client/mem0.ts | 7 +++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/changelog.mdx b/docs/changelog.mdx index 149788636..369813d0c 100644 --- a/docs/changelog.mdx +++ b/docs/changelog.mdx @@ -682,6 +682,13 @@ mode: "wide" + + +**Improvements:** +- **Client:** Added support for keyword arguments in `add` and `search` methods, allowing additional properties beyond defined options for experimental features + + + **New Features:** diff --git a/docs/core-concepts/memory-operations/add.mdx b/docs/core-concepts/memory-operations/add.mdx index e20086327..0dcfcad32 100644 --- a/docs/core-concepts/memory-operations/add.mdx +++ b/docs/core-concepts/memory-operations/add.mdx @@ -83,8 +83,7 @@ const messages = [ { role: "assistant", content: "Great! I’ll remember that for future suggestions." } ]; -await client.add({ - messages, +await client.add(messages, { user_id: "alice", version: "v2", }); diff --git a/mem0-ts/package.json b/mem0-ts/package.json index 7f47def4f..32d9323bf 100644 --- a/mem0-ts/package.json +++ b/mem0-ts/package.json @@ -1,6 +1,6 @@ { "name": "mem0ai", - "version": "2.2.0", + "version": "2.2.1", "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 a17355aa5..a57e3b0c5 100644 --- a/mem0-ts/src/client/mem0.ts +++ b/mem0-ts/src/client/mem0.ts @@ -213,7 +213,7 @@ export default class MemoryClient { async add( messages: Array, - options: MemoryOptions = {}, + options: MemoryOptions & Record = {}, ): Promise> { if (this.telemetryId === "") await this.ping(); this._validateOrgProject(); @@ -339,7 +339,10 @@ export default class MemoryClient { } } - async search(query: string, options?: SearchOptions): Promise> { + async search( + query: string, + options?: SearchOptions & Record, + ): Promise> { if (this.telemetryId === "") await this.ping(); this._validateOrgProject(); const payloadKeys = Object.keys(options || {});