Skip to content

Commit

Permalink
fix return types for client methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev-Khant committed Sep 26, 2024
1 parent 61dd5a5 commit a230dfe
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mem0/client/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ def get(self, memory_id: str) -> Dict[str, Any]:
return response.json()

@api_error_handler
def get_all(self, **kwargs) -> Dict[str, Any]:
def get_all(self, **kwargs) -> List[Dict[str, Any]]:
"""Retrieve all memories, with optional filtering.
Args:
**kwargs: Optional parameters for filtering (user_id, agent_id, app_id, limit).
Returns:
A dictionary containing the list of memories.
A list of dictionaries containing memories.
Raises:
APIError: If the API request fails.
Expand All @@ -163,7 +163,7 @@ def get_all(self, **kwargs) -> Dict[str, Any]:
return response.json()

@api_error_handler
def search(self, query: str, version: str = "v1", **kwargs) -> Dict[str, Any]:
def search(self, query: str, version: str = "v1", **kwargs) -> List[Dict[str, Any]]:
"""Search memories based on a query.
Args:
Expand All @@ -172,7 +172,7 @@ def search(self, query: str, version: str = "v1", **kwargs) -> Dict[str, Any]:
**kwargs: Additional parameters such as user_id, agent_id, app_id, limit, filters.
Returns:
A dictionary containing the search results.
A list of dictionaries containing search results.
Raises:
APIError: If the API request fails.
Expand Down Expand Up @@ -218,7 +218,7 @@ def delete(self, memory_id: str) -> Dict[str, Any]:
return response.json()

@api_error_handler
def delete_all(self, **kwargs) -> Dict[str, Any]:
def delete_all(self, **kwargs) -> Dict[str, str]:
"""Delete all memories, with optional filtering.
Args:
Expand All @@ -238,14 +238,14 @@ def delete_all(self, **kwargs) -> Dict[str, Any]:
return response.json()

@api_error_handler
def history(self, memory_id: str) -> Dict[str, Any]:
def history(self, memory_id: str) -> List[Dict[str, Any]]:
"""Retrieve the history of a specific memory.
Args:
memory_id: The ID of the memory to retrieve history for.
Returns:
A dictionary containing the memory history.
A list of dictionaries containing the memory history.
Raises:
APIError: If the API request fails.
Expand All @@ -256,7 +256,7 @@ def history(self, memory_id: str) -> Dict[str, Any]:
return response.json()

@api_error_handler
def users(self):
def users(self) -> Dict[str, Any]:
"""Get all users, agents, and sessions for which memories exist."""
params = {"org_name": self.organization, "project_name": self.project}
response = self.client.get("/v1/entities/", params=params)
Expand Down

0 comments on commit a230dfe

Please sign in to comment.