feat(ts-sdk): add support for keyword arguments in add and search methods (#3895)

This commit is contained in:
Saket Aryan
2026-01-10 21:19:55 +05:30
committed by GitHub
parent 69a552d8a8
commit 90a7b1afa0
4 changed files with 14 additions and 5 deletions
+7
View File
@@ -682,6 +682,13 @@ mode: "wide"
<Tab title="TypeScript">
<Update label="2025-12-30" description="v2.2.1">
**Improvements:**
- **Client:** Added support for keyword arguments in `add` and `search` methods, allowing additional properties beyond defined options for experimental features
</Update>
<Update label="2025-12-29" description="v2.2.0">
**New Features:**
+1 -2
View File
@@ -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",
});
+1 -1
View File
@@ -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",
+5 -2
View File
@@ -213,7 +213,7 @@ export default class MemoryClient {
async add(
messages: Array<Message>,
options: MemoryOptions = {},
options: MemoryOptions & Record<string, any> = {},
): Promise<Array<Memory>> {
if (this.telemetryId === "") await this.ping();
this._validateOrgProject();
@@ -339,7 +339,10 @@ export default class MemoryClient {
}
}
async search(query: string, options?: SearchOptions): Promise<Array<Memory>> {
async search(
query: string,
options?: SearchOptions & Record<string, any>,
): Promise<Array<Memory>> {
if (this.telemetryId === "") await this.ping();
this._validateOrgProject();
const payloadKeys = Object.keys(options || {});