Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix limit param in graph memory #1930

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading