Skip to content

Commit 51df6ba

Browse files
authored
Merge pull request #22 from xuanleilin/feature/graphrag
feat: integrate Ragas for GraphRAG evaluation; add Ragas-based evaluation for LightRAG and MSFT GraphRAG
2 parents ca5fdfa + b1df6bc commit 51df6ba

26 files changed

+2995
-8663
lines changed

applications/lightrag/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
data/*
22
!data/input/
3-
!data/input/book.txt
3+
!data/input/clapnq_dev_answerable_orig.jsonl.50.txt
Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
from .storage.tigergraph_storage import TigerGraphStorage
2-
from .storage.tigervector_storage import TigerVectorStorage
3-
41
from lightrag import LightRAG
2+
from lightrag.lightrag import lazy_external_import
53

64

7-
# Define a subclass to include your custom graph storage in the storage mapping
85
class CustomLightRAG(LightRAG):
9-
def _get_storage_class(self):
10-
# Extend the default storage mapping with your custom storage
11-
base_mapping = super()._get_storage_class()
12-
base_mapping["TigerGraphStorage"] = TigerGraphStorage
13-
base_mapping["TigerVectorStorage"] = TigerVectorStorage
14-
return base_mapping
6+
def _get_storage_class(self, storage_name: str) -> dict:
7+
"""Override storage retrieval to use a modified STORAGES mapping."""
8+
9+
custom_storages = {
10+
"TigerGraphStorage": "applications.lightrag.storage.tigergraph_storage",
11+
"TigerVectorStorage": "applications.lightrag.storage.tigervector_storage",
12+
}
13+
14+
if storage_name in custom_storages:
15+
import_path = custom_storages[storage_name]
16+
return lazy_external_import(import_path, storage_name) # pyright: ignore
17+
18+
# Call the parent class's method instead of self to prevent infinite recursion
19+
return super()._get_storage_class(storage_name)

0 commit comments

Comments
 (0)