Add support for batch update/delete (#2064)
This commit is contained in:
@@ -317,6 +317,28 @@ class MemoryClient:
|
|||||||
capture_client_event("client.reset", self)
|
capture_client_event("client.reset", self)
|
||||||
return {"message": "Client reset successful. All users and memories deleted."}
|
return {"message": "Client reset successful. All users and memories deleted."}
|
||||||
|
|
||||||
|
@api_error_handler
|
||||||
|
def batch_update(self, memories: List[Dict[str, Any]]) -> Dict[str, Any]:
|
||||||
|
"""Batch update memories."""
|
||||||
|
response = self.client.put("/v1/batch/", json={"memories": memories})
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
capture_client_event("client.batch_update", self)
|
||||||
|
return response.json()
|
||||||
|
|
||||||
|
@api_error_handler
|
||||||
|
def batch_delete(self, memories: List[Dict[str, Any]]) -> Dict[str, Any]:
|
||||||
|
"""Batch delete memories."""
|
||||||
|
response = self.client.request(
|
||||||
|
"DELETE",
|
||||||
|
"/v1/batch/",
|
||||||
|
json={"memories": memories}
|
||||||
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
capture_client_event("client.batch_delete", self)
|
||||||
|
return response.json()
|
||||||
|
|
||||||
def chat(self):
|
def chat(self):
|
||||||
"""Start a chat with the Mem0 AI. (Not implemented)
|
"""Start a chat with the Mem0 AI. (Not implemented)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "mem0ai"
|
name = "mem0ai"
|
||||||
version = "0.1.33"
|
version = "0.1.34"
|
||||||
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