Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

fix limit param in graph memory (#1930)

Dev Khantc45f14e77ddc
diff --git a/mem0/memory/graph_memory.py b/mem0/memory/graph_memory.py
index 987b923e3..2e09399ee 100644
--- a/mem0/memory/graph_memory.py
+++ b/mem0/memory/graph_memory.py
@@ -160,7 +160,7 @@ class MemoryGraph:
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 @@ class MemoryGraph:
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 @@ class MemoryGraph:
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.