Fix langchain neo4j deprecation warning (#2350)

This commit is contained in:
Parshva Daftari
2025-03-12 15:30:45 +05:30
committed by GitHub
parent b43363cdf3
commit 65f826e064
3 changed files with 161 additions and 325 deletions

View File

@@ -3,23 +3,20 @@ import logging
from mem0.memory.utils import format_entities from mem0.memory.utils import format_entities
try: try:
from langchain_community.graphs import Neo4jGraph from langchain_neo4j import Neo4jGraph
except ImportError: except ImportError:
raise ImportError("langchain_community is not installed. Please install it using pip install langchain-community") raise ImportError("langchain_neo4j is not installed. Please install it using pip install langchain-neo4j")
try: try:
from rank_bm25 import BM25Okapi from rank_bm25 import BM25Okapi
except ImportError: except ImportError:
raise ImportError("rank_bm25 is not installed. Please install it using pip install rank-bm25") raise ImportError("rank_bm25 is not installed. Please install it using pip install rank-bm25")
from mem0.graphs.tools import ( from mem0.graphs.tools import (DELETE_MEMORY_STRUCT_TOOL_GRAPH,
DELETE_MEMORY_STRUCT_TOOL_GRAPH, DELETE_MEMORY_TOOL_GRAPH,
DELETE_MEMORY_TOOL_GRAPH, EXTRACT_ENTITIES_STRUCT_TOOL,
EXTRACT_ENTITIES_STRUCT_TOOL, EXTRACT_ENTITIES_TOOL, RELATIONS_STRUCT_TOOL,
EXTRACT_ENTITIES_TOOL, RELATIONS_TOOL)
RELATIONS_STRUCT_TOOL,
RELATIONS_TOOL,
)
from mem0.graphs.utils import EXTRACT_RELATIONS_PROMPT, get_delete_messages from mem0.graphs.utils import EXTRACT_RELATIONS_PROMPT, get_delete_messages
from mem0.utils.factory import EmbedderFactory, LlmFactory from mem0.utils.factory import EmbedderFactory, LlmFactory

465
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -22,13 +22,13 @@ openai = "^1.33.0"
posthog = "^3.5.0" posthog = "^3.5.0"
pytz = "^2024.1" pytz = "^2024.1"
sqlalchemy = "^2.0.31" sqlalchemy = "^2.0.31"
langchain-community = "^0.3.1" langchain-neo4j = "^0.4.0"
neo4j = "^5.23.1" neo4j = "^5.23.1"
rank-bm25 = "^0.2.2" rank-bm25 = "^0.2.2"
psycopg2-binary = "^2.9.10" psycopg2-binary = "^2.9.10"
[tool.poetry.extras] [tool.poetry.extras]
graph = ["langchain-community", "neo4j", "rank-bm25"] graph = ["langchain-neo4j", "neo4j", "rank-bm25"]
[tool.poetry.group.test.dependencies] [tool.poetry.group.test.dependencies]
pytest = "^8.2.2" pytest = "^8.2.2"