chore: adds correct id generation to memify triplet embedding pipeline
This commit is contained in:
parent
127d9860df
commit
c3ee615f80
1 changed files with 7 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import AsyncGenerator, Dict, Any, List, Optional
|
from typing import AsyncGenerator, Dict, Any, List, Optional
|
||||||
from cognee.infrastructure.databases.graph.get_graph_engine import get_graph_engine
|
from cognee.infrastructure.databases.graph.get_graph_engine import get_graph_engine
|
||||||
|
from cognee.modules.engine.utils import generate_node_id
|
||||||
from cognee.shared.logging_utils import get_logger
|
from cognee.shared.logging_utils import get_logger
|
||||||
from cognee.modules.graph.utils.convert_node_to_data_point import get_all_subclasses
|
from cognee.modules.graph.utils.convert_node_to_data_point import get_all_subclasses
|
||||||
from cognee.infrastructure.engine import DataPoint
|
from cognee.infrastructure.engine import DataPoint
|
||||||
|
|
@ -155,7 +156,12 @@ def _process_single_triplet(
|
||||||
|
|
||||||
embeddable_text = f"{start_node_text}-›{relationship_text}-›{end_node_text}".strip()
|
embeddable_text = f"{start_node_text}-›{relationship_text}-›{end_node_text}".strip()
|
||||||
|
|
||||||
triplet_obj = Triplet(from_node_id=start_node_id, to_node_id=end_node_id, text=embeddable_text)
|
relationship_name = relationship.get("relationship_name", "")
|
||||||
|
triplet_id = generate_node_id(str(start_node_id) + str(relationship_name) + str(end_node_id))
|
||||||
|
|
||||||
|
triplet_obj = Triplet(
|
||||||
|
id=triplet_id, from_node_id=start_node_id, to_node_id=end_node_id, text=embeddable_text
|
||||||
|
)
|
||||||
|
|
||||||
return triplet_obj, None
|
return triplet_obj, None
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue