feat(ts-sdk): add support for keyword arguments in add and search methods (#3895)
This commit is contained in:
@@ -682,6 +682,13 @@ mode: "wide"
|
|||||||
|
|
||||||
<Tab title="TypeScript">
|
<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">
|
<Update label="2025-12-29" description="v2.2.0">
|
||||||
|
|
||||||
**New Features:**
|
**New Features:**
|
||||||
|
|||||||
@@ -83,8 +83,7 @@ const messages = [
|
|||||||
{ role: "assistant", content: "Great! I’ll remember that for future suggestions." }
|
{ role: "assistant", content: "Great! I’ll remember that for future suggestions." }
|
||||||
];
|
];
|
||||||
|
|
||||||
await client.add({
|
await client.add(messages, {
|
||||||
messages,
|
|
||||||
user_id: "alice",
|
user_id: "alice",
|
||||||
version: "v2",
|
version: "v2",
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mem0ai",
|
"name": "mem0ai",
|
||||||
"version": "2.2.0",
|
"version": "2.2.1",
|
||||||
"description": "The Memory Layer For Your AI Apps",
|
"description": "The Memory Layer For Your AI Apps",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"module": "./dist/index.mjs",
|
"module": "./dist/index.mjs",
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ export default class MemoryClient {
|
|||||||
|
|
||||||
async add(
|
async add(
|
||||||
messages: Array<Message>,
|
messages: Array<Message>,
|
||||||
options: MemoryOptions = {},
|
options: MemoryOptions & Record<string, any> = {},
|
||||||
): Promise<Array<Memory>> {
|
): Promise<Array<Memory>> {
|
||||||
if (this.telemetryId === "") await this.ping();
|
if (this.telemetryId === "") await this.ping();
|
||||||
this._validateOrgProject();
|
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();
|
if (this.telemetryId === "") await this.ping();
|
||||||
this._validateOrgProject();
|
this._validateOrgProject();
|
||||||
const payloadKeys = Object.keys(options || {});
|
const payloadKeys = Object.keys(options || {});
|
||||||
|
|||||||
Reference in New Issue
Block a user