Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.
fix: accept TemplateCfg instance as create() source
dex0shubhamada21437160d
diff --git a/hyperextract/utils/template_engine/factory.py b/hyperextract/utils/template_engine/factory.pyindex 4c284f3..313fc0d 100644--- a/hyperextract/utils/template_engine/factory.py+++ b/hyperextract/utils/template_engine/factory.py@@ -455,6 +455,8 @@ class TemplateFactory:template_cfg = load_template(s)case str() as s:template_cfg = Gallery.get(s)+ case TemplateCfg() as cfg:+ template_cfg = cfgcase _:raise ValueError("Invalid source: must be a template path or file path")@@ -493,10 +495,12 @@ class TemplateFactory:template_cfg, llm_client, embedder, **kwargs)- if source.endswith(".yaml"):- template.metadata["template"] = Path(source).stem+ if isinstance(source, str):+ template.metadata["template"] = (+ Path(source).stem if source.endswith(".yaml") else source+ )else:- template.metadata["template"] = source+ template.metadata["template"] = source.nametemplate.metadata["lang"] = languagetemplate.metadata["type"] = template_cfg.type