Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Fix async client `update_project` method (#2155)

Deshraj Yadav56351d1f8d4a
diff --git a/mem0/client/main.py b/mem0/client/main.py
index 85fbb1c1d..452f0ef4f 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 b92f5ac58..796bae482 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 <[email protected]>"]
exclude = [