From 56351d1f8d4a7615cd1b0e29fcf2af8a1ff446b3 Mon Sep 17 00:00:00 2001 From: Deshraj Yadav Date: Sat, 18 Jan 2025 19:35:59 -0800 Subject: [PATCH] Fix async client `update_project` method (#2155) --- mem0/client/main.py | 9 +++++++-- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mem0/client/main.py b/mem0/client/main.py index 85fbb1c1..452f0ef4 100644 --- a/mem0/client/main.py +++ b/mem0/client/main.py @@ -758,7 +758,7 @@ class AsyncMemoryClient: if not (self.sync_client.org_id and self.sync_client.project_id): raise ValueError("org_id and project_id must be set to access instructions or categories") - params = self._prepare_params({"fields": fields}) + params = self.sync_client._prepare_params({"fields": fields}) response = await self.async_client.get( f"/api/v1/orgs/organizations/{self.sync_client.org_id}/projects/{self.sync_client.project_id}/", params=params, @@ -769,11 +769,16 @@ class AsyncMemoryClient: @api_error_handler async def update_project( - self, custom_instructions: Optional[str], custom_categories: Optional[List[str]] + self, custom_instructions: Optional[str] = None, custom_categories: Optional[List[str]] = 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: + raise ValueError( + "Currently we only support updating custom_instructions or custom_categories, so you must provide at least one of them" + ) + payload = self.sync_client._prepare_params( {"custom_instructions": custom_instructions, "custom_categories": custom_categories} ) diff --git a/pyproject.toml b/pyproject.toml index b92f5ac5..796bae48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mem0ai" -version = "0.1.44" +version = "0.1.45" description = "Long-term memory for AI Agents" authors = ["Mem0 "] exclude = [