remove " and upper()
Browse files- lightrag/lightrag.py +3 -7
lightrag/lightrag.py
CHANGED
@@ -880,7 +880,7 @@ class LightRAG:
|
|
880 |
# Insert entities into knowledge graph
|
881 |
all_entities_data: list[dict[str, str]] = []
|
882 |
for entity_data in custom_kg.get("entities", []):
|
883 |
-
entity_name =
|
884 |
entity_type = entity_data.get("entity_type", "UNKNOWN")
|
885 |
description = entity_data.get("description", "No description provided")
|
886 |
# source_id = entity_data["source_id"]
|
@@ -910,8 +910,8 @@ class LightRAG:
|
|
910 |
# Insert relationships into knowledge graph
|
911 |
all_relationships_data: list[dict[str, str]] = []
|
912 |
for relationship_data in custom_kg.get("relationships", []):
|
913 |
-
src_id =
|
914 |
-
tgt_id =
|
915 |
description = relationship_data["description"]
|
916 |
keywords = relationship_data["keywords"]
|
917 |
weight = relationship_data.get("weight", 1.0)
|
@@ -1213,7 +1213,6 @@ class LightRAG:
|
|
1213 |
return loop.run_until_complete(self.adelete_by_entity(entity_name))
|
1214 |
|
1215 |
async def adelete_by_entity(self, entity_name: str) -> None:
|
1216 |
-
entity_name = f'"{entity_name.upper()}"'
|
1217 |
|
1218 |
try:
|
1219 |
await self.entities_vdb.delete_entity(entity_name)
|
@@ -1509,7 +1508,6 @@ class LightRAG:
|
|
1509 |
- graph_data: Complete node data from the graph database
|
1510 |
- vector_data: (optional) Data from the vector database
|
1511 |
"""
|
1512 |
-
entity_name = f'"{entity_name.upper()}"'
|
1513 |
|
1514 |
# Get information from the graph
|
1515 |
node_data = await self.chunk_entity_relation_graph.get_node(entity_name)
|
@@ -1547,8 +1545,6 @@ class LightRAG:
|
|
1547 |
- graph_data: Complete edge data from the graph database
|
1548 |
- vector_data: (optional) Data from the vector database
|
1549 |
"""
|
1550 |
-
src_entity = f'"{src_entity.upper()}"'
|
1551 |
-
tgt_entity = f'"{tgt_entity.upper()}"'
|
1552 |
|
1553 |
# Get information from the graph
|
1554 |
edge_data = await self.chunk_entity_relation_graph.get_edge(
|
|
|
880 |
# Insert entities into knowledge graph
|
881 |
all_entities_data: list[dict[str, str]] = []
|
882 |
for entity_data in custom_kg.get("entities", []):
|
883 |
+
entity_name = entity_data["entity_name"]
|
884 |
entity_type = entity_data.get("entity_type", "UNKNOWN")
|
885 |
description = entity_data.get("description", "No description provided")
|
886 |
# source_id = entity_data["source_id"]
|
|
|
910 |
# Insert relationships into knowledge graph
|
911 |
all_relationships_data: list[dict[str, str]] = []
|
912 |
for relationship_data in custom_kg.get("relationships", []):
|
913 |
+
src_id = relationship_data["src_id"]
|
914 |
+
tgt_id = relationship_data["tgt_id"]
|
915 |
description = relationship_data["description"]
|
916 |
keywords = relationship_data["keywords"]
|
917 |
weight = relationship_data.get("weight", 1.0)
|
|
|
1213 |
return loop.run_until_complete(self.adelete_by_entity(entity_name))
|
1214 |
|
1215 |
async def adelete_by_entity(self, entity_name: str) -> None:
|
|
|
1216 |
|
1217 |
try:
|
1218 |
await self.entities_vdb.delete_entity(entity_name)
|
|
|
1508 |
- graph_data: Complete node data from the graph database
|
1509 |
- vector_data: (optional) Data from the vector database
|
1510 |
"""
|
|
|
1511 |
|
1512 |
# Get information from the graph
|
1513 |
node_data = await self.chunk_entity_relation_graph.get_node(entity_name)
|
|
|
1545 |
- graph_data: Complete edge data from the graph database
|
1546 |
- vector_data: (optional) Data from the vector database
|
1547 |
"""
|
|
|
|
|
1548 |
|
1549 |
# Get information from the graph
|
1550 |
edge_data = await self.chunk_entity_relation_graph.get_edge(
|