Merge branch 'main' into max-graph-node
Browse files- .env.example → env.example +2 -0
- lightrag/lightrag.py +3 -8
.env.example → env.example
RENAMED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
### Server Configuration
|
2 |
# HOST=0.0.0.0
|
3 |
# PORT=9621
|
|
|
1 |
+
### This is sample file of .env
|
2 |
+
|
3 |
### Server Configuration
|
4 |
# HOST=0.0.0.0
|
5 |
# PORT=9621
|
lightrag/lightrag.py
CHANGED
@@ -997,7 +997,7 @@ class LightRAG:
|
|
997 |
# Insert entities into knowledge graph
|
998 |
all_entities_data: list[dict[str, str]] = []
|
999 |
for entity_data in custom_kg.get("entities", []):
|
1000 |
-
entity_name =
|
1001 |
entity_type = entity_data.get("entity_type", "UNKNOWN")
|
1002 |
description = entity_data.get("description", "No description provided")
|
1003 |
# source_id = entity_data["source_id"]
|
@@ -1027,8 +1027,8 @@ class LightRAG:
|
|
1027 |
# Insert relationships into knowledge graph
|
1028 |
all_relationships_data: list[dict[str, str]] = []
|
1029 |
for relationship_data in custom_kg.get("relationships", []):
|
1030 |
-
src_id =
|
1031 |
-
tgt_id =
|
1032 |
description = relationship_data["description"]
|
1033 |
keywords = relationship_data["keywords"]
|
1034 |
weight = relationship_data.get("weight", 1.0)
|
@@ -1330,8 +1330,6 @@ class LightRAG:
|
|
1330 |
return loop.run_until_complete(self.adelete_by_entity(entity_name))
|
1331 |
|
1332 |
async def adelete_by_entity(self, entity_name: str) -> None:
|
1333 |
-
entity_name = f'"{entity_name.upper()}"'
|
1334 |
-
|
1335 |
try:
|
1336 |
await self.entities_vdb.delete_entity(entity_name)
|
1337 |
await self.relationships_vdb.delete_entity_relation(entity_name)
|
@@ -1626,7 +1624,6 @@ class LightRAG:
|
|
1626 |
- graph_data: Complete node data from the graph database
|
1627 |
- vector_data: (optional) Data from the vector database
|
1628 |
"""
|
1629 |
-
entity_name = f'"{entity_name.upper()}"'
|
1630 |
|
1631 |
# Get information from the graph
|
1632 |
node_data = await self.chunk_entity_relation_graph.get_node(entity_name)
|
@@ -1664,8 +1661,6 @@ class LightRAG:
|
|
1664 |
- graph_data: Complete edge data from the graph database
|
1665 |
- vector_data: (optional) Data from the vector database
|
1666 |
"""
|
1667 |
-
src_entity = f'"{src_entity.upper()}"'
|
1668 |
-
tgt_entity = f'"{tgt_entity.upper()}"'
|
1669 |
|
1670 |
# Get information from the graph
|
1671 |
edge_data = await self.chunk_entity_relation_graph.get_edge(
|
|
|
997 |
# Insert entities into knowledge graph
|
998 |
all_entities_data: list[dict[str, str]] = []
|
999 |
for entity_data in custom_kg.get("entities", []):
|
1000 |
+
entity_name = entity_data["entity_name"]
|
1001 |
entity_type = entity_data.get("entity_type", "UNKNOWN")
|
1002 |
description = entity_data.get("description", "No description provided")
|
1003 |
# source_id = entity_data["source_id"]
|
|
|
1027 |
# Insert relationships into knowledge graph
|
1028 |
all_relationships_data: list[dict[str, str]] = []
|
1029 |
for relationship_data in custom_kg.get("relationships", []):
|
1030 |
+
src_id = relationship_data["src_id"]
|
1031 |
+
tgt_id = relationship_data["tgt_id"]
|
1032 |
description = relationship_data["description"]
|
1033 |
keywords = relationship_data["keywords"]
|
1034 |
weight = relationship_data.get("weight", 1.0)
|
|
|
1330 |
return loop.run_until_complete(self.adelete_by_entity(entity_name))
|
1331 |
|
1332 |
async def adelete_by_entity(self, entity_name: str) -> None:
|
|
|
|
|
1333 |
try:
|
1334 |
await self.entities_vdb.delete_entity(entity_name)
|
1335 |
await self.relationships_vdb.delete_entity_relation(entity_name)
|
|
|
1624 |
- graph_data: Complete node data from the graph database
|
1625 |
- vector_data: (optional) Data from the vector database
|
1626 |
"""
|
|
|
1627 |
|
1628 |
# Get information from the graph
|
1629 |
node_data = await self.chunk_entity_relation_graph.get_node(entity_name)
|
|
|
1661 |
- graph_data: Complete edge data from the graph database
|
1662 |
- vector_data: (optional) Data from the vector database
|
1663 |
"""
|
|
|
|
|
1664 |
|
1665 |
# Get information from the graph
|
1666 |
edge_data = await self.chunk_entity_relation_graph.get_edge(
|