Add update method in client (#1615)

This commit is contained in:
Dev Khant
2024-07-31 11:43:30 +05:30
committed by GitHub
parent f2ddc573f6
commit 47afe52296
2 changed files with 56 additions and 1 deletions

View File

@@ -168,6 +168,20 @@ class MemoryClient:
capture_client_event("client.search", self, {"limit": kwargs.get("limit", 100)})
return response.json()
@api_error_handler
def update(self, memory_id: str, data: str) -> Dict[str, Any]:
"""
Update a memory by ID.
Args:
memory_id (str): Memory ID.
data (str): Data to update in the memory.
Returns:
Dict[str, Any]: The response from the server.
"""
capture_client_event("client.update", self)
response = self.client.put(f"/memories/{memory_id}/", json={"text": data})
return response.json()
@api_error_handler
def delete(self, memory_id: str) -> Dict[str, Any]:
"""Delete a specific memory by ID.