Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.
fix: validate hypergraph relation_members fields at load time
dex0shubham580b5a0cee40
diff --git a/hyperextract/utils/template_engine/parsers/identifiers.py b/hyperextract/utils/template_engine/parsers/identifiers.pyindex a401bbf..f3016e1 100644--- a/hyperextract/utils/template_engine/parsers/identifiers.py+++ b/hyperextract/utils/template_engine/parsers/identifiers.py@@ -137,13 +137,23 @@ def validate_identifiers_fields(f"relation_id references '{{{field}}}' but "f"relations.fields does not declare '{field}'")- if isinstance(identifiers.relation_members, dict):- for role, field in identifiers.relation_members.items():+ members = identifiers.relation_members+ if isinstance(members, dict):+ for role, field in members.items():if field not in relation_fields:problems.append(f"relation_members['{role}'] references '{{{field}}}' but "f"relations.fields does not declare '{field}'")+ else:+ # Hypergraph member fields: a single field name or a list of them.+ member_fields = [members] if isinstance(members, str) else (members or [])+ for field in member_fields:+ if field not in relation_fields:+ problems.append(+ f"relation_members references '{{{field}}}' but "+ f"relations.fields does not declare '{field}'"+ )for attr, section in (("time_field", "entities"),("location_field", "entities"),