From 6e9f8cf21807d99a9c009d3a3ac91b2913638584 Mon Sep 17 00:00:00 2001 From: Saket Aryan Date: Tue, 6 May 2025 22:56:48 +0530 Subject: [PATCH] Added New Param, output_format (#2639) --- docs/changelog.mdx | 6 ++++++ docs/features/graph-memory.mdx | 22 +++++++++++----------- mem0-ts/package.json | 2 +- mem0-ts/src/client/mem0.types.ts | 6 ++++++ 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/docs/changelog.mdx b/docs/changelog.mdx index 0309c68b..ca6fe9a9 100644 --- a/docs/changelog.mdx +++ b/docs/changelog.mdx @@ -209,6 +209,12 @@ mode: "wide" + +**New Features:** +- **Client:** Added new param `output_format` to match Python SDK. +- **Client:** Added new enum `OutputFormat` for `v1.0` and `v1.1` + + **New Features:** - **Client:** Updated `deleteUsers` to use `v2` API. diff --git a/docs/features/graph-memory.mdx b/docs/features/graph-memory.mdx index a8c057bc..458a8689 100644 --- a/docs/features/graph-memory.mdx +++ b/docs/features/graph-memory.mdx @@ -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); diff --git a/mem0-ts/package.json b/mem0-ts/package.json index 2a726b3b..3e554e53 100644 --- a/mem0-ts/package.json +++ b/mem0-ts/package.json @@ -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", diff --git a/mem0-ts/src/client/mem0.types.ts b/mem0-ts/src/client/mem0.types.ts index 88c5f7cb..ebbbe4cb 100644 --- a/mem0-ts/src/client/mem0.types.ts +++ b/mem0-ts/src/client/mem0.types.ts @@ -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",