From 3b84a234e14a5b236f23aad502dc3ba626f4d179 Mon Sep 17 00:00:00 2001 From: Prateek Chhikara <46902268+prateekchhikara@users.noreply.github.com> Date: Thu, 13 Nov 2025 14:22:39 -0800 Subject: [PATCH] Updates to python sdk (#3749) --- docs/migration/breaking-changes.mdx | 39 ++++++----------------------- docs/migration/v0-to-v1.mdx | 7 ++---- mem0/client/main.py | 22 ---------------- pyproject.toml | 2 +- 4 files changed, 10 insertions(+), 60 deletions(-) diff --git a/docs/migration/breaking-changes.mdx b/docs/migration/breaking-changes.mdx index feaf3f6bb..e84ec7fd5 100644 --- a/docs/migration/breaking-changes.mdx +++ b/docs/migration/breaking-changes.mdx @@ -24,8 +24,7 @@ config = { result = m.add( "memory content", - user_id="alice", - output_format="v1.0" # ❌ No longer supported + user_id="alice" ) ``` @@ -39,7 +38,6 @@ config = { result = m.add( "memory content", user_id="alice" - # output_format parameter removed ) ``` @@ -51,28 +49,7 @@ Please use v1.1 format which returns a dict with 'results' key. ## Parameter Removals -### 1. output_format Parameter - -**Removed from all methods:** -- `add()` -- `search()` -- `get_all()` - -#### Before (v0.x) -```python -result = m.add("content", user_id="alice", output_format="v1.1") -search_results = m.search("query", user_id="alice", output_format="v1.1") -all_memories = m.get_all(user_id="alice", output_format="v1.1") -``` - -#### After (v1.0.0 ) -```python -result = m.add("content", user_id="alice") -search_results = m.search("query", user_id="alice") -all_memories = m.get_all(user_id="alice") -``` - -### 2. version Parameter in Method Calls +### 1. version Parameter in Method Calls **Breaking Change:** Version parameter removed from method calls. @@ -86,7 +63,7 @@ result = m.add("content", user_id="alice", version="v1.0") result = m.add("content", user_id="alice") ``` -### 3. async_mode Parameter (Platform Client) +### 2. async_mode Parameter (Platform Client) **Change:** For `MemoryClient` (Platform API), `async_mode` now defaults to `True` but can still be configured. @@ -120,12 +97,10 @@ result = client.add("content", user_id="alice", async_mode=False) #### Before (v0.x) ```python -# Could return different formats based on output_format parameter -result = m.add("content", user_id="alice", output_format="v1.0") -# Returns: [{"id": "...", "memory": "...", "event": "ADD"}] - -result = m.add("content", user_id="alice", output_format="v1.1") -# Returns: {"results": [{"id": "...", "memory": "...", "event": "ADD"}]} +# Could return different formats based on version configuration +result = m.add("content", user_id="alice") +# With v1.0: Returns [{"id": "...", "memory": "...", "event": "ADD"}] +# With v1.1: Returns {"results": [{"id": "...", "memory": "...", "event": "ADD"}]} ``` #### After (v1.0.0 ) diff --git a/docs/migration/v0-to-v1.mdx b/docs/migration/v0-to-v1.mdx index 1cc9f005b..6d611eaa6 100644 --- a/docs/migration/v0-to-v1.mdx +++ b/docs/migration/v0-to-v1.mdx @@ -19,8 +19,6 @@ Mem0 1.0.0 is a major release that modernizes the API, improves performance, an |---------|------|-------------|-------------------| | API Version | v1.0 supported | v1.0 **removed**, v1.1+ only | ✅ Yes | | Async Mode (Platform Client) | Optional/manual | Defaults to `True`, configurable | ⚠️ Partial | -| Output Format Parameter | Supported | **Removed** | ✅ Yes | -| Response Format | Mixed | Standardized `{"results": [...]}` | ✅ Yes | | Metadata Filtering | Basic | Enhanced with operators | ⚠️ Optional | | Reranking | Not available | Full support | ⚠️ Optional | @@ -44,7 +42,6 @@ m = Memory() result = m.add( "I love pizza", user_id="alice", - output_format="v1.0", # ❌ REMOVED version="v1.0" # ❌ REMOVED ) ``` @@ -58,7 +55,7 @@ m = Memory() result = m.add( "I love pizza", user_id="alice" - # output_format and version parameters removed + # version parameter removed ) ``` @@ -407,7 +404,7 @@ TypeError: add() got an unexpected keyword argument 'output_format' result = m.add( "memory", user_id="alice" - # Remove: output_format, version + # Remove: version ) ``` diff --git a/mem0/client/main.py b/mem0/client/main.py index fff9c91b5..3bc181294 100644 --- a/mem0/client/main.py +++ b/mem0/client/main.py @@ -161,15 +161,6 @@ class MemoryClient: kwargs = self._prepare_params(kwargs) - # Remove deprecated parameters - if "output_format" in kwargs: - warnings.warn( - "output_format parameter is deprecated and ignored. All responses now use v1.1 format.", - DeprecationWarning, - stacklevel=2, - ) - kwargs.pop("output_format") - # Set async_mode to True by default, but allow user override if "async_mode" not in kwargs: kwargs["async_mode"] = True @@ -228,7 +219,6 @@ class MemoryClient: MemoryNotFoundError: If the memory doesn't exist (for updates/deletes). """ params = self._prepare_params(kwargs) - params.pop("output_format", None) # Remove output_format for get operations params.pop("async_mode", None) if "page" in params and "page_size" in params: @@ -280,7 +270,6 @@ class MemoryClient: """ payload = {"query": query} params = self._prepare_params(kwargs) - params.pop("output_format", None) # Remove output_format for search operations params.pop("async_mode", None) payload.update(params) @@ -1103,15 +1092,6 @@ class AsyncMemoryClient: kwargs = self._prepare_params(kwargs) - # Remove deprecated parameters - if "output_format" in kwargs: - warnings.warn( - "output_format parameter is deprecated and ignored. All responses now use v1.1 format.", - DeprecationWarning, - stacklevel=2, - ) - kwargs.pop("output_format") - # Set async_mode to True by default, but allow user override if "async_mode" not in kwargs: kwargs["async_mode"] = True @@ -1137,7 +1117,6 @@ class AsyncMemoryClient: @api_error_handler async def get_all(self, **kwargs) -> Dict[str, Any]: params = self._prepare_params(kwargs) - params.pop("output_format", None) # Remove output_format for get operations params.pop("async_mode", None) if "page" in params and "page_size" in params: @@ -1171,7 +1150,6 @@ class AsyncMemoryClient: async def search(self, query: str, **kwargs) -> Dict[str, Any]: payload = {"query": query} params = self._prepare_params(kwargs) - params.pop("output_format", None) # Remove output_format for search operations params.pop("async_mode", None) payload.update(params) diff --git a/pyproject.toml b/pyproject.toml index d60cc3346..4cf7478c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "mem0ai" -version = "1.0.0" +version = "1.0.1" description = "Long-term memory for AI Agents" authors = [ { name = "Mem0", email = "founders@mem0.ai" }