Fix async client update_project method (#2155)
This commit is contained in:
@@ -758,7 +758,7 @@ class AsyncMemoryClient:
|
|||||||
if not (self.sync_client.org_id and self.sync_client.project_id):
|
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")
|
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(
|
response = await self.async_client.get(
|
||||||
f"/api/v1/orgs/organizations/{self.sync_client.org_id}/projects/{self.sync_client.project_id}/",
|
f"/api/v1/orgs/organizations/{self.sync_client.org_id}/projects/{self.sync_client.project_id}/",
|
||||||
params=params,
|
params=params,
|
||||||
@@ -769,11 +769,16 @@ class AsyncMemoryClient:
|
|||||||
|
|
||||||
@api_error_handler
|
@api_error_handler
|
||||||
async def update_project(
|
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]:
|
) -> Dict[str, Any]:
|
||||||
if not (self.sync_client.org_id and self.sync_client.project_id):
|
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")
|
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(
|
payload = self.sync_client._prepare_params(
|
||||||
{"custom_instructions": custom_instructions, "custom_categories": custom_categories}
|
{"custom_instructions": custom_instructions, "custom_categories": custom_categories}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "mem0ai"
|
name = "mem0ai"
|
||||||
version = "0.1.44"
|
version = "0.1.45"
|
||||||
description = "Long-term memory for AI Agents"
|
description = "Long-term memory for AI Agents"
|
||||||
authors = ["Mem0 <founders@mem0.ai>"]
|
authors = ["Mem0 <founders@mem0.ai>"]
|
||||||
exclude = [
|
exclude = [
|
||||||
|
|||||||
Reference in New Issue
Block a user