Skip to content
Merged
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
15 changes: 3 additions & 12 deletions graphgen/models/kg_builder/light_rag_kg_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,9 @@ async def merge_edges(
set([dp["source_id"] for dp in edge_data] + source_ids)
)

for insert_id in [src_id, tgt_id]:
if not kg_instance.has_node(insert_id):
kg_instance.upsert_node(
insert_id,
node_data={
"entity_type": "UNKNOWN",
"entity_name": insert_id,
"description": "",
"source_id": source_id,
"length": self.tokenizer.count_tokens(description),
},
)
if not kg_instance.has_node(src_id) or not kg_instance.has_node(tgt_id):
logger.warning("Edge (%s, %s) has missing nodes.", src_id, tgt_id)
return {}
Comment on lines +167 to +169
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The return type of this function (dict) is inconsistent with its definition in the base class BaseKGBuilder, where merge_edges is annotated to return None. This violates the Liskov Substitution Principle. While this is a pre-existing issue, it's good practice to ensure method signatures are consistent in an inheritance hierarchy. It is recommended to create a follow-up task to update the base class method's return type to dict to resolve this inconsistency.


description = await self._handle_kg_summary(
f"({src_id}, {tgt_id})", description
Expand Down
Loading