fix limit param in graph memory (#1930)

This commit is contained in:
Dev Khant
2024-10-01 00:15:55 +05:30
committed by GitHub
parent 0dbfcbe6d9
commit c45f14e77d

View File

@@ -160,7 +160,7 @@ class MemoryGraph:
return returned_entities return returned_entities
def _search(self, query, filters, limit): def _search(self, query, filters, limit=100):
_tools = [SEARCH_TOOL] _tools = [SEARCH_TOOL]
if self.llm_provider in ["azure_openai_structured", "openai_structured"]: if self.llm_provider in ["azure_openai_structured", "openai_structured"]:
_tools = [SEARCH_STRUCT_TOOL] _tools = [SEARCH_STRUCT_TOOL]
@@ -232,14 +232,14 @@ class MemoryGraph:
return result_relations return result_relations
def search(self, query, filters, limit): def search(self, query, filters, limit=100):
""" """
Search for memories and related graph data. Search for memories and related graph data.
Args: Args:
query (str): Query to search for. query (str): Query to search for.
filters (dict): A dictionary containing filters to be applied during the search. 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: Returns:
dict: A dictionary containing: dict: A dictionary containing:
@@ -274,13 +274,13 @@ class MemoryGraph:
params = {"user_id": filters["user_id"]} params = {"user_id": filters["user_id"]}
self.graph.query(cypher, params=params) 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. Retrieves all nodes and relationships from the graph database based on optional filtering criteria.
Args: Args:
filters (dict): A dictionary containing filters to be applied during the retrieval. 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: Returns:
list: A list of dictionaries, each containing: list: A list of dictionaries, each containing:
- 'contexts': The base data store response for each memory. - 'contexts': The base data store response for each memory.