From 78912928bc6c9e78b221faf1538c8cc38f7dc32b Mon Sep 17 00:00:00 2001 From: Prateek Chhikara <46902268+prateekchhikara@users.noreply.github.com> Date: Thu, 17 Apr 2025 11:28:39 -0700 Subject: [PATCH] Changes to client (#2562) --- mem0/client/main.py | 24 ++++++++++++++---------- pyproject.toml | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/mem0/client/main.py b/mem0/client/main.py index fde39237..891a9605 100644 --- a/mem0/client/main.py +++ b/mem0/client/main.py @@ -485,7 +485,10 @@ class MemoryClient: @api_error_handler def update_project( - self, custom_instructions: Optional[str] = None, custom_categories: Optional[List[str]] = None + self, + custom_instructions: Optional[str] = None, + custom_categories: Optional[List[str]] = None, + retrieval_criteria: Optional[List[Dict[str, Any]]] = None, ) -> Dict[str, Any]: """Update the project settings. @@ -503,13 +506,13 @@ class MemoryClient: if not (self.org_id and self.project_id): raise ValueError("org_id and project_id must be set to update instructions or categories") - if custom_instructions is None and custom_categories is None: + if custom_instructions is None and custom_categories is None and retrieval_criteria is None: raise ValueError( - "Currently we only support updating custom_instructions or custom_categories, so you must provide at least one of them" + "Currently we only support updating custom_instructions or custom_categories or retrieval_criteria, so you must provide at least one of them" ) payload = self._prepare_params( - {"custom_instructions": custom_instructions, "custom_categories": custom_categories} + {"custom_instructions": custom_instructions, "custom_categories": custom_categories, "retrieval_criteria": retrieval_criteria} ) response = self.client.patch( f"/api/v1/orgs/organizations/{self.org_id}/projects/{self.project_id}/", @@ -519,7 +522,7 @@ class MemoryClient: capture_client_event( "client.update_project", self, - {"custom_instructions": custom_instructions, "custom_categories": custom_categories, "sync_type": "sync"}, + {"custom_instructions": custom_instructions, "custom_categories": custom_categories, "retrieval_criteria": retrieval_criteria, "sync_type": "sync"}, ) return response.json() @@ -955,18 +958,19 @@ class AsyncMemoryClient: @api_error_handler async def update_project( - self, custom_instructions: Optional[str] = None, custom_categories: Optional[List[str]] = None + self, custom_instructions: Optional[str] = None, custom_categories: Optional[List[str]] = None, + retrieval_criteria: Optional[List[Dict[str, Any]]] = None ) -> Dict[str, Any]: if not (self.sync_client.org_id and self.sync_client.project_id): raise ValueError("org_id and project_id must be set to update instructions or categories") - if custom_instructions is None and custom_categories is None: + if custom_instructions is None and custom_categories is None and retrieval_criteria is None: raise ValueError( - "Currently we only support updating custom_instructions or custom_categories, so you must provide at least one of them" + "Currently we only support updating custom_instructions or custom_categories or retrieval_criteria, so you must provide at least one of them" ) payload = self.sync_client._prepare_params( - {"custom_instructions": custom_instructions, "custom_categories": custom_categories} + {"custom_instructions": custom_instructions, "custom_categories": custom_categories, "retrieval_criteria": retrieval_criteria} ) response = await self.async_client.patch( f"/api/v1/orgs/organizations/{self.sync_client.org_id}/projects/{self.sync_client.project_id}/", @@ -976,7 +980,7 @@ class AsyncMemoryClient: capture_client_event( "client.update_project", self.sync_client, - {"custom_instructions": custom_instructions, "custom_categories": custom_categories, "sync_type": "async"}, + {"custom_instructions": custom_instructions, "custom_categories": custom_categories, "retrieval_criteria": retrieval_criteria, "sync_type": "async"}, ) return response.json() diff --git a/pyproject.toml b/pyproject.toml index 29c1371c..c55bcd25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mem0ai" -version = "0.1.91" +version = "0.1.92" description = "Long-term memory for AI Agents" authors = ["Mem0 "] exclude = [