From 8b4a2e2dd622d1c2ae0c94e97441337e3e358f46 Mon Sep 17 00:00:00 2001 From: Dev-Khant Date: Tue, 1 Oct 2024 00:13:27 +0530 Subject: [PATCH] fix limit param in graph memory --- mem0/memory/graph_memory.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mem0/memory/graph_memory.py b/mem0/memory/graph_memory.py index 987b923e39..2e09399eea 100644 --- a/mem0/memory/graph_memory.py +++ b/mem0/memory/graph_memory.py @@ -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] @@ -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: @@ -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.