feat: Add metadata param to TS-SDK in client.update (#3415)
This commit is contained in:
@@ -611,6 +611,11 @@ mode: "wide"
|
|||||||
|
|
||||||
<Tab title="TypeScript">
|
<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">
|
<Update label="2025-08-04" description="v2.1.37">
|
||||||
**New Features:**
|
**New Features:**
|
||||||
- **OSS:** Added `RedisCloud` search module check
|
- **OSS:** Added `RedisCloud` search module check
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mem0ai",
|
"name": "mem0ai",
|
||||||
"version": "2.1.37",
|
"version": "2.1.38",
|
||||||
"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",
|
||||||
|
|||||||
@@ -251,11 +251,19 @@ export default class MemoryClient {
|
|||||||
return response;
|
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();
|
if (this.telemetryId === "") await this.ping();
|
||||||
this._validateOrgProject();
|
this._validateOrgProject();
|
||||||
const payload = {
|
const payload = {
|
||||||
text: message,
|
text: text,
|
||||||
|
metadata: metadata,
|
||||||
};
|
};
|
||||||
|
|
||||||
const payloadKeys = Object.keys(payload);
|
const payloadKeys = Object.keys(payload);
|
||||||
|
|||||||
Reference in New Issue
Block a user