yangdx
commited on
Commit
·
bc9a4a2
1
Parent(s):
b8adfbe
feat: remove check_storage_env_vars and add TODOs
Browse files- Remove unused check_storage_env_vars method
- Add TODO to check if has_edge works on reverse relation
- Add TODO about entities_vdb.client_storage local storage limitation
- lightrag/lightrag.py +3 -18
lightrag/lightrag.py
CHANGED
@@ -1494,6 +1494,7 @@ class LightRAG:
|
|
1494 |
target_entity: Name of the target entity
|
1495 |
"""
|
1496 |
try:
|
|
|
1497 |
# Check if the relation exists
|
1498 |
edge_exists = await self.chunk_entity_relation_graph.has_edge(
|
1499 |
source_entity, target_entity
|
@@ -1586,6 +1587,8 @@ class LightRAG:
|
|
1586 |
chunk_ids = set(related_chunks.keys())
|
1587 |
logger.debug(f"Found {len(chunk_ids)} chunks to delete")
|
1588 |
|
|
|
|
|
1589 |
# 3. Before deleting, check the related entities and relationships for these chunks
|
1590 |
for chunk_id in chunk_ids:
|
1591 |
# Check entities
|
@@ -1857,24 +1860,6 @@ class LightRAG:
|
|
1857 |
|
1858 |
return result
|
1859 |
|
1860 |
-
def check_storage_env_vars(self, storage_name: str) -> None:
|
1861 |
-
"""Check if all required environment variables for storage implementation exist
|
1862 |
-
|
1863 |
-
Args:
|
1864 |
-
storage_name: Storage implementation name
|
1865 |
-
|
1866 |
-
Raises:
|
1867 |
-
ValueError: If required environment variables are missing
|
1868 |
-
"""
|
1869 |
-
required_vars = STORAGE_ENV_REQUIREMENTS.get(storage_name, [])
|
1870 |
-
missing_vars = [var for var in required_vars if var not in os.environ]
|
1871 |
-
|
1872 |
-
if missing_vars:
|
1873 |
-
raise ValueError(
|
1874 |
-
f"Storage implementation '{storage_name}' requires the following "
|
1875 |
-
f"environment variables: {', '.join(missing_vars)}"
|
1876 |
-
)
|
1877 |
-
|
1878 |
async def aclear_cache(self, modes: list[str] | None = None) -> None:
|
1879 |
"""Clear cache data from the LLM response cache storage.
|
1880 |
|
|
|
1494 |
target_entity: Name of the target entity
|
1495 |
"""
|
1496 |
try:
|
1497 |
+
# TODO: check if has_edge function works on reverse relation
|
1498 |
# Check if the relation exists
|
1499 |
edge_exists = await self.chunk_entity_relation_graph.has_edge(
|
1500 |
source_entity, target_entity
|
|
|
1587 |
chunk_ids = set(related_chunks.keys())
|
1588 |
logger.debug(f"Found {len(chunk_ids)} chunks to delete")
|
1589 |
|
1590 |
+
# TODO: self.entities_vdb.client_storage only works for local storage, need to fix this
|
1591 |
+
|
1592 |
# 3. Before deleting, check the related entities and relationships for these chunks
|
1593 |
for chunk_id in chunk_ids:
|
1594 |
# Check entities
|
|
|
1860 |
|
1861 |
return result
|
1862 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1863 |
async def aclear_cache(self, modes: list[str] | None = None) -> None:
|
1864 |
"""Clear cache data from the LLM response cache storage.
|
1865 |
|