Added New Param, output_format (#2639)

This commit is contained in:
Saket Aryan
2025-05-06 22:56:48 +05:30
committed by GitHub
parent 02a2b59555
commit 6e9f8cf218
4 changed files with 24 additions and 12 deletions

View File

@@ -209,6 +209,12 @@ mode: "wide"
<Tab title="TypeScript">
<Update label="2025-05-06" description="v2.1.24">
**New Features:**
- **Client:** Added new param `output_format` to match Python SDK.
- **Client:** Added new enum `OutputFormat` for `v1.0` and `v1.1`
</Update>
<Update label="2025-05-05" description="v2.1.23">
**New Features:**
- **Client:** Updated `deleteUsers` to use `v2` API.

View File

@@ -61,8 +61,8 @@ import { MemoryClient } from "mem0";
const client = new MemoryClient({
apiKey: "your-api-key",
orgId: "your-org-id",
projectId: "your-project-id"
org_id: "your-org-id",
project_id: "your-project-id"
});
const messages = [
@@ -74,10 +74,10 @@ const messages = [
// Enable graph memory when adding
await client.add({
messages,
userId: "joseph",
user_id: "joseph",
version: "v1",
enableGraph: true,
outputFormat: "v1.1"
enable_graph: true,
output_format: "v1.1"
});
```
@@ -142,9 +142,9 @@ print(results)
// Search with graph memory enabled
const results = await client.search({
query: "what is my name?",
userId: "joseph",
enableGraph: true,
outputFormat: "v1.1"
user_id: "joseph",
enable_graph: true,
output_format: "v1.1"
});
console.log(results);
@@ -211,9 +211,9 @@ print(memories)
```javascript JavaScript
// Get all memories with graph context
const memories = await client.getAll({
userId: "joseph",
enableGraph: true,
outputFormat: "v1.1"
user_id: "joseph",
enable_graph: true,
output_format: "v1.1"
});
console.log(memories);

View File

@@ -1,6 +1,6 @@
{
"name": "mem0ai",
"version": "2.1.23",
"version": "2.1.24",
"description": "The Memory Layer For Your AI Apps",
"main": "./dist/index.js",
"module": "./dist/index.mjs",

View File

@@ -22,12 +22,18 @@ export interface MemoryOptions {
custom_categories?: custom_categories[];
custom_instructions?: string;
timestamp?: number;
output_format?: string | OutputFormat;
}
export interface ProjectOptions {
fields?: string[];
}
export enum OutputFormat {
V1 = "v1.0",
V1_1 = "v1.1",
}
export enum API_VERSION {
V1 = "v1",
V2 = "v2",