Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deprecated Neo4jGraph import to support langchain-neo4j #2084

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions mem0/memory/graph_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
from mem0.memory.utils import format_entities

try:
from langchain_community.graphs import Neo4jGraph
from langchain_neo4j import Neo4jGraph
except ImportError:
raise ImportError("langchain_community is not installed. Please install it using pip install langchain-community")

try:
from langchain_community.graphs.neo4j_graph import Neo4jGraph
except ImportError:
raise ImportError(
"Neither 'langchain-neo4j' nor 'langchain-community' is installed. "
"Please install one using 'pip install langchain-neo4j' or 'pip install langchain-community'."
)

try:
from rank_bm25 import BM25Okapi
except ImportError:
Expand Down
58 changes: 37 additions & 21 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ openai = "^1.33.0"
posthog = "^3.5.0"
pytz = "^2024.1"
sqlalchemy = "^2.0.31"
langchain-neo4j = "^0.1.1"

[tool.poetry.group.graph.dependencies]
langchain-community = "^0.3.1"
Expand Down