Skip to content

Commit

Permalink
fix limit param in graph memory (#1930)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev-Khant authored Sep 30, 2024
1 parent 0dbfcbe commit c45f14e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mem0/memory/graph_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def add(self, data, filters):

return returned_entities

def _search(self, query, filters, limit):
def _search(self, query, filters, limit=100):
_tools = [SEARCH_TOOL]
if self.llm_provider in ["azure_openai_structured", "openai_structured"]:
_tools = [SEARCH_STRUCT_TOOL]
Expand Down Expand Up @@ -232,14 +232,14 @@ def _search(self, query, filters, limit):

return result_relations

def search(self, query, filters, limit):
def search(self, query, filters, limit=100):
"""
Search for memories and related graph data.
Args:
query (str): Query to search for.
filters (dict): A dictionary containing filters to be applied during the search.
limit (int): The maximum number of nodes and relationships to retrieve.
limit (int): The maximum number of nodes and relationships to retrieve. Defaults to 100.
Returns:
dict: A dictionary containing:
Expand Down Expand Up @@ -274,13 +274,13 @@ def delete_all(self, filters):
params = {"user_id": filters["user_id"]}
self.graph.query(cypher, params=params)

def get_all(self, filters, limit):
def get_all(self, filters, limit=100):
"""
Retrieves all nodes and relationships from the graph database based on optional filtering criteria.
Args:
filters (dict): A dictionary containing filters to be applied during the retrieval.
limit (int): The maximum number of nodes and relationships to retrieve.
limit (int): The maximum number of nodes and relationships to retrieve. Defaults to 100.
Returns:
list: A list of dictionaries, each containing:
- 'contexts': The base data store response for each memory.
Expand Down

0 comments on commit c45f14e

Please sign in to comment.