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.

Update graph doc for installation (#1959)

Dev Khant2b262a65b237
diff --git a/docs/open-source/graph_memory/overview.mdx b/docs/open-source/graph_memory/overview.mdx
index a65938610..fe933db8d 100644
--- a/docs/open-source/graph_memory/overview.mdx
+++ b/docs/open-source/graph_memory/overview.mdx
@@ -7,6 +7,16 @@ Mem0 now supports **Graph Memory**.
With Graph Memory, users can now create and utilize complex relationships between pieces of information, allowing for more nuanced and context-aware responses.
This integration enables users to leverage the strengths of both vector-based and graph-based approaches, resulting in more accurate and comprehensive information retrieval and generation.
+## Installation
+
+To use Mem0 with Graph Memory support, install it using pip:
+
+```bash
+pip install mem0ai[graph]
+```
+
+This command installs Mem0 along with the necessary dependencies for graph functionality.
+
Try Graph Memory on Google Colab.
<a target="_blank" href="https://colab.research.google.com/drive/1PfIGVHnliIlG2v8cx0g45TF0US-jRPZ1?usp=sharing">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
diff --git a/mem0/memory/graph_memory.py b/mem0/memory/graph_memory.py
index f25d75526..09ad55cfe 100644
--- a/mem0/memory/graph_memory.py
+++ b/mem0/memory/graph_memory.py
@@ -1,7 +1,14 @@
import logging
-from langchain_community.graphs import Neo4jGraph
-from rank_bm25 import BM25Okapi
+try:
+ from langchain_community.graphs import Neo4jGraph
+except ImportError:
+ raise ImportError("langchain_community is not installed. Please install it using pip install langchain-community")
+
+try:
+ from rank_bm25 import BM25Okapi
+except ImportError:
+ raise ImportError("rank_bm25 is not installed. Please install it using pip install rank-bm25")
from mem0.graphs.tools import (
ADD_MEMORY_STRUCT_TOOL_GRAPH,