Skip to content

Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.

fix: diagnose naive identifiers on graph templates at create

dex0shubham67613e2e41fb
diff --git a/hyperextract/utils/template_engine/parsers/identifiers.py b/hyperextract/utils/template_engine/parsers/identifiers.py
index 7f39d80..7e02f96 100644
--- a/hyperextract/utils/template_engine/parsers/identifiers.py
+++ b/hyperextract/utils/template_engine/parsers/identifiers.py
@@ -121,6 +121,14 @@ def validate_identifiers_fields(
):
return
+ if not isinstance(identifiers, GraphIdentifiersSchema):
+ # Same diagnosis as the validator's HE-T003; without this the graph
+ # field checks below raise AttributeError on item_id-only identifiers.
+ raise ValueError(
+ f"{autotype} templates require identifiers.entity_id, "
+ "relation_id, and relation_members (not item_id)"
+ )
+
entity_fields = declared_fields.get("entities", set())
relation_fields = declared_fields.get("relations", set())