Skip to content
Merged
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
11 changes: 8 additions & 3 deletions lightrag/kg/memgraph_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ class MemgraphStorage(BaseGraphStorage):
def __init__(self, namespace, global_config, embedding_func, workspace=None):
# Priority: 1) MEMGRAPH_WORKSPACE env 2) user arg 3) default 'base'
memgraph_workspace = os.environ.get("MEMGRAPH_WORKSPACE")
original_workspace = workspace # Save original value for logging
if memgraph_workspace and memgraph_workspace.strip():
logger.info(
f"Using MEMGRAPH_WORKSPACE environment variable: '{memgraph_workspace}' (overriding '{self.workspace}/{self.namespace}')"
)
workspace = memgraph_workspace

if not workspace or not str(workspace).strip():
Expand All @@ -51,6 +49,13 @@ def __init__(self, namespace, global_config, embedding_func, workspace=None):
global_config=global_config,
embedding_func=embedding_func,
)

# Log after super().__init__() to ensure self.workspace is initialized
if memgraph_workspace and memgraph_workspace.strip():
logger.info(
f"Using MEMGRAPH_WORKSPACE environment variable: '{memgraph_workspace}' (overriding '{original_workspace}/{namespace}')"
)

self._driver = None

def _get_workspace_label(self) -> str:
Expand Down
11 changes: 8 additions & 3 deletions lightrag/kg/neo4j_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ class Neo4JStorage(BaseGraphStorage):
def __init__(self, namespace, global_config, embedding_func, workspace=None):
# Read env and override the arg if present
neo4j_workspace = os.environ.get("NEO4J_WORKSPACE")
original_workspace = workspace # Save original value for logging
if neo4j_workspace and neo4j_workspace.strip():
logger.info(
f"Using NEO4J_WORKSPACE environment variable: '{neo4j_workspace}' (overriding '{self.workspace}/{self.namespace}')"
)
workspace = neo4j_workspace

# Default to 'base' when both arg and env are empty
Expand All @@ -83,6 +81,13 @@ def __init__(self, namespace, global_config, embedding_func, workspace=None):
global_config=global_config,
embedding_func=embedding_func,
)

# Log after super().__init__() to ensure self.workspace is initialized
if neo4j_workspace and neo4j_workspace.strip():
logger.info(
f"Using NEO4J_WORKSPACE environment variable: '{neo4j_workspace}' (overriding '{original_workspace}/{namespace}')"
)

self._driver = None

def _get_workspace_label(self) -> str:
Expand Down
Loading