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: Memgraph Graph Generation Issue (#3109)

Akshat Jain4491e7f9f493
diff --git a/mem0/llms/openai.py b/mem0/llms/openai.py
index 8f3cf807a..d94a0f3af 100644
--- a/mem0/llms/openai.py
+++ b/mem0/llms/openai.py
@@ -79,7 +79,7 @@ class OpenAILLM(LLMBase):
tool_choice: str = "auto",
):
"""
- Generate a response based on the given messages using OpenAI.
+ Generate a JSON response based on the given messages using OpenAI.
Args:
messages (list): List of message dicts containing 'role' and 'content'.
@@ -88,7 +88,7 @@ class OpenAILLM(LLMBase):
tool_choice (str, optional): Tool choice method. Defaults to "auto".
Returns:
- str: The generated response.
+ json: The generated response.
"""
params = {
"model": self.config.model,
diff --git a/mem0/memory/memgraph_memory.py b/mem0/memory/memgraph_memory.py
index beb8af2ba..97af282cf 100644
--- a/mem0/memory/memgraph_memory.py
+++ b/mem0/memory/memgraph_memory.py
@@ -3,7 +3,7 @@ import logging
from mem0.memory.utils import format_entities
try:
- from langchain_memgraph import Memgraph
+ from langchain_memgraph.graphs.memgraph import Memgraph
except ImportError:
raise ImportError("langchain_memgraph is not installed. Please install it using pip install langchain-memgraph")
@@ -76,8 +76,8 @@ class MemoryGraph:
# TODO: Batch queries with APOC plugin
# TODO: Add more filter support
- deleted_entities = self._delete_entities(to_be_deleted, filters["user_id"])
- added_entities = self._add_entities(to_be_added, filters["user_id"], entity_type_map)
+ deleted_entities = self._delete_entities(to_be_deleted, filters)
+ added_entities = self._add_entities(to_be_added, filters, entity_type_map)
return {"deleted_entities": deleted_entities, "added_entities": added_entities}